[pve-devel] [PATCH container v8 2/4] destroy_lxc, delete_mp_volume: rename $volume to $volid

Michael Köppl m.koeppl at proxmox.com
Thu Jun 26 18:06:20 CEST 2025


$volid states more clearly that it's a volume ID, avoiding confusion
about the values these variables hold.

No functional change intended.

Signed-off-by: Michael Köppl <m.koeppl at proxmox.com>
---
 src/PVE/LXC.pm | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index dacd6cf0..2bb75dd8 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -945,16 +945,16 @@ sub get_primary_ips {
 }
 
 sub delete_mountpoint_volume {
-    my ($storage_cfg, $vmid, $volume) = @_;
+    my ($storage_cfg, $vmid, $volid) = @_;
 
-    return if PVE::LXC::Config->classify_mountpoint($volume) ne 'volume';
+    return if PVE::LXC::Config->classify_mountpoint($volid) ne 'volume';
 
-    my ($vtype, $name, $owner) = PVE::Storage::parse_volname($storage_cfg, $volume);
+    my ($vtype, $name, $owner) = PVE::Storage::parse_volname($storage_cfg, $volid);
 
     if ($vmid == $owner) {
-        PVE::Storage::vdisk_free($storage_cfg, $volume);
+        PVE::Storage::vdisk_free($storage_cfg, $volid);
     } else {
-        warn "ignore deletion of '$volume', CT $vmid isn't the owner!\n";
+        warn "ignore deletion of '$volid', CT $vmid isn't the owner!\n";
     }
 }
 
@@ -965,13 +965,13 @@ sub destroy_lxc_container {
     my $remove_volume = sub {
         my ($ms, $mountpoint) = @_;
 
-        my $volume = $mountpoint->{volume};
+        my $volid = $mountpoint->{volume};
 
-        return if $volids->{$volume};
-        $volids->{$volume} = 1;
+        return if $volids->{$volid};
+        $volids->{$volid} = 1;
 
-        eval { delete_mountpoint_volume($storage_cfg, $vmid, $volume); };
-        PVE::RESTEnvironment::log_warn("failed to delete mountpoint volume $volume: $@") if $@;
+        eval { delete_mountpoint_volume($storage_cfg, $vmid, $volid); };
+        PVE::RESTEnvironment::log_warn("failed to delete mountpoint volume $volid: $@") if $@;
     };
     PVE::LXC::Config->foreach_volume_full($conf, { include_unused => 1 }, $remove_volume);
 
-- 
2.39.5





More information about the pve-devel mailing list