From 2667855ccb932f9a03ddf6639f6411c73fea1b2c Mon Sep 17 00:00:00 2001 From: Edison Su Date: Wed, 19 Nov 2014 14:31:51 -0800 Subject: [PATCH] CLOUDSTACK-5446: delete all the leftover snapshots on primary storage in case of snapshot errors, after a new backup snapshot is finished --- scripts/storage/qcow2/managesnapshot.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/storage/qcow2/managesnapshot.sh b/scripts/storage/qcow2/managesnapshot.sh index 1ee69db9682..4225407caab 100755 --- a/scripts/storage/qcow2/managesnapshot.sh +++ b/scripts/storage/qcow2/managesnapshot.sh @@ -152,7 +152,8 @@ destroy_snapshot() { fi lvm lvremove -f "${vg}/${snapshotname}-cow" elif [ -f $disk ]; then - $qemu_img snapshot -d "$snapshotname" $disk + #delete all the existing snapshots + $qemu_img snapshot -l $disk |tail -n +3|awk '{print $1}'|xargs -I {} $qemu_img snapshot -d {} $disk >&2 if [ $? -gt 0 ] then failed=2