Note: kindly consider a more modern appliance based CloudStack development with MonkeyBox.


If you're looking for a pre-configured CloudStack environment please refer to DevCloud.

This is a do-it-yourself guide to help you hack your own custom CloudStack development environment. JFYI, reverse-engineer DevCloud: /root/.bash_history and /home/devcloud/setup.sh

Table of Contents

Getting started

New to CloudStack? Checkout the n00b developer's guide: Contributing as a non-committer

Terms used throughout the guide:

  • host or host-os, means your operating system running on top of your laptop/desktop.
  • hypervisor or hypervisor-vm or xen/server or xenserver-vm means a XenServer running inside a VM on VirtualBox.
  • guest-os or guest-vm means the virtual machine running on a xenserver-vm.

CAUTION: This kind of setup is unstable, in my case my system with 8GB RAM would crash a lot (make sure you allocate 500MB to dom0). This guide just shares a proof-of-concept setup, not necessarily the best.

For simplicity, in this guide we'll use the same kind of networking, IP ranges and filesystem paths as in DevCloud and create a non-monolithic setup:

  1. Two XenServer VMs (Both run as separate VMs on VirtualBox).
  2. One Ubuntu/Linux server to provide DNS and NFS for secondary storage (This may be on one the hypervisor's dom0).
  3. CloudStack development environment, the management server and the MySQL server runs on your host-os.
  4. When creating any VM, XenServer or Ubuntu/Linux, use these credentials;
    user: root
    password: password

Prerequisites

VirtualBox: https://www.virtualbox.org/wiki/Downloads

XenServer 6.0.2: http://downloadns.citrix.com.edgesuite.net/akdlm/6760/XenServer-6.0.201-install-cd.iso (if link fails, google for Citrix XenServer and download the free XenServer)

Ubuntu Server: http://www.ubuntu.com/download/server (any, x86 or x86_64)

Get dependencies: Git, Java, Ant, Tomcat (use 6.0.33, problems with latest version), MySQL, mkisofs

Setting up CloudStack Development Environment

Setting up a CloudStack development environment on Mac OSX

Setting up Cloudstack dev environment on Windows

Setting up on Linux: Refer to INSTALL.txt in the root directory of the source code

Install MySQL with root user's password blanked out as used as default by CloudStack. In case you gave a password during installation: http://stackoverflow.com/questions/3032054/how-to-remove-mysql-root-password

DIY Setup

Networking

Configure a host-only network, a host-only network is a private network between your VMs and the host-os only:

  1. Goto VirtualBox/File->Preferences->Network->Add host-only network (check if there exists one, check the IP ranges below else add a new one)
  2. 2. Select the add host-only network, Edit host-only network with following IP ranges with DHCP disabled (untick Enable DHCP):
    IPv4 Address: 192.168.0.1 (address of your gateway)
    IPv4 Network Mask: 255.255.255.0
  3. Leave other fields as it is and click OK, exit preferences.

Note: While configuring any host-only adapter adapter for a VM select its promiscuous mode to 'allow all'.

We'll use these IPs for our setup:

DNS/NFS: 192.168.0.5

Gateway: 192.168.0.1

XenServer0: 192.168.0.10

XenServer1: 192.168.0.11

Ubuntu Linux as DNS/NFS

Create a VM in VirtualBox using the Ubuntu server ISO with about 500MB RAM or more, and disk 10+ GB.

In Network, enable two adapters: (select the first one for your primary network)

For the first one: select NAT.

For the second one: select host-only adapter, select vboxnet0 or appropriate adapter. Make sure to select the adapter's promiscuous mode to: Allow all..

The VirtualBox NAT has following defaults:

Gateway: 10.0.2.2 | DNS: 10.0.2.3 | DHCP: 10.0.2.1

Install Ubuntu Server (or any Linux distro) and install NFS and DNS server (DNS is optional): https://help.ubuntu.com/community/SettingUpNFSHowTo

sudo apt-get install bind9 nfs-kernel-server

DNS

To configure bind as a forwarding DNS, simply edit /etc/bind/named.conf.options: Enable forwarders to use 8.8.8.8.

/etc/init.d/bind9 restart

NFS

Configure directory structure and NFS exports, setup a SSVM template:

        mkdir -p /opt/storage/secondary

        mkdir -p /opt/storage/secondary/template/tmpl/1/1

        mkdir -p /opt/storage/secondary/template/tmpl/1/5

        echo "/opt/storage/secondary *(rw,no_subtree_check,no_root_squash,fsid=0)" > /etc/exports

        fileSvr="http://download.cloud.com/templates/devcloud"

        wget $fileSvr/defaulttemplates/1/dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd  -P /opt/storage/secondary/template/tmpl/1/1/

        wget $fileSvr/defaulttemplates/1/template.properties  -P /opt/storage/secondary/template/tmpl/1/1/

        /etc/init.d/nfs-kernel-server restart

Optional: get a sample centos/vm template (~50MB) for testing on your host-os:

        wget http://bhaisaab.org/vms/cent.vhd

A SSVM template is required in the secondary storage (chicken-egg problem), as CloudStack runs the SSVM from NFS and then SSVM then mounts the NFS as secondary storage, make sure the 'host' in global settings is correctly set to your management server IP and at port 8250 it is reachable.

Networking

We wish to use NAT as our default interface.

Setup static IP for eth1: (check/edit /etc/network/interfaces)

auto eth1
iface eth1 inet static
address 192.168.0.5
netmask 255.255.255.0
gateway 192.168.0.1

Check routes: route -n (if 10.0.2.2/eth0 is not the default gateway, fix that)

Reboot!

XenServer

Create two VMs (or create one VM, export it and import it as many time as number of XenServer VMs you want, depending on your system capability). Give it at least 2GB RAM, 10GB disk. Add one host-only adapter, select appropriate adapter (vboxnet0) and set promiscuous mode to 'Allow all'. Attach the XenServer ISO image and boot. During setup, skip check disk, skip supplementary packs, select manual time. For user root, use password: password. Static IP, 192.168.0.10 (for 1st vm, xs0.cloudstack.org) 192.168.0.11 (for 2nd vm, xs1.cloudstack.org), netmask 255.255.255.0, gateway 192.168.0.1 and dns 192.168.0.5.

For safety: after the XenServer boots up, login to dom0 of each XenServers and allocate some memory:

ssh root@192.168.0.10
xe host-list | grep uuid
xe vm-param-set memory-dynamic-max=500MiB uuid=<put here your dom0's uuid>

Done!

CloudStack

Build

Read the README and INSTALL.txt. Grab the source code:
git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.gitgit pull -v # Have your master updated

To build, deploy-server and database:
$ ant clean-all build-all deploy-server deploydb

Type to run mgt server:
$ ant debug

Basic Zone Configuration

Open (localhost is vboxnet0 gateway) http://192.168.0.1:8080/client with user: admin, password: password

Select the option that you know CloudStack. Now, goto Global Settings and make sure to configure these settings:

system.vm.use.local.storage: true
use.local.storage: true
host: 192.168.0.1
management.network.cidr: 192.168.0.0/24
secstorage.allowed.internal.sites: 192.168.0.0/24

Restart the management server, ant debug.

Now open the mgmt server, goto Infrastructure-> Zone(View All)>Add Zone>Basic->

Zone:

Name: MyZone

DNS1: 8.8.8.8

Internal DNS1: 192.168.0.5

Hypervisor: XenServer

->Network/Next

Pod Name: MyPod

Reserved system gateway: 192.168.0.1

Reserved system netmask: 255.255.255.0

Start reserved system IP: 192.168.0.200

End reserved system IP: 192.168.0.220

->Next

Guest Gateway: 192.168.0.1

Guest Netmask: 255.255.255.0

Guest start IP: 192.168.0.100

Guest end IP: 192.168.0.199

->Next

Cluster Name: MyCluster

->Next

Hostname: 192.168.0.10

username: root

password: password

->Next

Secondary Storage (Primary storage form will be skipped, if it shows up check your Global Settings with fields mentioned in above section):

NFS Server: 192.168.0.5

Path: /opt/storage/secondary

->Next

Launch Zone!

Wait till your SSVM/CPVM get started, watchout for errors on your terminal. Next add host, 192.168.0.11. This setup would require a lot of RAM, your system may crash a lot.

If everything goes well, you've your own devcloud setup! Now try to add that template, try migration etc.

  • No labels