mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-09 09:57:23 +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:
parent
1e0d87c147
commit
a59c899ed4
@ -42,10 +42,22 @@ DST_HOST=`arg_host $DST`
|
|||||||
# Delete the device if it's a clone (LVM snapshot)
|
# Delete the device if it's a clone (LVM snapshot)
|
||||||
DELETE_CMD=$(cat <<EOF
|
DELETE_CMD=$(cat <<EOF
|
||||||
DEV=\$(readlink $DST_PATH)
|
DEV=\$(readlink $DST_PATH)
|
||||||
$SUDO $LVREMOVE -f \$DEV
|
LV_NAME=\$(basename \$DEV)
|
||||||
|
|
||||||
# remove link
|
# remove link
|
||||||
rm -f $DST_PATH
|
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
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user