]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
openstack: support glance disk-format raw 705/head
authorLoic Dachary <ldachary@redhat.com>
Tue, 3 Nov 2015 16:53:26 +0000 (17:53 +0100)
committerLoic Dachary <ldachary@redhat.com>
Mon, 16 Nov 2015 10:53:31 +0000 (11:53 +0100)
For providers such as dreamcompute that only support the glance image
format raw, convert the qcow2 image to raw prior to uploading.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
bootstrap
teuthology/openstack/__init__.py

index 6a357678532ea3977865ad4aab77fff32abff133..bc58352f03449fa54760313229bf341326363aa6 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -27,7 +27,7 @@ Linux)
         #   C) Adding "Precise" conditionals somewhere, eg. conditionalizing
         #   this bootstrap script to only use the python-libvirt package on
         #   Ubuntu Precise.
-        for package in python-dev libssl-dev python-pip python-virtualenv libevent-dev python-libvirt libmysqlclient-dev libffi-dev libyaml-dev ; do
+        for package in qemu-utils python-dev libssl-dev python-pip python-virtualenv libevent-dev python-libvirt libmysqlclient-dev libffi-dev libyaml-dev ; do
             if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then
                 # add a space after old values
                 missing="${missing:+$missing }$package"
index b65be1b7e02bdc9ecb5bc4443b7d6cbde96f9541..a06f0c0ae42413af7b5c73666aed4da37133e0ca 100644 (file)
@@ -128,12 +128,20 @@ class OpenStack(object):
 
     def image_create(self, name):
         """
-        Upload an image into OpenStack with glance. The image has to be qcow2.
+        Upload an image into OpenStack with glance.
         """
         misc.sh("wget -c -O " + name + ".qcow2 " + self.image2url[name])
+        self.set_provider()
+        if self.provider == 'dreamhost':
+            image = name + ".raw"
+            disk_format = 'raw'
+            misc.sh("qemu-img convert " + name + ".qcow2 " + image)
+        else:
+            image = name + ".qcow2"
+            disk_format = 'qcow2'
         misc.sh("glance image-create --property ownedby=teuthology " +
-                " --disk-format=qcow2 --container-format=bare " +
-                " --file " + name + ".qcow2 --name " + self.image_name(name))
+                " --disk-format=" + disk_format + " --container-format=bare " +
+                " --file " + image + " --name " + self.image_name(name))
 
     def image(self, os_type, os_version):
         """