1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-25 06:03:36 +03:00

Bug #1521: LVM transfer driver remove persistent LV when onevm shutdown

The code in this commit is based on Milos Kozak's patch
This commit is contained in:
Jaime Melis 2013-02-15 15:58:21 +01:00
parent 1e0d87c147
commit a59c899ed4

View File

@ -42,10 +42,22 @@ DST_HOST=`arg_host $DST`
# Delete the device if it's a clone (LVM snapshot)
DELETE_CMD=$(cat <<EOF
DEV=\$(readlink $DST_PATH)
$SUDO $LVREMOVE -f \$DEV
LV_NAME=\$(basename \$DEV)
# remove link
rm -f $DST_PATH
# The following attrs will only be there if the image is non-persistent
# lv-one-<image> ==> persistent
# lv-one-<image>-<vmid>-<diskid> ==> 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
)