diff --git a/scripts/storage/qcow2/createtmplt.sh b/scripts/storage/qcow2/createtmplt.sh index 82b9e383c08..d438681461e 100755 --- a/scripts/storage/qcow2/createtmplt.sh +++ b/scripts/storage/qcow2/createtmplt.sh @@ -97,28 +97,28 @@ uncompress() { create_from_file() { local tmpltfs=$1 - local tmpltimg=$2 + local tmpltimg="$2" local tmpltname=$3 if [ -b $tmpltimg ]; then - $qemu-img convert -f raw -O qcow2 $tmpltimg /$tmpltfs/$tmpltname + $qemu-img convert -f raw -O qcow2 "$tmpltimg" /$tmpltfs/$tmpltname else - $qemu_img convert -f qcow2 -O qcow2 $tmpltimg /$tmpltfs/$tmpltname >& /dev/null + $qemu_img convert -f qcow2 -O qcow2 "$tmpltimg" /$tmpltfs/$tmpltname >& /dev/null fi 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 " @@ -185,7 +185,7 @@ then exit 3 fi -tmpltimg=$(uncompress $tmpltimg) +tmpltimg=$(uncompress "$tmpltimg") if [ $? -ne 0 ] then printf "failed to uncompress $tmpltimg\n" @@ -193,9 +193,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 @@ -209,7 +209,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 90634bd34b5..25d3a3693fd 100755 --- a/scripts/storage/qcow2/managesnapshot.sh +++ b/scripts/storage/qcow2/managesnapshot.sh @@ -43,7 +43,7 @@ fi create_snapshot() { local disk=$1 - local snapshotname=$2 + local snapshotname="$2" local failed=0 if [ -b "${disk}" ] && lvm lvs "${disk}" >/dev/null 2>&1; then @@ -160,7 +160,7 @@ destroy_snapshot() { rollback_snapshot() { local disk=$1 - local snapshotname=$2 + local snapshotname="$2" local failed=0 $qemu_img snapshot -a $snapshotname $disk @@ -266,11 +266,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 @@ -278,7 +278,7 @@ then exit $? elif [ "$rflag" == "1" ] then - rollback_snapshot $pathval $snapshot $destPath + rollback_snapshot $pathval "$snapshot" $destPath exit $? fi