diff options
author | Philip Hands <phil@hands.com> | 2016-05-14 22:03:14 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-05-14 23:04:27 +0200 |
commit | 183047ae67b06004bdef17561678e5021c9b5a19 (patch) | |
tree | 124279fc9ffa5275d9195383e8ca8989122b68eb /bin | |
parent | 306b243742aab4f21925cbd4d171702fb56e9083 (diff) | |
download | jenkins.debian.net-183047ae67b06004bdef17561678e5021c9b5a19.tar.xz |
lvc: discard snapshots if target volume is missing
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/lvc.sh | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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 # |