In the world of Cloud Computing, hypervisors and disk image formats come in various shapes & sizes and are by no means made equal. In the Rackspace Public Cloud, we utilize Citrix XenServer as our hypervisor, which requires that our disk images be in the VHD format.
However, it is very common for folks who utilize the popular KVM hypervisor to want to leverage an existing, custom QCOW image when working with our Public Cloud.
To minimize the redundancy of recreating duplicate images, it would be beneficial to be able take an existing or new QCOW image and modify it to operate on our Public Cloud. This would immensely cut down the maintenance of base images customers create that they wish to share across multiple cloud infrastructures.
In this tutorial, I will walk you through the following steps:
[rackspace_cloud]
username = <RAX_USERNAME>
api_key = <RAX_API_KEY>
0. Preamble
For the sake of not showing lengthy code-blocks, all the scripts referred to below are located in a Github repo
It is recommended you clone and operate out of this repo:
git clone https://github.com/metral/rpc_rd.git
cd rpc_rd/qcow_image/
1. Compile Xen tool ‘vhd-util’
vhd-util
utility used to convert a RAW disk image into VHD format./compile_vhdutil.sh
2. Create a vanilla Ubuntu 14.04 UEC QCOW Image
Usage: ./modify_qcow.sh <OPTIONAL_QCOW_IMAGE>
$ ./modify_qcow.sh
Outputs: trusty-server-cloudimg-amd64-disk1.img
A vanilla Ubuntu 14.04 QCOW image that has been modified for the Public Cloud
Note: If you want to make custom changes to the OS, this is your chance to do so
3. Convert the QCOW to VHD
Usage: ./qcow_to_vhd.sh <QCOW_INPUT_PATH> <VHD_OUTPUT_PATH>
$ ./qcow_to_vhd.sh ./trusty-server-cloudimg-amd64-disk1.img .
Outputs: trusty-server-cloudimg-amd64-disk1.vhd
4. Upload the VHD image to Cloud Files & register the image in Cloud Images
Usage: python upload_to_cloudimages.py <PUBLIC_CLOUD_REGION> <VHD_PATH> <CUSTOM_IMAGE_NAME>
python upload_to_cloudimages.py ORD trusty-server-cloudimg-amd64-disk1.vhd "my_ubuntu_1404"
5. Boot a VM with the newly registered custom image
nova boot --image="my_ubuntu_1404" --flavor=performance1-2 my_ubuntu_1404_test
Mike Metral is a Solution Architect at Rackspace in the Private Cloud Product organization. Mike joined Rackspace in 2012 with the intent of helping OpenStack become the open standard for cloud management. At Rackspace, Mike has led the integration effort with strategic partner RightScale; aided in the assessment, development, and evolution of Rackspace Private Cloud; as well as served as the Chief Architect of the Service Provider Program. Prior to joining Rackspace, Mike held senior technical roles at Sandia National Laboratories performing research and development in Cyber Security with regards to distributed systems, cloud and mobile computing. You can follow Mike on Twitter @mikemetral and Github as metral