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
(cherry picked from commit cc2a64572d)
This commit is contained in:
Harald Jensås 2021-11-10 17:14:05 +01:00 committed by Steve Baker
parent e738cd0c9e
commit 87c6a1aaaa
1 changed files with 4 additions and 0 deletions

View File

@ -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