OpenStack Nova install on an Ubuntu 10.10 XenServer virtual machine

Most of these instructions have been taken from the following two URLs:

http://wiki.openstack.org/NovaInstall/DevPkgInstall
http://wiki.openstack.org/RunningNova

However, I needed some additional steps to get this working in my virtualized environment.

Anyway, let’s get started. First off, get the VM’s package index and installed packages updated:

# apt-get update
# apt-get upgrade

Now we start with the Nova installation:

# apt-get install rabbitmq-server
# apt-get install python-software-properties
# add-apt-repository ppa:nova-core/milestone
# apt-get update
# apt-get install python-nova
# apt-get install nova-common nova-doc nova-api nova-network nova-objectstore nova-scheduler nova-compute euca2ools unzip

A listing of available OpenStack PPAs is available here. I’ve opted to use ppa:nova-core/milestone, which is the “last development milestone”.

Instead of creating a file for volumes (as outlined in http://wiki.openstack.org/RunningNova), I create a partition at the end of my disk (since there’s free space), and use that instead. Note that I set the partition to Linux LVM (8e), since we’ll be using LVM.

# fdisk /dev/sda
# partprobe
# apt-get install lvm2
# vgcreate nova-volumes /dev/sda2

Update: This volume doesn’t appear to get used when creating images of type qemu or uml.

Now we create a network to be used by our instances. I didn’t use 10.0.0.0/8 as per http://wiki.openstack.org/RunningNova, as my VM is already connected to a subnet in that network, so I use 192.168.0.0/16 instead.

# nova-manage network create 192.168.0.0/16 1 256

This creates:

# nova-manage network list
network           	netmask        	start address  	DNS            
192.168.0.0/24    	255.255.255.0  	192.168.0.3    	None           
#

What we now do is create an admin user, create a project, and unzip nova.zip into /root. Sourcing novarc sets up all our environment variables, and will need to be run each time we log out and back into the host.

# cd /root
# nova-manage user admin mattt
# nova-manage project create test mattt
# nova-manage project zipfile test mattt
# unzip nova.zip 
Archive:  nova.zip
 extracting: novarc                  
 extracting: pk.pem                  
 extracting: cert.pem                
 extracting: cacert.pem              
# . novarc

Now we grab a Linux image to use for our instances, and register it:

# cd /root
# wget http://uec-images.ubuntu.com/releases/10.04/release/ubuntu-10.04-server-uec-amd64.tar.gz
# uec-publish-tarball ubuntu-10.04-server-uec-amd64.tar.gz mybucket
Fri Jul  1 09:23:53 UTC 2011: ====== extracting image ======
Warning: no ramdisk found, assuming '--ramdisk none'
kernel : lucid-server-uec-amd64-vmlinuz-virtual
ramdisk: none
image  : lucid-server-uec-amd64.img
Fri Jul  1 09:24:12 UTC 2011: ====== bundle/upload kernel ======
Fri Jul  1 09:24:14 UTC 2011: ====== bundle/upload image ======
Fri Jul  1 09:25:23 UTC 2011: ====== done ======
emi="ami-3d4b2b15"; eri="none"; eki="aki-4eb969b8";
#

We should now be able to list the image:

# euca-describe-images 
IMAGE	aki-4eb969b8	mybucket/lucid-server-uec-amd64-vmlinuz-virtual.manifest.xml		available	public		x86_64	kernel		
IMAGE	ami-3d4b2b15	mybucket/lucid-server-uec-amd64.img.manifest.xml		available	public		x86_64	machine	aki-4eb969b8	
#

Note that when using ppa:nova-core/trunk, I had to do the following to get this to work:

# apt-get install glance
# glance-control api start

I’ll need to circle back to ppa:nova-core/trunk later and see why the default install relies on glance, but doesn’t install it.

Now we create an ssh key to inject into our images, and we go ahead and spawn an instance. We use the ami for the image registered above (ami-3d4b2b15 in this case):

# euca-add-keypair mykey > mykey.priv
# chmod 600 mykey.priv
# euca-run-instances ami-3d4b2b15 -k mykey -t m1.tiny
RESERVATION	r-hcvy99xp	test	default
INSTANCE	i-00000002	ami-3d4b2b15			scheduling	mykey (test, None)	0		m1.tiny	2011-07-01T09:33:39Z	unknown zone
#

We should now be able to list our instances, and see the status as “running”:

# euca-describe-instances
RESERVATION	r-hcvy99xp	test	default
INSTANCE	i-00000002	ami-3d4b2b15	192.168.0.4	192.168.0.4	running	mykey (test, nova-blog-1gb)	0		m1.tiny	2011-07-01T09:33:39Z	nova
#

Note that my original instance creation failed, as it was trying to (by default) create a KVM instance. Since my hardware doesn’t support KVM, and I’m running within a VM already, I had to append this to /etc/nova/nova.conf:

# echo "--libvirt_type=qemu" >> /etc/nova/nova.conf
# service nova-compute restart

We should in theory be able to use UML instead of qemu (see http://wiki.openstack.org/Nova/UML), but I haven’t fully tested this. More information to come.

My instance should now be accessible over the network:

# ping -c 1 192.168.0.4
PING 192.168.0.4 (192.168.0.4) 56(84) bytes of data.
64 bytes from 192.168.0.4: icmp_req=1 ttl=64 time=0.000 ms
 
--- 192.168.0.4 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.000/0.000/0.000/0.000 ms
#

The IP for the instance can be found via euca-describe-instances executed above.

Assuming the instance is pingable, I should be able to ssh into it:

# euca-authorize -P tcp -p 22 default
# ssh -i mykey.priv root@192.168.0.4

Note that I didn’t actually have to run euca-authorize in order to ssh into my instance, so I suspect the default security group allows all.

Lastly, you can terminate the instance:

# euca-terminate-instances i-00000002

The one final thing I will say is that in order for my instances to be able to access the public Internet, I had to add the following to /etc/nova/nova.conf (replacing x.x.x.x w/ my VM’s public IP address):

# echo "--routing_source_ip=x.x.x.x" >> /etc/nova/nova.conf
# echo "--fixed_range=192.168.0.0/24" >> /etc/nova/nova.conf
# service nova-network restart

This causes the correct POSTROUTING chain SNAT rules in the nat table to get created, allowing my instance on the 192.168.0.0/24 network to reach the public Internet.

Please let me know if you see any glaringly obvious errors here, and again 99% of this information was obtained from http://wiki.openstack.org/NovaInstall/DevPkgInstall and http://wiki.openstack.org/RunningNova. I haven’t given thorough info on what all the commands do as quite frankly I don’t know myself, but will circle back once I have more knowledge on everything.

One Response to “OpenStack Nova install on an Ubuntu 10.10 XenServer virtual machine”

  1. [...] boompty boomp « OpenStack Nova install on an Ubuntu 10.10 XenServer virtual machine [...]

Leave a Reply

You must be logged in to post a comment.