DevStack on Hyper-V

Post 11 of 16

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:

 

 

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.

 

 

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.

 

 

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:

  1. Access the server from another host using Hyper-V Manager on Windows 8 or Windows Server 2012
  2. 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:

 

 

And now we can finally access the console of our new VM:

 

 

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:

 

 

We need Git to download DevStack:

 

Installing and running DevStack is easy:

 

 

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.:

 

 

Now edit your ~/.bashrc file and add the following lines at the end, in order to have your environment ready whenever you log in:

 

 

And reload it with:

 

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.

 

 

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:

 

 

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:

 

 

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:

 

 

You should see a smile “:-)” close to each service and no “XXX”.

Now it’s time to boot our first OpenStack VM:

 

 

You can check the progress and status of your VM with:

 

 

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:

 

 

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

 

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:

 

 

For Grizzly you will get: ['2013, '1', '0']  (the last number might also be “None”).

 

, , ,

This article was written by apilotti

5 comments:

OpenStack Community Weekly Newsletter (Nov 16-30) » The OpenStack BlogNovember 30, 2012 at 18:49Reply

[...] By Alessandro Pilotti: DevStack on Hyper-V [...]

Magnus TjerneldJanuary 10, 2013 at 17:30Reply

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?

Magnus TjerneldJanuary 11, 2013 at 00:29Reply

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’

DanSeptember 27, 2013 at 23:38Reply

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.

Alessandro PilottiOctober 30, 2013 at 07:26Reply

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.

Menu