]> git.proxmox.com Git - qemu-server.git/commitdiff
use foreach_drive instead of foreach_volid
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 17 Jun 2016 14:12:28 +0000 (16:12 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 17 Jun 2016 14:27:25 +0000 (16:27 +0200)
foreach_volid recurses over snapshots as well, resulting in
lots of repeated checks (especially for VMs with lots of
snapshots and disks).

a potential vmstate volume must be checked explicitly,
because foreach_drive does not care about those.

PVE/QemuMigrate.pm

index 5bfdc053db71c3efb95cc383e46da34581d02f1f..e7a1d8a0716e05ade684e535dbcb3399d27caf8c 100644 (file)
@@ -299,9 +299,17 @@ sub sync_disks {
            }
        };
 
-       PVE::QemuServer::foreach_volid($conf, $test_volid);
+       my $test_drive = sub {
+           my ($ds, $drive, $snapname) = @_;
+
+           &$test_volid($drive->{file}, PVE::QemuServer::drive_is_cdrom($drive), $snapname);
+       };
+
+       PVE::QemuServer::foreach_drive($conf, $test_drive);
        foreach my $snapname (keys %{$conf->{snapshots}}) {
-           PVE::QemuServer::foreach_volid($conf->{snapshots}->{$snapname}, $test_volid, $snapname);
+           &$test_volid($conf->{snapshots}->{$snapname}->{'vmstate'}, 0, undef)
+               if defined($conf->{snapshots}->{$snapname}->{'vmstate'});
+           PVE::QemuServer::foreach_drive($conf->{snapshots}->{$snapname}, $test_drive, $snapname);
        }
 
        if ($self->{running} && !$sharedvm) {