CloudStack Virtual Lab (WIP)

Its not always posible to test and deploy software on spare hardware, this is a Step by step build up a basic CloudStack deployment for a Virtual Lab Environment.

A peek into technology

Step by step build up a basic CloudStack deployment


Type2 Virtualization

This demo deployment was done on Type2 virtualization platform due to my limit hardware resource, you could install VirtualBox or Parallel if you want the whole stuff running on your laptop. XenServer is also a good choice, true servers are luxury.

Yes, there will be XenServer on top of XenServer or VirtualBox, and there even will be VMs running on the topmost XenServer which doesn’t support HVM, that was because all the VMs used in this deployment were Para-Virtualized Machines(PVM).


Windows 2003R2 (Virtual Machine) is gateway server with two NICs configured as below:

Ethernet 0 (

This is the only network we used in this demo, please make

sure all the hosts including Management Server, XenServers

are connected to the same network (By assigning NICs of

them to the same Virtual Network in your Type2-V software)

Ethernet 1

NAT(share host IP address to access internet)

NOTE: ‘host’ here means the native OS on the hardware in

Type2-V mode

NAT is configured on this gateway so that the hosts on could access internet thru it.


If your Type2 Virtualization software supports directly bridge VM network to your host NIC, that could make it easy but the built setup may refuse to work after you moved to different networks.

Time source

Install NTP daemon on this gateway server, it provides time service for all the rest hosts. download link:

DNS Server

Configure the same gateway server also a DNS server for all the hosts.

Eth0: Gateway, DNS:

Install the cloud management server

CloudStack management server runs on 64 bits RHEL/CentOS 5.4+ OS, but I prefer Oracle Enterprise Linux(wikipedia) as it is free and enterprise level quality with binary level compatibility with RHEL releases.

Download the install media

Download link:

Filename: Enterprise-R5-U4-Server-x86_64-dvd.iso

NOTE: 64bits is required.

Install OEL5.4

Follow the wizard to install the OEL5.4 onto either physical server or Virtual server (in our case) with below configuration:

RAM, CPU, 1G, 1VCPU,20G + 40G (two virtual disks)








NTP server

NOTE: the configuration used is only for this demo purpose, it’s not the best practice and some value may below the documented minimum requirement.

More details please refer to < CloudStack 2.2.4 – 2.2.7 Installation Guide.pdf>

Linux Post-Install configuration


Make sure hostname command outputs the FQDN

Make sure the host is connected to Internet by pinging

Configure the yum repo so that additional software could be installed

NOTE: This is important as CloudStack installer uses yum to install its dependency.

#cd /etc/yum.repos.d


Edit the download file ‘public-yum-el5.repo‘ and enable channel ‘el5_u4_base’:

Save the file and test yum:

Install CloudStack 2.2.8

Download the tarball from below location and upload it to cloud01:/root

unzip the tarball and start the installer

It will analyze the system and try to install the missing component from the preconfigured yum repository, the process should be smoothly done without error when you have a good Internet connection.

Re-run the and choose ‘D’ to install MySQL database

Post install configurations

MySQL database


Set database ‘root’ account password to ‘citrix

#service mysqld start

#mysql –u root

mysql> SET PASSWORD = PASSWORD(‘citrix’); mysql> exit

Test the new password:

Create CloudStack required databases

Back to the shell and issue below command to create CloudStack required databases:

#cloud-setup-databases cloud:citrix@localhost –deploy-as=root:citrix

Bypass HVM check

Apply this patch to bypass HVM check, otherwise you will not able to add those XenServers which are on top of XenServer or VirtualBox.

mysql> INSERT INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `description`) VALUES (‘Advanced’, ‘DEFAULT’, ‘management-server’, ‘xen.check.hvm’, ‘false’, ‘Shoud we allow only the XenServers support HVM’);

mysql> commit mysql> exit

Configure the host for management server


Set Primary Storage and Secondary Storage

Use 2nd HD of the host cloud01 as the storages

On host cloud01, there is 2nd HD sized 40G purposed for Primary Storage and Secondary Storage, NFS is used for both storages.

#mkdir /cloudstor

#mkfs.ext3 /dev/sdb

#mount /dev/sdb /cloudstor

#mkdir /cloudstor/primary

#mkdir /cloudstor/secondary

#chmod -R 777 /cloudstor

Page 9 of 32

Make sure sdb is auto-mounted while system boots

NFS related settings

#chkconfig nfs on

#/etc/init.d/nfs start

mount and test this NFS share:

