From a59c899ed4369b1836bb1630266cb85d0363c83e Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Fri, 15 Feb 2013 15:58:21 +0100 Subject: [PATCH] Bug #1521: LVM transfer driver remove persistent LV when onevm shutdown The code in this commit is based on Milos Kozak's patch --- src/tm_mad/lvm/delete | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/tm_mad/lvm/delete b/src/tm_mad/lvm/delete index 003cda3d11..f0967d4853 100755 --- a/src/tm_mad/lvm/delete +++ b/src/tm_mad/lvm/delete @@ -42,10 +42,22 @@ DST_HOST=`arg_host $DST` # Delete the device if it's a clone (LVM snapshot) DELETE_CMD=$(cat < ==> persistent + # lv-one--- ==> non-persistent (clone) + + VMID=\$(echo \$LV_NAME|cut -d- -f4) + DISKID=\$(echo \$LV_NAME|cut -d- -f5) + + if [ -n "\$VMID" -a -n "\$DISKID" ]; then + # this is a cloned image + $SUDO $LVREMOVE -f \$DEV + fi EOF )