[pve-devel] [RFC pve-container 2/2] destroy owned mountpoints on pct destroy

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Sep 1 16:33:54 CEST 2015


---
 src/PVE/LXC.pm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index bf2a964..5f23532 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1263,11 +1263,12 @@ sub get_primary_ips {
 sub destroy_lxc_container {
     my ($storage_cfg, $vmid, $conf) = @_;
 
-    my $rootinfo = parse_ct_mountpoint($conf->{rootfs});
-    if (defined($rootinfo->{volume})) {
-	my ($vtype, $name, $owner) = PVE::Storage::parse_volname($storage_cfg, $rootinfo->{volume});
-	PVE::Storage::vdisk_free($storage_cfg, $rootinfo->{volume}) if $vmid == $owner;;
-    }
+    foreach_mountpoint($conf, sub {
+	my ($ms, $mountpoint) = @_;
+	my ($vtype, $name, $owner) = PVE::Storage::parse_volname($storage_cfg, $mountpoint->{volume});
+	PVE::Storage::vdisk_free($storage_cfg, $mountpoint->{volume}) if $vmid == $owner;
+    });
+
     rmdir "/var/lib/lxc/$vmid/rootfs";
     unlink "/var/lib/lxc/$vmid/config";
     rmdir "/var/lib/lxc/$vmid";
-- 
2.1.4





More information about the pve-devel mailing list