[pve-devel] [PATCH v2 qemu-server 5/5] use foreach_drive in foreach_storage_used_by_vm
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon May 15 14:12:00 CEST 2017
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
new in v1
PVE/QemuServer.pm | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index e446ab3..0aebe88 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5798,18 +5798,15 @@ sub foreach_storage_used_by_vm {
my $sidhash = {};
- foreach my $ds (keys %$conf) {
- next if !is_valid_drivename($ds);
-
- my $drive = parse_drive($ds, $conf->{$ds});
- next if !$drive;
- next if drive_is_cdrom($drive);
+ foreach_drive($conf, sub {
+ my ($ds, $drive) = @_;
+ return if drive_is_cdrom($drive);
my $volid = $drive->{file};
my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
$sidhash->{$sid} = $sid if $sid;
- }
+ });
foreach my $sid (sort keys %$sidhash) {
&$func($sid);
--
2.1.4
More information about the pve-devel
mailing list