mirror of https://github.com/apache/cloudstack.git
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
This commit is contained in:
parent
04b1b3312d
commit
6108b37272
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue