[pve-devel] [PATCH V2 pve-container 3/8] adapt behavior for detaching/removing a mount point

Stefan Hrdlicka s.hrdlicka at proxmox.com
Mon Sep 12 17:25:02 CEST 2022


detach of a mount point with a removed underlying storage causes it to
be labeled as a an 'unused disk'
remove of a 'unused disk' with a removed underlying storage causes it to
be removed from the configuration

Signed-off-by: Stefan Hrdlicka <s.hrdlicka at proxmox.com>
---
 src/PVE/LXC/Config.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index b4b0261..7917863 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1423,7 +1423,10 @@ sub vmconfig_apply_pending {
 		    $class->add_unused_volume($conf, $mp->{volume})
 			if !$class->is_volume_in_use($conf, $conf->{$opt}, 1, 1);
 		}
-	    } elsif ($opt =~ m/^unused(\d+)$/) {
+	    } elsif (
+		$opt =~ m/^unused(\d+)$/
+		&& PVE::Storage::storage_exists($storecfg, $conf->{$opt})
+	    ) {
 		PVE::LXC::delete_mountpoint_volume($storecfg, $vmid, $conf->{$opt})
 		    if !$class->is_volume_in_use($conf, $conf->{$opt}, 1, 1);
 	    }
-- 
2.30.2






More information about the pve-devel mailing list