[pve-devel] [PATCH qemu-server] drive: volume in-use check: remove unused closure parameter

Fabian Ebner f.ebner at proxmox.com
Mon Apr 19 15:39:50 CEST 2021


and simplify the calling iteration.

Suggested-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer/Drive.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer/Drive.pm b/PVE/QemuServer/Drive.pm
index 9016a43..0d66b2e 100644
--- a/PVE/QemuServer/Drive.pm
+++ b/PVE/QemuServer/Drive.pm
@@ -574,7 +574,7 @@ sub is_volume_in_use {
     my $path = PVE::Storage::path($storecfg, $volid);
 
     my $scan_config = sub {
-	my ($cref, $snapname) = @_;
+	my ($cref) = @_;
 
 	foreach my $key (keys %$cref) {
 	    my $value = $cref->{$key};
@@ -602,8 +602,8 @@ sub is_volume_in_use {
 
     undef $skip_drive;
 
-    foreach my $snapname (keys %{$conf->{snapshots}}) {
-	return 1 if &$scan_config($conf->{snapshots}->{$snapname}, $snapname);
+    for my $snap (values %{$conf->{snapshots}}) {
+	return 1 if $scan_config->($snap);
     }
 
     return 0;
-- 
2.20.1





More information about the pve-devel mailing list