Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Apache Cloudstack - Google Summer of Code 2014.

Apache Cloudstack - Google Summer of Code 2014.

As part of Google Summer of Code 2014 (GSoC) I worked with Apache Cloudstack. The project revolved around automating different environments to ease development, testing and production installation.

During the period I was exposed to many different technologies including:

  • Chef: Configuration management tool.
  • Packer: Open Source tool for creating identical machine images from a single source configuration.
  • XenServer: Hypervisor that is supported by Apache Cloudstack.
  • Vagrant: Wrapper around VirtualBox and Configuration management utilities.

My project's proposal can be viewed on Google Melange:

My first goal was to create a XenServer vagrant box. This was going to be used as a hypervisor for any future Cloudstack Deployments I did.

I wanted to automate the creation of this box to allow community members to build their own. I began reading up on packer and doing an unattended installation of XenServer.

After much testing and trial and error I had eventually had solution that allowed me to reproduce the same box multiple times.

The source for creating the box can be found at: Along with this I uploaded the box to vagrant cloud. This means vagrant users can execute vagrant init duffy/xenserver && vagrant up and have a running version of XenServer within vagrant a few moments later.

After this I began looking at other necessary requirements for a Cloudstack deployment. This included an installation of MySQL and NFS.

I started writing a Cloudstack Cookbook ( ). This would be responsible for the installation of MySQL and NFS for now, later on in the GSoC period this was extended more to support deploying Cloudstack in different forms.

Lastly, I needed a NAT router that would allow virtual machines brought up by Apache Cloudstack to have Internet access. I wrote a chef cookbook which configured iptables for this purpose ( ).

With all this groundwork completed I was able to begin work on the designs outlined in my proposal.

Design 1

Design 1

Design 1 (Basic)

Design 1 (basic) provides people with a fast way to get a basic networking Apache Cloudstack environment up and running.

On executing vagrant up the user is presented with two boxes:

  • that is a MySQL, NFS and a NAT Router.
  • that is an installation of XenServer.

From here the user can bring up Cloudstack on their host machine and point it at the configured/provisioned infrastructure listed above.

In order to make this easier I also supply a marvin configuration file which will automate the configuration of a basic zone within Cloudstack.

Relevant VagrantFile:

Relevant Cookbook:

Design 1 (Advanced)

Design 1 advanced

Design 1 (advanced) is much the same as the above-described Design 1 (basic).

The difference is the network configuration on the supplied virtual machines. More virtual network cards were introduced in order to allow a user to bring up an advanced zone within Cloudstack.

Relevant VagrantFile:

Relevant Cookbook:

Design 1 resulted in some extensions in the earlier mentioned Cloudstack Cookbook. It was extended to support the downloading and preseeding of Cloudstack's SystemVM images.

Along with this I experienced issues with the ttylinux_vhd image supplied for devcloud. It had hard coded DNS configuration that was not overwrote by the DHCP lease. As a work around for this I wrote a script ( ) that generated debian images for all Cloudstack supported hypervisors. These are now publicly available for community usage at

Design 2

Design 2

This changed slightly over what was originally proposed. Instead of doing a from source installation it uses the Cloudstack RPMs. As a result the recipe is more focused around providing a foundation for automating a cloudstack installation within a production environment.

Within this setup the user is supplied with two boxes:

  • that has MySQL, NFS and the Cloudstack management server installed.
  • that is an installation of XenServer.

The chef recipe will install and configure Cloudstack. Once Cloudstack is running marvin executes with a user specified configuration file.

For demo purposes of the recipe the configuration file is set to configure Cloudstack to setup a basic zone using the hypervisor on

The recipe provides a foundation for people wishing to automate an install of Cloudstack. It demonstrates how to:

  • install and configure MySQL.
  • install and configure NFS.
  • preseed the SystemVM templates.
  • setup up the cloudstack databases.
  • do an initial import of custom sql configuration (This in the project case is done to allow the deployment to work in a nested virtualization environment).
  • Setup Cloudstack.
  • Install and use marvin for configuring Cloudstack.

Relevant VagrantFile:

Relevant Chef Recipe:

Design 3

Design 3

Design 3 involved creating an all in one VM solution that would supply a user with a running version of Cloudstack Simulator.

To allow this I needed to write another recipe for the Cloudstack Cookbook. This recipe was responsible for:

  • Installing all developer tools required for compiling Cloudstack.
  • Downloading the user specified branch of the Cloudstack code base.
  • Compiling the Cloudstack code base with simulator support.
  • Creating an init script that would bring up Cloudstack.
  • Using marvin to configure Cloudstack in simulator mode.

Relevant VagrantFile:

Relevant Chef Recipe:

While it works it isn't fast due to the amount of work that is required. I wasn't happy with this and began to explore an alternative approach to getting an all in one simulator box up fast.

I ended coming up with a solution that allowed me to take the precompiled cloud-client-ui.war file and deploy it using jetty. As a result a user can a VM running the Cloudstack Simulator in however long it takes them to download ~ 128mb.

Relevant VagrantFile:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.