added "install it" target
[gnt-info] / gnt-lv-remove-snap.sh
1 #!/bin/sh -e
2
3 if [ "$1" = "run" ] ; then
4
5 # bind ganeti hanging snapshot
6 dmsetup ls --tree | grep snap-1 | cut -d" " -f1 | xargs -i dmsetup remove {}
7
8 # remove snap lvs
9 ls /dev/mapper/*.snap | xargs -i lvremove -f {}
10
11 else
12
13 # umount all snapshots
14 gnt-cluster command -M mount | grep snap | grep -v rbd.disk[0-9].snap | awk '{ print "ssh "$1" umount "$4 }' | sed 's/: / /' | xargs -i sh -exec {}
15
16 # remove mount directories
17 gnt-cluster command 'rmdir /dev/shm/*.snap'
18
19 # create shell command to run on all nodes
20 cp $0 /dev/shm/snap-remove.sh
21 gnt-cluster copyfile /dev/shm/snap-remove.sh
22 gnt-cluster command -M sh -e /dev/shm/snap-remove.sh run
23
24 fi