DevStack is without any doubt one of the easiest ways to set up an OpenStack environment for testing or development purposes (no production!!).
It’s also a great way to test the Hyper-V Nova Compute and Quantum Grizzly beta versions that we are releasing these days! 🙂
Hyper-V Server 2012 is free and can be downloaded from here . The installation is very simple and straightforward as with any Windows Server solution. You can use of course also the full Windows Server 2012 , but unless you are really missing the GUI features, there’s no need for it.
Another great option for development consists in enabling the Hyper-V role on Windows 8 (Pro or Enterprise). If you have a Mac, Linux or Windows 7 you can run both Hyper-V and DevStack virtualized on VMWare Fusion 5 / Workstation 9.
To make things even easier, in this guide we’ll run DevStack in a VM on top of the Hyper-V compute node. Hyper-V is not particularly picky about hardware, which means that there’s no need for expensive servers to be used for test and development.
The DevStack VM
Let’s start by downloading an Ubuntu Server 12.04 ISO image and create a VM on Hyper-V. Since Hyper-V Server does not provide a GUI, you can do that from a separate host (Windows 8 / Windows Server 2012) or you can issue some simple Powershell commands.
Here’s how to download the Ubuntu ISO image via Powershell:
1 2 3 |
$isourl = "http://releases.ubuntu.com/12.04/ubuntu-12.04.1-server-amd64.iso" $isopath = "C:\ISO\ubuntu-12.04.1-server-amd64.iso" Invoke-WebRequest -uri $isourl -OutFile $isopath |
You will need an external virtual switch, in order for the VMs to communicate with the external world (including Internet for our DevStack VM). You can of course skip this step if you already created one.
1 2 |
$net = Get-NetAdapter $vmswitch = new-vmswitch External -NetAdapterName $net[0].Name -AllowManagementOS $True |
Finally here’s how to create and start the DevStack VM, with 1 GB RAM and 15 GB HDD, a virtual network adapter attached to the external switch and the Ubuntu ISO attached to the DVD for the installation.
1 2 3 4 |
$vm = new-VM "DevStack" -MemoryStartupBytes (1024*1024*1024) -NewVHDPath "C:\VHD\DevStack.vhdx" -NewVHDSizeBytes (15*1024*1024*1024) Set-VMDvdDrive $vm.Name -Path $isopath Connect-VMNetworkAdapter $vm.Name -SwitchName $vmswitch.Name Start-VM $vm |
Now it’s time to connect to the VM console and install Ubuntu. All we need is a basic installation with SSH. DevStack will take care of the rest.
Console access
The free Hyper-V Server does not provide a console UI application, so we have two options:
- Access the server from another host using Hyper-V Manager on Windows 8 or Windows Server 2012
- Using our free FreeRDP based solution directly from the Hyper-V server
We’ll choose the latter in this guide as we simply love it. 🙂
In Powershell from the directory in which you unzipped FreerDP run:
1 2 |
Set-ExecutionPolicy RemoteSigned Import-Module .\PSFreeRDP.ps1 |
And now we can finally access the console of our new VM:
1 |
Get-VMConsole DevStack |
Once you are done with the Ubuntu setup, we can go on and deploy DevStack. My suggestion is to connect to the Ubuntu VM via SSH, as it’s way easier especially for pasting commands. In case you should need an SSH client for Windows, Putty is a great (and free) option.
Let’s  start by adding an NTP daemon as time synchronization issues are a typical source of headaches in OpenStack:
1 2 |
sudo apt-get install ntp sudo service ntp start |
We need Git to download DevStack:
1 |
sudo apt-get install git |
Installing and running DevStack is easy:
1 2 3 |
git clone git://github.com/openstack-dev/devstack.git cd devstack ./stack.sh |
The script will ask you for a few passwords. You will find them in the “devstack/localrc” file afterwards.
In case you should prefer to run a specific version of the OpenStack components instead of the latest Grizzly bits, just add the branch name to the git clone command, e.g.:
1 |
git clone git://github.com/openstack-dev/devstack.git -b stable/folsom |
Now edit your ~/.bashrc file and add the following lines at the end, in order to have your environment ready whenever you log in:
1 2 3 4 |
export OS_TENANT_NAME=admin export OS_USERNAME=admin export OS_PASSWORD=yourpassword export OS_AUTH_URL="http://localhost:5000/v2.0/" |
And reload it with:
1 |
source ~/.bashrc |
It’s time to add an image to Glance in order to spawn VMs on Hyper-V. To save you some time we prepared a ready made Ubuntu VM image. When you create your own, remember to use the VHD format and not VHDX.
1 2 3 |
wget http://www.cloudbase.it/downloads/UbuntuServer1204_cloudinit.zip unzip UbuntuServer1204_cloudinit.zip glance image-create --name "Ubuntu Server 12.04" --property hypervisor_type=hyperv --container-format bare --disk-format vhd < UbuntuServer1204.vhd |
Note the hypervisor_type property. By specifying it, we are asking Nova Scheduler to use this image on Hyper-V compute nodes only, which means that you can have a mix of KVM, Xen or Hyper-V nodes in your stack, letting Nova Scheduler taking care of it any time you boot a new image, a great feature IMO!
We are almost done. Let’s create a new keypair and save the private key in your user’s home:
1 2 3 |
test -d ~/.ssh || mkdir ~/.ssh nova keypair-add key1 >> ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa |
Ok, we are done with DevStack so far. We need to setup our Hyper-V Nova Compute node, which is even easier thanks to the installer that we released :-). Let’s go back to the Powershell:
1 2 3 4 5 |
$src = "http://www.cloudbase.it/downloads/HyperVNovaCompute_Beta.msi" $dest = "$env:temp\HyperVNovaCompute_Folsom.msi" Invoke-WebRequest -uri $src -OutFile $dest Unblock-File $dest Start-Process $dest |
The installation is very easy, just follow the steps available here!
Remember to specify the IP address of your DevStack VM for Glance and RabbitMQ. As Nova database connection string you can simply use: mysql://root:YourDevStackPassword@YourDevstackIP/nova
(Note: never use “root” in a production environment!)
Now let’s go back to DevStack and check that all the services are up and running:
1 |
nova-manage service list |
You should see a smile “:-)” close to each service and no “XXX”.
Now it’s time to boot our first OpenStack VM:
1 |
nova boot --flavor 1 --image "Ubuntu Server 12.04" --key-name key1 vm1 |
You can check the progress and status of your VM with:
1 |
nova list |
The first time that you boot an instance it will take a few minutes, depending on the size of your Glance image, as the image itself gets cached on the compute node. Subsequent image boots will be very fast.
Some useful tips
How to delete all the VM at once from the command line
During testing you’ll need to cleanup all the instances quite often. Here’s a simple script to do that on Linux without issuing single “nova delete” commands for every instance:
1 |
nova list | awk '{if (NR > 3 && $2 != "") {system("nova delete " $2);}}' |
How to update DevStack
I typically run the following script from the DevStack folder after a reboot to update the OpenStack components (Nova, Glance, etc) and the DevStack scripts, just before running stack.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
git pull pushd . cd /opt/stack/nova git pull cd /opt/stack/glance git pull cd /opt/stack/cinder git pull cd /opt/stack/keystone git pull cd /opt/stack/horizon git pull cd /opt/stack/python-glanceclient git pull python setup.py build sudo python setup.py install --force cd /opt/stack/python-novaclient git pull python setup.py build sudo python setup.py install --force cd /opt/stack/python-cinderclient git pull python setup.py build sudo python setup.py install --force cd /opt/stack/python-keystoneclient git pull python setup.py build sudo python setup.py install --force popd |
How to check your OpenStack versions
All the components in your stack need to share the same OpenStack version. Don’t mix Grizzly and Folsom components!! Here’s how to check what Nova version you are running:
1 |
python -c "from nova import version; print version.NOVA_VERSION" |
For Grizzly you will get: [‘2013, ‘1’, ‘0’] Â (the last number might also be “None”).
Hi!
Thanks for an interesting run down. I’ve followed it through on Windows 8 and seem to have everything running at the linux end, but I cannot start the nova-compute service in Windows.
I get the following error in the nova-compute log:
http://pastebin.com/zg2fQHXF
Anything that rings a bell?
Update: Disregard. I switched to the Grizzly Beta version and did a clean install and a reboot. The service starts now. I’m able to get all the way to the “nova boot” phase. It clearly communicates with my Windows 8 since it starts building the base instance folders, but fails when trying to add the VM to Hyper-V.
Error given:
‘HyperVException: Failed to add VHD image to VM instance-00000002n’
How would I go about removing the qemu-kvm hypervisor form the controller node after I have deployed the hyper-v node? Do I simply disable the service and remove it using apt-get? Thanks.
Hi Dan,
It depends on how you installed it. If you have a daemon in /etc/init.d disabling the service is enough.
For this general questions I suggest to look on the #OpenStack IRC channel on FreeNode or on the OpenStack ML.
Hi Alessandro,
First of all i want to thanks for your work hard to bring to us the incredible product and it help e a lot of to deploying an private cloud for my job. Not like as the first time i install devstack folsom, it ran well and i can create instances from horizon dashboard to hyper-v compute node but due to error occurring in implementing proccess i have to reinstall devstack again and now it’s happen with the error “ERROR: openstackclient.shell Exception raised: six>=1.6.0”. Please help me how to handle with this.
Thanks in advance.
Hi Justing,
Are you getting this error when installing DevStack or the Hyper-V components?
In the former case, https://ask.openstack.org/en/questions/ might be a better place to ask for generic OpenStack / DevStack questions.
Thanks,
Alessandro