Base image filename now ends in $BASE_FORMAT.
authorMartin Schwenke <martin@meltin.net>
Wed, 17 Mar 2010 09:20:19 +0000 (20:20 +1100)
committerMartin Schwenke <martin@meltin.net>
Wed, 17 Mar 2010 09:20:19 +0000 (20:20 +1100)
Using $BASE_FORMAT in the base image filename will make error more
obvious.

For raw system disks we will just be copying the base image, so it
needs to be raw too.  Currently changing BASE_FORMAT doesn't change
the name of the base image so, unless we do complicated things
(perhaps involving the "file" command), we won't be able to tell if
we're copying an old qcow2 image or current raw image.

Signed-off-by: Martin Schwenke <martin@meltin.net>
autocluster

index b1ae298ea1011935b40fcb5eaef7441b7ab6883b..3811113ebd5a30f0555778db77d8935c1ca2a273 100755 (executable)
@@ -173,6 +173,7 @@ create_node_COMMON ()
 
     IPNUM=$(($FIRSTIP + $ip_offset))
     DISK="${VIRTBASE}/${CLUSTER}/${NAME}.${SYSTEM_DISK_FORMAT}"
+    local base_disk="${VIRTBASE}/${BASENAME}.${BASE_FORMAT}"
 
     mkdir -p $VIRTBASE/$CLUSTER tmp
 
@@ -180,10 +181,10 @@ create_node_COMMON ()
     rm -f "$DISK"
     case "$SYSTEM_DISK_FORMAT" in
        qcow2)
-           qemu-img create -b "$VIRTBASE/$BASENAME.img" -f qcow2 "$DISK"
+           qemu-img create -b "$base_disk" -f qcow2 "$DISK"
            ;;
        raw)
-           cp -v --sparse=always "$VIRTBASE/$BASENAME.img" "$DISK"
+           cp -v --sparse=always "$base_disk" "$DISK"
            ;;
        *)
            die "Error: unknown SYSTEM_DISK_FORMAT=\"${SYSTEM_DISK_FORMAT}\"."
@@ -414,7 +415,7 @@ test_proxy() {
 create_base() {
 
     NAME="$BASENAME"
-    DISK="$VIRTBASE/$NAME.img"
+    DISK="${VIRTBASE}/${NAME}.${BASE_FORMAT}"
 
     mkdir -p $KVMLOG
 
@@ -507,7 +508,7 @@ boot_base() {
     CLUSTER="$1"
 
     NAME="$BASENAME"
-    DISK="$VIRTBASE/$NAME.img"
+    DISK="${VIRTBASE}/${NAME}.${BASE_FORMAT}"
 
     rm -rf tmp
     mkdir -p tmp