[pve-devel] applied: [PATCH qemu-server] Fix live migration with replicated unused volumes

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Apr 20 11:51:47 CEST 2020


with fixup to improve readability:

     my $number_of_online_replicated_volumes = 0;
-    if ($self->{online_local_volumes}) {
-       foreach my $volid (keys %{$self->{replicated_volumes}}) {
-           next if !(grep { $volid eq $_ } @{$self->{online_local_volumes}});
+    foreach my $volid (@{$self->{online_local_volumes}}) {
+       next if !$self->{replicated_volumes}->{$volid};
        $number_of_online_replicated_volumes++;
        $input .= "replicated_volume: $volid\n";
     }
-    }

thanks!

On April 20, 2020 10:31 am, Fabian Ebner wrote:
> by counting only local volumes that will be live-migrated via qemu_drive_mirror,
> i.e. those listed in $self->{online_local_volumes}.
> 
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
> 
> Also (correctly) would not count vmstate volumes anymore,
> but live migration with snapshots is currently not allowed anyways.
> 
>  PVE/QemuMigrate.pm | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> index 97fd994..b596a92 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -708,8 +708,14 @@ sub phase2 {
>      # TODO change to 'spice_ticket: <ticket>\n' in 7.0
>      my $input = $spice_ticket ? "$spice_ticket\n" : "\n";
>      $input .= "nbd_protocol_version: $nbd_protocol_version\n";
> -    foreach my $volid (keys %{$self->{replicated_volumes}}) {
> -	$input .= "replicated_volume: $volid\n";
> +
> +    my $number_of_online_replicated_volumes = 0;
> +    if ($self->{online_local_volumes}) {
> +	foreach my $volid (keys %{$self->{replicated_volumes}}) {
> +	    next if !(grep { $volid eq $_ } @{$self->{online_local_volumes}});
> +	    $number_of_online_replicated_volumes++;
> +	    $input .= "replicated_volume: $volid\n";
> +	}
>      }
>  
>      my $target_replicated_volumes = {};
> @@ -773,7 +779,7 @@ sub phase2 {
>  
>      die "unable to detect remote migration address\n" if !$raddr;
>  
> -    if (scalar(keys %$target_replicated_volumes) != scalar(keys %{$self->{replicated_volumes}})) {
> +    if (scalar(keys %$target_replicated_volumes) != $number_of_online_replicated_volumes) {
>  	die "number of replicated disks on source and target node do not match - target node too old?\n"
>      }
>  
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 




More information about the pve-devel mailing list