IntroductionWhen creating your private OpenStack-managed vSphere cloud, you're going to need some "images" ("VM Templates" in VMWare terminology) so you can launch/deploy instances. The really sticky part about this configuration is that OpenStack has traditionally only supported the KVM hypervisor, which uses a different disk format than VMWare (KVM uses QCOW2 and VMWare uses VMDK). I found some great QCOW2 images here: http://docs.openstack.org/image-guide/content/ch_obtaining_images.html and some great CentOS VMDK images here: http://osboxes.org. I had some different hurdles with each of those and finally decided just to install RHEL 6.5 from scratch, then modify that VM to work, then create a VM Template that would be automatically discovered by OpenStack as an image. In this post I'll cover the highlights of this technique.
Install Red Hat
Install the "Desktop" option. This will mean that you have to do a little cleanup later, but I'll cover that.
Install VMWare Tools
Go ahead and install VMWare tools just to make your life a little easier.
Configure Yum Repositories and Install Packages
If you're using Red Hat Subscription Manager, you don't have to go through these steps. If you're not using RHSN, you'll need to manually configure some repositories. I found for this exercise that the CentOS repositories, along with the EPEL repository, worked great. To configure the CentOS repositories, create a file named /etc/yum.repos.d/YOU_PICK_A_NAME.repo with the following contents:
name=CentOS-6 - Base
name=CentOS-6 - Updates
#additional packages that may be useful
name=CentOS-6 - Extras
#additional packages that extend functionality of existing packages
name=CentOS-6 - Plus
#contrib - packages by Centos Users
name=CentOS-6 - Contrib
Then run 'yum repo-list' to verify the repositories were created. Now you can run the following commands:
yum -y epel-release
yum -y cloud-init
yum -y cloud-utils
yum -y heat-cfntools
Since the "Desktop" option was chosen, the NetworkManager service was installed and enabled. You need to change that with these commands:
service NetworkManager stop
chkconfig NetworkManager off
service network start
Now run the following commands so that eth0 will get configured properly:
sed -i '/^HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth0
echo -n > /etc/udev/rules.d/70-persistent-net.rules
echo -n > /lib/udev/rules.d/75-persistent-net-generator.rules
The default configuration will try to contact multiple non-existent IP addresses for metadata, and you don't need that by changing /etc/cloud/cloud.cfg. Add the following line to that file:
datastore_list: [ NoCloud, ConfigDrive, None ]
You *may* also want to set:
This will allow you to access the VM as root, and via ssh with a password.
Make a Template
Via the vSphere Web Client or vSphere Windows Client, clone the VM to a template. After you do this, wait a few minutes for OpenStack to "see" this new template as an Image.
Following the above steps should get you a working template from which you can explore the other capabilities of ICO and ICMWO.