]> git.proxmox.com Git - pve-container.git/commitdiff
factor out a delete_mountpoint function for reuse
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 1 Oct 2015 08:58:29 +0000 (10:58 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 1 Oct 2015 09:30:02 +0000 (11:30 +0200)
src/PVE/LXC.pm

index 428433a1cb865bff6b21e018de4bf24f64db2825..8463cc335f97438a8b464c469107250bcf5d889c 100644 (file)
@@ -1344,20 +1344,24 @@ sub get_primary_ips {
     return ($ipv4, $ipv6);
 }
 
+sub delete_mountpoint_volume {
+    my ($storage_cfg, $vmid, $volume) = @_;
+
+    # skip bind mounts and block devices
+    if ($volume =~ m|^/|) {
+           return;
+    }
+
+    my ($vtype, $name, $owner) = PVE::Storage::parse_volname($storage_cfg, $volume);
+    PVE::Storage::vdisk_free($storage_cfg, $volume) if $vmid == $owner;
+}
 
 sub destroy_lxc_container {
     my ($storage_cfg, $vmid, $conf) = @_;
 
     foreach_mountpoint($conf, sub {
        my ($ms, $mountpoint) = @_;
-
-       # skip bind mounts and block devices
-       if ($mountpoint->{volume} =~ m|^/|) {
-               return;
-       }
-
-       my ($vtype, $name, $owner) = PVE::Storage::parse_volname($storage_cfg, $mountpoint->{volume});
-       PVE::Storage::vdisk_free($storage_cfg, $mountpoint->{volume}) if $vmid == $owner;
+       delete_mountpoint_volume($storage_cfg, $vmid, $mountpoint->{volume});
     });
 
     rmdir "/var/lib/lxc/$vmid/rootfs";