[pve-devel] [PATCH qemu-server 14/15] phase3_cleanup: add delete_local_volumes

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Apr 30 15:50:40 CEST 2019


Am 4/29/19 um 12:01 PM schrieb Alexandre Derumier:
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>  PVE/QemuMigrate.pm | 36 +++++++++++++++++++-----------------
>  1 file changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> index 4b521fd..6dd97e3 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -606,11 +606,8 @@ sub phase3 {
>  sub phase3_cleanup {
>      my ($self, $vmid, $err) = @_;
>  
> -    my $conf = $self->{vmconf};
>      return if $self->{phase2errors};
>  
> -    my $tunnel = $self->{tunnel};
> -

above does probably not belongs in this patch, I'd guess.

>  	finish_block_jobs($self, $vmid);
>  
>      move_config($self, $vmid);
> @@ -620,21 +617,8 @@ sub phase3_cleanup {
>      finish_spice_migration($self, $vmid);
>  
>      stop_local_vm($self, $vmid);
> -        
> -    if($self->{storage_migration}) {
> -	# destroy local copies
> -	my $volids = $self->{online_local_volumes};
>  
> -	foreach my $volid (@$volids) {
> -	    eval { PVE::Storage::vdisk_free($self->{storecfg}, $volid); };
> -	    if (my $err = $@) {
> -		$self->log('err', "removing local copy of '$volid' failed - $err");
> -		$self->{errors} = 1;
> -		last if $err =~ /^interrupted by signal$/;
> -	    }
> -	}
> -
> -    }
> +    delete_local_volumes($self);
>  
>      # clear migrate lock
>      my $cmd = [ @{$self->{rem_ssh}}, 'qm', 'unlock', $vmid ];
> @@ -1177,4 +1161,22 @@ sub stop_local_vm {
>      }
>  }
>  
> +sub delete_local_volumes {
> +    my ($self) = @_;
> +
> +    if($self->{storage_migration}) {
> +	# destroy local copies
> +	my $volids = $self->{online_local_volumes};
> +
> +	foreach my $volid (@$volids) {
> +	    eval { PVE::Storage::vdisk_free($self->{storecfg}, $volid); };
> +	    if (my $err = $@) {
> +		$self->log('err', "removing local copy of '$volid' failed - $err");
> +		$self->{errors} = 1;
> +		last if $err =~ /^interrupted by signal$/;
> +	    }
> +	}
> +    }
> +}
> +
>  1;
> 





More information about the pve-devel mailing list