Browse code

Merge "Generate glance image with SCSI bus type for ppc arch"

Jenkins authored on 2013/12/06 03:02:04
Showing 1 changed files
... ...
@@ -554,7 +554,7 @@ function exit_distro_not_supported {
554 554
 function is_arch {
555 555
     ARCH_TYPE=$1
556 556
 
557
-    [ "($uname -m)" = "$ARCH_TYPE" ]
557
+    [[ "$(uname -m)" == "$ARCH_TYPE" ]]
558 558
 }
559 559
 
560 560
 # Checks if installed Apache is <= given version
... ...
@@ -1588,11 +1588,15 @@ function upload_image() {
1588 1588
         *) echo "Do not know what to do with $IMAGE_FNAME"; false;;
1589 1589
     esac
1590 1590
 
1591
+    if is_arch "ppc64"; then
1592
+        IMG_PROPERTY="--property hw_disk_bus=scsi --property hw_cdrom_bus=scsi"
1593
+    fi
1594
+
1591 1595
     if [ "$CONTAINER_FORMAT" = "bare" ]; then
1592 1596
         if [ "$UNPACK" = "zcat" ]; then
1593
-            glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < <(zcat --force "${IMAGE}")
1597
+            glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" $IMG_PROPERTY --is-public True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < <(zcat --force "${IMAGE}")
1594 1598
         else
1595
-            glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < "${IMAGE}"
1599
+            glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" $IMG_PROPERTY --is-public True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < "${IMAGE}"
1596 1600
         fi
1597 1601
     else
1598 1602
         # Use glance client to add the kernel the root filesystem.
... ...
@@ -1600,12 +1604,12 @@ function upload_image() {
1600 1600
         # kernel for use when uploading the root filesystem.
1601 1601
         KERNEL_ID=""; RAMDISK_ID="";
1602 1602
         if [ -n "$KERNEL" ]; then
1603
-            KERNEL_ID=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME-kernel" --is-public True --container-format aki --disk-format aki < "$KERNEL" | grep ' id ' | get_field 2)
1603
+            KERNEL_ID=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME-kernel" $IMG_PROPERTY --is-public True --container-format aki --disk-format aki < "$KERNEL" | grep ' id ' | get_field 2)
1604 1604
         fi
1605 1605
         if [ -n "$RAMDISK" ]; then
1606
-            RAMDISK_ID=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME-ramdisk" --is-public True --container-format ari --disk-format ari < "$RAMDISK" | grep ' id ' | get_field 2)
1606
+            RAMDISK_ID=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME-ramdisk" $IMG_PROPERTY --is-public True --container-format ari --disk-format ari < "$RAMDISK" | grep ' id ' | get_field 2)
1607 1607
         fi
1608
-        glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "${IMAGE_NAME%.img}" --is-public True --container-format ami --disk-format ami ${KERNEL_ID:+--property kernel_id=$KERNEL_ID} ${RAMDISK_ID:+--property ramdisk_id=$RAMDISK_ID} < "${IMAGE}"
1608
+        glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "${IMAGE_NAME%.img}" $IMG_PROPERTY --is-public True --container-format ami --disk-format ami ${KERNEL_ID:+--property kernel_id=$KERNEL_ID} ${RAMDISK_ID:+--property ramdisk_id=$RAMDISK_ID} < "${IMAGE}"
1609 1609
     fi
1610 1610
 }
1611 1611