summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/lvc.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/lvc.sh b/bin/lvc.sh
index 5b1e5b31..c58c7aa6 100755
--- a/bin/lvc.sh
+++ b/bin/lvc.sh
@@ -30,6 +30,13 @@ fetch_if_newer() {
curl $curlopts -o $file $url
}
+discard_snapshots() {
+ domain=$1
+ for snap in $(sudo /usr/bin/virsh snapshot-list $domain --name) ; do
+ sudo /usr/bin/virsh snapshot-delete $domain $snap
+ done
+}
+
#
# define workspace + results
#
@@ -43,6 +50,11 @@ mkdir -p $RESULTS
mkdir -p $WORKSPACE/DebianToasterStorage
+# FIXME this should discover the 'target' bit of the path, probably via: virsh vol-list
+if [ ! -e "$WORKSPACE/DebianToasterStorage/target" ] ; then
+ discard_snapshots DebianToaster
+fi
+
trap cleanup_all INT TERM EXIT
#