From cc2a64572ddf90401476b1f1ce52b7c62b3b24ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Wed, 10 Nov 2021 17:14:05 +0100 Subject: [PATCH] Deactivate LV's before disconnecting nbd device In tripleo-unmount-image, ensure the LV's is inactive prior to disconnection the NBD device. If the LV's are active the device is locked, causing the disconnect to fail and subsequent attempts to mount using the same nbd device fails. Change-Id: I25be71542df1e738002063170138d5e66fabdaf4 Closes-Bug: #1950137 --- scripts/tripleo-mount-image | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/tripleo-mount-image b/scripts/tripleo-mount-image index ec5fecb87..1658cff91 100755 --- a/scripts/tripleo-mount-image +++ b/scripts/tripleo-mount-image @@ -156,6 +156,10 @@ unmount_image() { unmount_volume $MOUNT_DIR fi + # `--activate n` makes LVs inactive, they must be set + # inactive so that the nbd device can be disconnected. + # Ref bug: https://bugs.launchpad.net/tripleo/+bug/1950137 + vgchange --activate n vg || true qemu-nbd --disconnect $NBD_DEVICE vgchange --refresh vg || true