Download system template required by CloudStack to SecondaryStorage

#/usr/lib64/cloud/agent/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u -h xenserver -F

Start the cloud-management service

[root@cloud01 ~]# /etc/init.d/cloud-management start

Starting cloud-management:

[ OK ]

Page 10 of 32

Install two XenServer hosts to be managed

Install XenServer5.6-01, XenServer5.6-02


XenServer 5.6





Linux Pack


Post Configuration

Change the only the network name of both hosts to ‘cloud-private‘ without the need of making the resource pool.

Page 11 of 32

Describe the deployment

Logon the CloudStack WebUI as admin

Open below address to access the CloudStack WebUI (admin/password)

Check settings

Check the ‘Global settings‘ and make sure the ‘host’ entry is with correct IP address:

Page 12 of 32


In case there is a need to change any of the global settings, you need to restart the cloud-management service by:

# /etc/init.d/cloud-management restart

Launch and finish the ZONE creation wizard

Page 13 of 32

Page 14 of 32

‘Submit’ to create the ZONE and POD.

Page 15 of 32

Create cluster and host (XenServer)

Navigate to the POD to create the CLUSTER

Pick ‘XenServer’ from the dropdown list and input ‘CLUSTER_A‘ as the cluster name, click ‘Add’ to create the cluster.

Navigate to the CLUSTER_A and add our first XenServer host

Page 16 of 32

Here is the screenshot after everything was done:

Page 17 of 32

Add ‘Primary Storage’

After it was done:

Page 18 of 32

Add ‘Secondary Storage’

After it was done:

Wait the good thing to happen

Wait around half an hour and you will finally see below running system VMs:

Page 19 of 32

One of them is the SecondaryStorageVM (SSVM), another one is ConsoleProxyVM (CPVM).

Check CentOS template download progress

Switch to ‘Templates’ view, and you will find the CentOS template is being downloaded :

Page 20 of 32


CentOS template download is automatically done, you don’t need to fire it, in case of this is not happening in your setup, please follow the DEBUG section in the Install Guide of CloudStack, but please be aware of the IP address used for SSH to SSVM should be its ‘Link local IP address‘ but not ‘private IP address’.

After the download is down, the template is ready for use.

Create ‘Service Offering’ (optional)

‘Service Offering’ is the service kind you want the customers to pick, each of them may associate with a price.

You could use the pre-defined Service Offerings or create new ones, but the nature of them are the VM specifications, they work with the templates and other cool stuff (Additional data disk, network offering etc) to deliver user’s real VM instances.

Page 21 of 32

Add ‘domain’ and ‘accounts’ who are the buyer users

You can edit ‘Resource limit’ for domains:

Page 22 of 32

The buyer’s experience

Logout and relogin with user account

Launch and finish VM creation wizard

Launch ‘Add instance’ wizard to create user VM (done by user himself/herself in self-service manner):

Page 23 of 32

Page 24 of 32

Page 25 of 32

The possible error leads the demo of the resource

utilization management

As the only added XenServer host is already having two system VMs running , and you probably have no free resource to support the new instance, then you will see error like this:

Page 26 of 32

Detailed information could be reviewed in ‘Alert’ view:

Page 27 of 32

Add more hosts to charge the computing

resource inventory

Relogin with ‘admin’ and add another XenServer host (XenServer5.6-02) to enlarge the capacity:

Now user will be able to create his/her VM as the resource is enough (the procedure is omitted).

Resource utilization overview

View the overall resource utilization thru the dashboard (‘admin’ user)

Page 28 of 32

Some more cool snapshots

Here is the console view of user ‘hongxi’ new created VM

It doesn’t rely on ActiveX or Applet to show you the VNC console of the VMs

End users’ dashboard

Volumes and snapshots

Volumes are Virtual Disks associate with your VMs, you as the end users, are able to take snapshot in a self-service manner, also it’s able to download the Volumes, this is very helpful when you want to move VMs/Data from public cloud back to your company.

Page 29 of 32

Users to add his/her own templates and ISOs

The normal users (as the buyers) is able to add his/her own preferred templates to be used publicly or privately for new VM instances:

ISO could be added in the same way so that creating new VMs from install media is possible.

Actions are recorded so that reporting and auditing is possible

Page 30 of 32

XenCenter view

Page 31 of 32

Closing remarks

This guide covers only the very basic features of CloudStack product, I will try to follow up with some more words on its advanced topics, such as:

Advanced Networking and multi-tenancies

Security Groups

Billing and report

Page 32 of 32

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s