From 6108b37272c97bdabead8e253a3beb15f083d363 Mon Sep 17 00:00:00 2001 From: kishan Date: Wed, 8 Feb 2012 17:19:47 +0530 Subject: [PATCH] Bug 11931: Add quotes to snapshot name and volume name. Fixed create template from snapshot also by adding quotes Status 11931: resolved fixed Reviewed-By: Nitin --- scripts/storage/qcow2/createtmplt.sh | 20 ++++++++++---------- scripts/storage/qcow2/managesnapshot.sh | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/storage/qcow2/createtmplt.sh b/scripts/storage/qcow2/createtmplt.sh index 3674856acac..8b9fa090da4 100755 --- a/scripts/storage/qcow2/createtmplt.sh +++ b/scripts/storage/qcow2/createtmplt.sh @@ -98,25 +98,25 @@ uncompress() { create_from_file() { local tmpltfs=$1 - local tmpltimg=$2 + local tmpltimg="$2" local tmpltname=$3 - $qemu_img convert -f qcow2 -O qcow2 $tmpltimg /$tmpltfs/$tmpltname >& /dev/null + $qemu_img convert -f qcow2 -O qcow2 "$tmpltimg" /$tmpltfs/$tmpltname >& /dev/null if [ "$cleanup" == "true" ] then - rm -f $tmpltimg + rm -f "$tmpltimg" fi chmod a+r /$tmpltfs/$tmpltname } create_from_snapshot() { - local tmpltImg=$1 - local snapshotName=$2 + local tmpltImg="$1" + local snapshotName="$2" local tmpltfs=$3 local tmpltname=$4 - $qemu_img convert -f qcow2 -O qcow2 -s $snapshotName $tmpltImg /$tmpltfs/$tmpltname >& /dev/null + $qemu_img convert -f qcow2 -O qcow2 -s "$snapshotName" "$tmpltImg" /$tmpltfs/$tmpltname >& /dev/null if [ $? -gt 0 ] then printf "Failed to create template /$tmplfs/$tmpltname from snapshot $snapshotName on disk $tmpltImg " @@ -183,7 +183,7 @@ then exit 3 fi -tmpltimg=$(uncompress $tmpltimg) +tmpltimg=$(uncompress "$tmpltimg") if [ $? -ne 0 ] then printf "failed to uncompress $tmpltimg\n" @@ -191,9 +191,9 @@ fi if [ "$sflag" == "1" ] then - create_from_snapshot $tmpltimg $snapshotName $tmpltfs $tmpltname + create_from_snapshot "$tmpltimg" "$snapshotName" $tmpltfs $tmpltname else - create_from_file $tmpltfs $tmpltimg $tmpltname + create_from_file $tmpltfs "$tmpltimg" $tmpltname fi touch /$tmpltfs/template.properties @@ -207,7 +207,7 @@ echo "description=$descr" >> /$tmpltfs/template.properties if [ "$cleanup" == "true" ] then - rm -f $tmpltimg + rm -f "$tmpltimg" fi exit 0 diff --git a/scripts/storage/qcow2/managesnapshot.sh b/scripts/storage/qcow2/managesnapshot.sh index d1d06a9acac..e565e388e9f 100755 --- a/scripts/storage/qcow2/managesnapshot.sh +++ b/scripts/storage/qcow2/managesnapshot.sh @@ -44,7 +44,7 @@ fi create_snapshot() { local disk=$1 - local snapshotname=$2 + local snapshotname="$2" local failed=0 if [ ! -f $disk ] @@ -105,7 +105,7 @@ destroy_snapshot() { rollback_snapshot() { local disk=$1 - local snapshotname=$2 + local snapshotname="$2" local failed=0 $qemu_img snapshot -a "$snapshotname" $disk @@ -194,11 +194,11 @@ done if [ "$cflag" == "1" ] then - create_snapshot $pathval $snapshot + create_snapshot $pathval "$snapshot" exit $? elif [ "$dflag" == "1" ] then - destroy_snapshot $pathval $snapshot $deleteDir + destroy_snapshot $pathval "$snapshot" $deleteDir exit $? elif [ "$bflag" == "1" ] then @@ -206,7 +206,7 @@ then exit $? elif [ "$rflag" == "1" ] then - rollback_snapshot $pathval $snapshot $destPath + rollback_snapshot $pathval "$snapshot" $destPath exit $? fi