Creating OpenStack images with livemedia-creator
I was going to write about using mock to make live iso's without using virt-install, but this week is the OpenStack Summit and one of the things you can use livemedia-creator (lmc) for is making disk images for use with OpenStack.
If you followed the instructions in my previous post on creating live isos you already have everything you need except the kickstart and OpenStack. I'm not going to cover how to setup OpenStack, I used the instructions from the RDO project Quickstart without too much trouble.
If you don't have lmc setup, take a look at the Installation part of my post for details on what needs to be installed and setup.
The kickstart I am using for this is available from here on the lorax github repo, it is a minimal install with the addition of cloud-init and cloud-utils-growpart to make sure the system is setup properly when booted by OpenStack.
You should edit the url line to point to a Fedora 22 repository and optionally add a proxy.
Building the qcow2 disk image
The OpenStack images are stored in glance which can handle qcow2 images. This reduces the storage space and speeds up the import time. Create the image by running:
sudo livemedia-creator --make-disk --qcow2 --iso=./f22-boot.iso --ks=./fedora-openstack.ks --image-name=f22-openstack-minimal.img
This will use virt-install to produce a qcow2 disk image that can be imported into OpenStack. Copy the resulting image from /var/tmp/f22-openstack-minimal.img and on your OpenStack server import it into glance like this:
glance image-create --name "f22-minimal" --is-public true --disk-format qcow2 --container-format bare --file ./f22-openstack-minimal.img
That's all there is to it, your image is now available to be used in OpenStack.