RHEL 6 Openstack via EPEL Nova and Glance on KVM
In this post I will cover getting openstack nova and glance services installed from EPEL and configured to the point where an image can be started, this assumes
- You have a mysql instance installed and running
- You have a rabbitmq-server installed and running
- You have kvm installed and running (libvirt)
- You have selinux set to permissive, as I will not be covering selinux rules here at this time and I do not think disabled is a valid option ;-)
I will also be carrying out mySQL configuration of glance and nova, for 2011.3 (Diablo), though most if not all of this should be portable to the Essex release
Install EPEL
rpm -Uvh https://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
Install Nova and Glance
yum -y install openstack-nova openstack-glance
yum should take care of all the dependencies here, and install both with a minimal configuration.
Burning and Rebuilding bridges
First thing’s first KVM is going to install with it’s own default bridged networking, this provides NAT.
Which is also noted as being very slow (There is/was an note on the wiki@ linux-kvm.org but I have been unable to locate it at the time of writing)
If you are only setting this up for experimentation you can run with the default networking, simply use vibr0 in your nova.conf instead of br0, and ensure you have ipv4 forwarding enabled.
Burning Bridges
1 2 3 4 5 6 7 8 9 |
|
Building Bridges
The theory here is that this configuration of bridge will give us near native network performance, which if you are setting up for use beyond a throwaway sandbox, you really do not want to start introducing bottlenecks.
Shutdown and disable NetworkManager
1 2 3 |
|
If you know of a NetworkManager friendly way of doing the following please let me know!
In this scenario br0 becomes your current eth0
/etc/sysconfig/network-scripts/ifcfg-br0
1 2 3 4 5 6 7 8 |
|
/etc/sysconfig/network-scripts/ifcfg-eth0
1 2 3 4 5 6 7 |
|
There is plenty more fun to be had here such as bonded interfaces (I myself have a few systems with bonded interfaces as such becoming br0 -> bond0 -> NIC’s), but that’s for another time.
Note: you may also use brctl for temporary configurations if you are just experimenting.
Caution: my network dropped out immediatly on my testbox, most likely because networkmanager was running, always ensure you can attach to the head of your box when doing network configuration ;-)
Once you have these configurations in place (Ensuring your have replaced the placeholder IP’s and MAC address with valid ones) you can now go for a
1
|
|
All being well you’ll lose and re-establish connection, of you’ll be attaching a monitor / to kvm over ip.
Configuring Nova
First we’re going to need a blank database, please ensure you change the placeholder password that follows for something more secure, and amend the host if you are using mySQL on the same host as nova.
create database nova;
grant all privileges on nova.* to 'nova'@'localhost' identified by 'nova';
Your /etc/nova.conf should resemble this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Setup the database and start the relevant nova services
nova-manage db sync
for i in api network scheduler compute; do service openstack-nova-$i start; done
for i in api network scheduler compute; do chkconfig openstack-nova-$i on; done
Note: you could also use openstack-nova-db-setup instead of “nova-manage db sync”, but it requires mysql-server, which at the time of writing if you have Percona installed will falsely adivse you a need to install mysql-server, Percona need to add: “Provides: mysql-server” to their spec ideally.
Remember this is only a basic setup so a lot of the options are left default such as the network_manager, I will cover their options at a later date.
Onto setting up a basic user (Note: this will be replaced in future posts with keystone)
1 2 3 |
|
Take a moment to run a quick check on your services and network
1 2 3 4 5 6 7 8 9 |
|
Now we need the nova credentials for this user + project.
1 2 3 4 5 6 7 8 9 10 |
|
Configuring Glance
The only change I made was to make glance use mysql.
create database glance;
grant all privilges on glance.* to 'glance'@'localhost' identified by 'glance';
/etc/glance/glance-resgistry.conf
1 2 3 |
|
Once you have made the change, unlike nova all you need do is start glance and it will setup the database.
for i in api registry; do chkconfig openstack-glance-$i on; service openstack-glance-$i start; done
Now were going to need an image, I’m using the BT5-R2 .iso as an example, you could use any of the pre-generated images out there, or even build them using oz
1
|
|
Once the import has completed it should appear in your glance index
1 2 3 4 |
|
And assuming you setup your nova.conf correctly you should now be able to see this image from nova
1 2 3 4 5 6 |
|
You will also have some default instance sizes aka flavours (commands use american spelling flavor).
1 2 3 4 5 6 |
|
Booting your first Instance
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 |
|
And as iso-boot is not currently complete, this example falls down here, as the instance fails to boot from the .iso file, still you now have
- Successfully configured nova
- Sucessfully configured glance
- Have nova using glance
All you need do is load a valid image into glance and boot using nova, so now I will be cheating a little I will create a blank 10GB qcow2 image, import it into glance boot it and use virt-manager to attach the .iso and reboot.
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 |
|
Now I cheat I used virt-manager to force off the insance, create and attach an IDE cdrom and set it as the primary boot device. BT5 boots from the ISO and I can even begin to work through the install to hard drive menus, which as irony would have it prompts me that it needs an 11.5GB partition to install upon :D
I will cover producing proper images in my next openstack post, as the size of the storage volume should not be defined by the image in glance, it should be defined by the falvour being started.