]> git.proxmox.com Git - qemu-server.git/commitdiff
migrate: syncdisk : avoid scanning shared storage
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 13 Jul 2012 13:12:41 +0000 (15:12 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 16 Jul 2012 04:52:35 +0000 (06:52 +0200)
Currently we get list from PVE::Storage (for unused volumes), from all storage.
If something goes wrong with the network on host and thenwe can't communicate with a network shared storage(sheepdog,rbd,..),
the vdisk_list die (timeout) and we cannot migrate the vm on another kvm host.(online or offline).

We don't need to scan shared storage, as they are no disk to sync.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/QemuMigrate.pm

index b0059c37ceef7f9267526cc215c741a12e37e813..f5e7c1b56bcfa114c25e9baae587bdb2fb1bb584 100644 (file)
@@ -177,19 +177,21 @@ sub sync_disks {
        my $volhash = {};
        my $cdromhash = {};
 
-       # get list from PVE::Storage (for unused volumes)
-       my $dl = PVE::Storage::vdisk_list($self->{storecfg}, undef, $vmid);
-       PVE::Storage::foreach_volid($dl, sub {
-           my ($volid, $sid, $volname) = @_;
-
-           # check if storage is available on both nodes
-           my $scfg = PVE::Storage::storage_check_node($self->{storecfg}, $sid);
-           PVE::Storage::storage_check_node($self->{storecfg}, $sid, $self->{node});
-
-           return if $scfg->{shared};
-
-           $volhash->{$volid} = 1;
-       });
+        my $ids = $self->{storecfg}->{ids};
+        foreach my $storeid (keys %$ids) {
+            next if $ids->{$storeid}->{shared};
+            # get list from PVE::Storage (for unused volumes)
+            my $dl = PVE::Storage::vdisk_list($self->{storecfg}, $storeid, $vmid);
+            PVE::Storage::foreach_volid($dl, sub {
+                my ($volid, $sid, $volname) = @_;
+
+                # check if storage is available on both nodes
+                my $scfg = PVE::Storage::storage_check_node($self->{storecfg}, $sid);
+                PVE::Storage::storage_check_node($self->{storecfg}, $sid, $self->{node});
+
+                $volhash->{$volid} = 1;
+            });
+        }
 
        # and add used,owned/non-shared disks (just to be sure we have all)