fix-removing-persistent-lvm-volumes-2.diff
src/tm_mad/lvm/delete 2013-01-29 15:45:09.947977747 +0100 | ||
---|---|---|
42 | 42 |
# Delete the device if it's a clone (LVM snapshot) |
43 | 43 |
DELETE_CMD=$(cat <<EOF |
44 | 44 |
DEV=\$(readlink $DST_PATH) |
45 |
$SUDO $LVREMOVE -f \$DEV |
|
45 |
LV=\$(basename \$DEV) |
|
46 |
|
|
47 |
# volume naming schema: |
|
48 |
# lv-one-{IMGID} ... persistent volume |
|
49 |
# lv-one-{PARENTIMGID-{VMID}-{DISKID} ... nonpersistent volume cloned from persistnent at vm creation |
|
50 |
# lv-one-{VMID}-{DISKID} ... nonpersistnet volume initialized at vm creation |
|
51 | ||
52 |
LV_NAME_ELEMENT_3="\$(echo \$LV|cut -d- -f3)" |
|
53 |
LV_NAME_ELEMENT_4="\$(echo \$LV|cut -d- -f4)" |
|
54 |
LV_NAME_ELEMENT_5="\$(echo \$LV|cut -d- -f5)" |
|
55 | ||
56 |
if [ -n "\$LV_NAME_ELEMENT_5" -a -n "\$LV_NAME_ELEMENT_4" -a -n "\$LV_NAME_ELEMENT_3" ] |
|
57 |
then |
|
58 |
$SUDO $LVREMOVE -f \$DEV |
|
59 |
fi |
|
46 | 60 | |
47 | 61 |
# remove link |
48 | 62 |
rm -f $DST_PATH |