Setting a Virtual Network in VirtualBox

On Virtualbox, we go to File > Preferences > Network and add a new Host-Only Network and configure DHCP for it.

new network virtualbox

network details

Then on each VM > Settings > Network you’ll want to set a new Host-Only adapter and select the network you just created.

network adapter

Once we’re done installing Ubuntu, inside the VM we want to check the adapter names and verify that the second adapter (enp0s3) does not have an IP attached yet. We check the interfaces configuration with:

After that, we edit the interfaces the VM has configured and add the secondary network interface with the name of the second adapter so it looks like this.

interfaces vm

After that our adapter should have an IP attached to it.

adapter configured

We repeat the steps for the other guest VMs and you can verify connectivity by pinging each other.

We cover those steps in the following video:

LXD Live Migration

Recommended reading Differences between OS Containers and Application Containers

LXC

LXC (LinuX Containers) provide an isolated operating system environment with its own file system, network, process and block I/O space. Source

LXC is a userspace interface for the Linux kernel containment features.
Through a powerful API and simple tools, it lets Linux users easily create and manage system or application containers. Source

LXD

LXD is a container “hypervisor” and a new user experience for LXC.

Specifically, it’s made of three components:

  • A system-wide daemon (lxd)
  • A command line client (lxc)
  • An OpenStack Nova plugin (nova-compute-lxd)

Source

Task

  • Create two virtual Linux machines and run them with an appropriate hypervisor.
  • Set up and configure a Linux container in one of the machines.
  • Manage the container with LXC and LXD. Demonstrate how to migrate it live from the first to the second virtual machine so that it keeps running there and the first machine can be shut down.
  • Discuss some of the tools such as Virt-Manager to manage virtual machines and containers.

Solution

Steps

  1. Create our VMs on our Hypervisor
  2. Set the Virtual Network
  3. Set the VN interfaces on VM1, VM2
  4. Set up LXD on VM1, VM2
  5. Create our container on VM1
  6. Create a migration profile on VM1, VM2
  7. Migrate our container

Arquitecture

arquitecture

Running Windows 10 on my computer, I installed two Ubuntu Server 16.04 VMs over Virtualbox (I used this hypervisor given my previous experience with it while developping Android applications).

Setting the Virtual Network

Before you install Ubuntu in your VMs, make sure you first set up the internal network for the VMs in VirtualBox, the process of how we did that is explained here Setting a Virtual Network in VirtualBox.

Now we can proceed to install LXD and configure it to make our live migration possible.

Setting up LXD

These configuration steps apply for Ubuntu Server 16.04, for more information on other versions see Installing and Configuring LXD and its series.

Once you have your VM installed and configured, to set up LXD you have execute the following:

LXD supports a number of storage backends which should be considered in case we wanted to move containers or images in the future between backends. We’ll configure ZFS as it supports all the features LXD needs to offer the fastest and most reliable container experience.

To configure LXD to use it, simply run (do not set proxy nor bridging configuration):

Once you’ve got LXD set, we need to sort out the network configuration since LXD doesn’t listen to the network by default. The only way to talk to it is over a local unix socket at /var/lib/lxd/unix.socket.

To have it listen to the network, there are two useful keys to set:

It’s also good to set the configuration for the image management on LXD:

LXD does dynamic image caching. When instructed to create a container from a remote image, it will download that image into its image store, mark it as cached and record its origin. After a number of days without seeing any use (10 by default), the image is automatically removed. Every few hours (6 by default), LXD also goes looking for a newer version of the image and updates its local copy.

We repeat these steps for the second VM and at this point we should have a working version of the latest LXD release on both VMs.

Migrating a Container

On the VM we want to migrate from, we do:

To list all your containers, you can do:

To get more information from a specific container, you can do:

Finally, we have to add both of our LXDs as non unix-sockets remotes. For this we have to check what IP each VM has in the network running ifconfig on them.

Now we have our VMs connected and all the configuration set up, we need to install one last dependency:

And we should be able to do

We cover all these steps in the 2nd and 3rd part of the tutorial series:

References

LXD 2.0: Installing and configuring LXD [2/12]. (n.d.). Retrieved June 09, 2016, from https://www.stgraber.org/2016/03/15/lxd-2-0-installing-and-configuring-lxd-212/

LXD 2.0: Your first LXD container [3/12]. (n.d.). Retrieved June 09, 2016, from https://www.stgraber.org/2016/03/19/lxd-2-0-your-first-lxd-container-312/

LXD 2.0: Live migration [9/12]. (n.d.). Retrieved June 09, 2016, from https://www.stgraber.org/2016/04/25/lxd-2-0-live-migration-912/

Live Migration in LXD. (n.d.). Retrieved June 09, 2016, from https://insights.ubuntu.com/2015/05/06/live-migration-in-lxd/

Essential Concepts

Docker image vs container. (n.d.). Retrieved June 09, 2016, from http://stackoverflow.com/questions/23735149/docker-image-vs-container

LXD & LXC

What’s LXD? (n.d.). Retrieved June 09, 2016, from https://linuxcontainers.org/lxd/

What’s LXC? (n.d.). Retrieved June 09, 2016, from https://linuxcontainers.org/lxc/introduction/

What is the difference between Docker, LXD, and LXC. (n.d.). Retrieved June 09, 2016, from http://unix.stackexchange.com/questions/254956/what-is-the-difference-between-docker-lxd-and-lxc

LXC containers in Ubuntu Server 14.04 LTS. (n.d.). Retrieved June 09, 2016, from http://en.community.dell.com/techcenter/os-applications/w/wiki/6950.lxc-containers-in-ubuntu-server-14-04-lts

Connecting Bitbucket with Git (Windows)

http://static1.takipiblog.com/wp-content/uploads/2014/05/GitHubVSBitbucket.png

  1. Start Menu
  2. Open Git Shell and execute:
  3.  execute:

  4.  enter enter enter enter
  5.  execute:

  6. Copy the key (content) into clipboard
  7. At bitbucket.com
  8. Go Top Right > Manage Account
  9. Left > Securty > SSH Keys
  10. Add Key
  11. Set your PC’s name as label
  12. Paste your clipboard
  13. Create a file on this path with this name:

    containing:

  14. Open Git Shell again; your path will be :

  15.  Execute:
  16. Open GitHub for Windows
  17. GitHub for Windows  > Options > Scan for Repositories
  18. Your project will show up for you to add it.
  19. Open your project

Special thanks to Garciat

OBI Resources

Array Fill IV

Por que memset solo funciona para cerar una estructura?

Template


Problemas Codeforces

URI: Operadores Binarios

URI OP Binarios: Haskell

Algorithms 4 – R. Sedgewick

Investigacion de Operaciones

Referencias IO2
http://mat.tepper.cmu.edu/blog/wp-content/uploads/2010/11/twitterfollowers.jpg
Cadenas de Markov: Tiempo medio de Primer Paso de un estado i a un estado j donde i es diferente de j. Link
Libro completo: Hamdy Taha 9na Edicion – Investigacion de Operaciones: Link. Sugerencia: hacer todos los ejercicios del libro para Colas y Markov minimo.
Ejercicios
Markov
Teoria de Juegos
Teoria de Decisiones
Teoria de Colas