[pve-devel] [PATCH container 2/2] apply_pending_mountpoint: deactivate volumes if not running

Aaron Lauterer a.lauterer at proxmox.com
Fri Nov 26 11:19:38 CET 2021


Container volumes need to be activated to be formatted. Not deactivating
them afterwards, if the container is not currently running, can lead to
problems.
For example RBD images will get mapped by krbd but not unmapped
afterwards. Reassigning an MP to another CT right after would then lead
to a mapping that needs to be unmapped manually with `rbd unmap` or by
rebooting the node.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 src/PVE/LXC/Config.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 1e28a88..ddfeed8 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1456,6 +1456,8 @@ sub apply_pending_mountpoint {
 		    $conf->{pending}->{$opt} = $original_value;
 		    die $err;
 		}
+	    } else {
+		PVE::Storage::deactivate_volumes($storecfg, $vollist);
 	    }
 	} else {
 	    die "skip\n" if $running && defined($old); # TODO: "changing" mount points?
-- 
2.30.2






More information about the pve-devel mailing list