M #: Fix minor bug on LVM delete operation (#1584)

If ZERO_LVM_ON_DELETE is not set the lock name will be undefined
when trying to remove the device.
This commit is contained in:
Christian González authored and GitHub committed 2021-11-18 12:38:14 +01:00
1 parent 5bdbd0795e
commit 00a61d74a5
1 file changed
+3 -1
+3 -1
View File
@@ -68,6 +68,8 @@ DEV=$($SSH "$DST_HOST" "readlink $DST_PATH 2> /dev/null | grep \"^/dev/\"")
if [ -n "$DEV" ]; then
LOCK="tm-fs_lvm-${DS_SYS_ID}.lock"
if [ "${ZERO_LVM_ON_DELETE}" = "yes" ]; then
# Activate device
ACTIVATE_CMD=$(cat <<EOF
@@ -77,7 +79,7 @@ if [ -n "$DEV" ]; then
${SUDO} ${LVCHANGE} -ay "${DEV}"
EOF
)
LOCK="tm-fs_lvm-${DS_SYS_ID}.lock"
exclusive "${LOCK}" 120 ssh_exec_and_log "$DST_HOST_LVM" "$ACTIVATE_CMD" \
"Error activating disk $SRC_PATH"