Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This docoument contains the design specification for LXC support in Cloudstack.

Status

Currently in development/testing, see Code complete, testing and adding documentation. See last section below for details.

...

Code Block
libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.DirectVifDriver
network.direct.source.mode=private (other values: bridge|vepa)
network.direct.device=eth0

Development/testing notes

For minimum requirements, you will need to run the management server and an LXC host. The LXC host has the exact same setup as KVM, the only difference is you specify the "lxc" hypervisor in the agent config file. The LXC host will run the system VMs under KVM.

I am currently running my dev/test setup on two machines: 1) runs the management and 2) the other runs the LXC agent. The following sections detail how to get the development code running so that you can spin up LXC containers with Cloudstack. It's not very elegant, but is the easiest way I've found to quickly get the system up with development code. There's probably an easier way to do this, like with RPMs, but I haven't gotten around to that yet.

1. Install Cloudstack 4.0

  • Install the agent
    • This will install the KVM agent, we will configure it later for LXC

2. Checkout and build latest code

...

NOTE: The network device that is specified should not be a slave to any bridges.

Environment setup and testing

Obtaining latest code

The code for LXC support is on github on the master-lxc branch:

Code Block

git clone -b master-lxc 

...

git@github.com:gilt/incubator-cloudstack.git

...

3. Update management server with 4.1 code

  • Load the data model
    • cd incubator-cloustack
    • mvn -P developer -pl developer -Ddeploydb
  • Run the management server
    • mvn -pl :cloud-client-ui jetty:run
  • Load LXC data model
    • load cloudstack/setup/db/lxc.sql

...


...

Follow directions in /docs/en-US/build-rpm.xml to build RPMs for Cloudstack.

Installing Cloudstack

I will not cover how to install Cloudstack, please use the latest online documents. There are a few things to note when using the LXC code:

1. Use the latest system VM images from Jenkins

Import the latest system VM images for your template:

2

...

Code Block

/usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2 -h lxc -F
  • Restart management server

4. Update LXC agent with 4.1 code

  • Modify /etc/cloud/agent/agent.properties, add:
    • hypervisor.type=lxc
  • Modify /etc/init.d/cloud-agent
    • Replace the "export CLASSPATH" line with
    • Code Block
      
      PCP=""
      for jarfile in <incubator-cloudstack-dir>/client/target/cloud-client-ui-4.1.0-SNAPSHOT/WEB-INF/lib/cloud-*.jar /usr/share/java/jna.jar; do
          if [ ! -e "$jarfile" ] ; then continue ; fi
          PCP=$jarfile:$PCP
      done
      export CLASSPATH="$SCP:$DCP:$PCP:$JCP:/etc/cloud/agent:/usr/lib64/cloud/agent"
      
  • Restart cloud-agent
    • service cloud-agent restart

...

. Update Secondary Storage System VM with

...

LXC code

In this step we bring up the system to the point where system VMs are created. After the Secondary Storage VM starts up, we will secondary storage VM is online, we need to login and swap out the cloud jars with the ones we've built.

...

jars since it doesn't include the LXC code.

Code Block

ssh -i /root/.ssh/id_rsa.cloud -p 3922 root@169.254.x.x (SSVM local link ip)
cp -r /usr/local/cloud/systemvm /usr/local/cloud/systemvm.orig
rm /usr/local/cloud/systemvm/cloud-*.jar
scp root@<lxc-host>:<incubator-cloudstack-dir>/client/target/cloud-client-ui-4.2.0-SNAPSHOT/WEB-INF/lib/cloud-*.jar /usr/local/cloud/systemvm
service cloud stop
service cloud start

...

3.

...

LXC

...

container

Cloudstack will not come bundled with an LXC container image, so you will need to prepare one yourself or download one.

...