[pve-devel] [PATCH] migrate: syncdisk : avoid scanning shared storage

Dietmar Maurer dietmar at proxmox.com
Mon Jul 16 10:38:07 CEST 2012


That patch introduces a serious bug. Just fixed the bug and uploaded a new version.

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 1b1e1f2..1a35004 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -181,13 +181,14 @@ sub sync_disks {
         foreach my $storeid (@sids) {
            my $scfg = PVE::Storage::storage_config($self->{storecfg}, $storeid);
             next if $scfg->{shared};
+           next if !PVE::Storage::storage_check_enabled($self->{storecfg}, $storeid, undef, 1);
+
             # 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);
+                # check if storage is available on target node
                 PVE::Storage::storage_check_node($self->{storecfg}, $sid, $self->{node});
 
                 $volhash->{$volid} = 1;


> -----Original Message-----
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
> bounces at pve.proxmox.com] On Behalf Of Alexandre Derumier
> Sent: Freitag, 13. Juli 2012 15:13
> To: pve-devel at pve.proxmox.com
> Subject: [pve-devel] [PATCH] migrate: syncdisk : avoid scanning shared
> storage
> 
> 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 at odiso.com>
> ---
>  PVE/QemuMigrate.pm |   28 +++++++++++++++-------------
>  1 files changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index
> b0059c3..f5e7c1b 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -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)
> 
> --
> 1.7.2.5
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel





More information about the pve-devel mailing list