[pve-devel] [PATCH v3 container 15/19] prepend underscores for is_volume_in_use helper

Oguz Bektas o.bektas at proxmox.com
Mon Oct 14 10:28:47 CEST 2019


this helper was defined twice, once as 'my $is_volume_in_use' sub and
second as a helper sub. as our other helpers with a similar structure,
it is better to prepend the variable sub with two underscores.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 src/PVE/LXC/Config.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 729cc08..da5ef03 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1300,7 +1300,7 @@ sub classify_mountpoint {
     return 'volume';
 }
 
-my $is_volume_in_use = sub {
+my $__is_volume_in_use = sub {
     my ($class, $config, $volid) = @_;
     my $used = 0;
 
@@ -1318,16 +1318,16 @@ sub is_volume_in_use_by_snapshots {
 
     if (my $snapshots = $config->{snapshots}) {
 	foreach my $snap (keys %$snapshots) {
-	    return 1 if $is_volume_in_use->($class, $snapshots->{$snap}, $volid);
+	    return 1 if $__is_volume_in_use->($class, $snapshots->{$snap}, $volid);
 	}
     }
 
     return 0;
-};
+}
 
 sub is_volume_in_use {
     my ($class, $config, $volid, $include_snapshots) = @_;
-    return 1 if $is_volume_in_use->($class, $config, $volid);
+    return 1 if $__is_volume_in_use->($class, $config, $volid);
     return 1 if $include_snapshots && $class->is_volume_in_use_by_snapshots($config, $volid);
     return 0;
 }
-- 
2.20.1




More information about the pve-devel mailing list