Four steps to upload a VHD to OpenStack.
The goal was to use an existing OpenStack XAPI plugin to upload a VHD to OpenStack. For this demo, I was using two XenServers, one controlled by OpenStack, and the other holding a stopped instance. See the introduction on YouTube: Part 1 – Intro
- Create a Glance Image
First, an image needs to be created on glance. Log in to the devstack box, and issue:
cd devstack . openrc admin glance image-create --name importedimageThe result is a table showing you the details of the created image. The id of the created image will be used later, to upload the real content. Follow this step on YouTube: Part 2 – Create Glance Image
- Install OpenStack plugins on your XenServer
Follow this step on YouTube: Part 3 – Prepare for Plugin Installation
Installing openstack plugins to your XAPI box could be easily done manually, however, we have a small python script for doing that.
mkvirtualenv demoenv pip install git+git://github.com/citrix-openstack/boxes.gitAnd after the environment is installed, putting the latest XAPI plugins to your hypervisor (Follow this step on YouTube: Part 4 – Install OpenStack Plugins):
install_openstack_plugins root password xenserver.domain.nameFor manual installations, a good starting point is the OpenStack nova repository
- Next step is to determine the VHD’s uuid on our XenServer
It could be done manually, however we have a script, that is using XAPI to retrieve this information. To use that script, install that python package as well (Follow this step on YouTube: Part 5 – Install OpenStack-XAPI helper):
mkvirtualenv demo-xapi-openstack pip install git+git://github.com/citrix-openstack/xapi-openstack.gitAfter the install, list VHDs on your XenServer box (Follow this step on YouTube: Part 6 – List VHDs):
list_vhds --xapi-url=https://xenserver.domain.name --user=root --password=yourpasswordThe output of this command will list the VM names, and the disks. The lines starting with “disk:” are showing the vhd uuids
- Last step is to call the OpenStack host plugin, which will upload the VHD to Glance (Follow this step on YouTube: Part 7 – Save VHD to Glance)
upload_vhd root xapipass https://yourxenserver ks.user ks.password \ tenant_name http://yourkeystone/v2.0 vhd_uuid image_uuid
As a result, the image is uploaded to OpenStack, and could be started (Follow this step on YouTube: Part 8 – Start the imported VM)!