Browse code

XenAPI: Cirros images must always boot as PV.

The default for VHD disk-types is PV, which is why booting from a
server works. However, creating a volume from the image needs to
pass this parameter on to the volume. Note that
Id673158442fde27e8d468ca412c9bd557a886e6b is also required to fix
bug 1294069

Change-Id: I7ea1d85d6082787ac4551f78300a04bf59074261
Partial-Bug: 1294069

Bob Ball authored on 2014/03/19 20:08:54
Showing 1 changed files
... ...
@@ -199,7 +199,21 @@ function upload_image {
199 199
     # and should not be decompressed prior to loading
200 200
     if [[ "$image_url" =~ '.vhd.tgz' ]]; then
201 201
         IMAGE_NAME="${IMAGE_FNAME%.vhd.tgz}"
202
-        glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format=ovf --disk-format=vhd < "${IMAGE}"
202
+        FORCE_VM_MODE=""
203
+        if [[ "$IMAGE_NAME" =~ 'cirros' ]]; then
204
+            # Cirros VHD image currently only boots in PV mode.
205
+            # Nova defaults to PV for all VHD images, but
206
+            # the glance setting is needed for booting
207
+            # directly from volume.
208
+            FORCE_VM_MODE="--property vm_mode=xen"
209
+        fi
210
+        glance \
211
+            --os-auth-token $token \
212
+            --os-image-url http://$GLANCE_HOSTPORT \
213
+            image-create \
214
+            --name "$IMAGE_NAME" --is-public=True \
215
+            --container-format=ovf --disk-format=vhd \
216
+            $FORCE_VM_MODE < "${IMAGE}"
203 217
         return
204 218
     fi
205 219