[pve-devel] [PATCH 05/19] phase2 : create a new vm on external node

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Mar 9 13:19:54 CET 2017


On 02/22/2017 02:33 PM, Alexandre Derumier wrote:
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>   PVE/QemuMigrate.pm | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
>
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> index 71af817..a2fa17a 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -471,6 +471,21 @@ sub phase2 {
>   
>       my $conf = $self->{vmconf};
>   
> +    if ($self->{opts}->{externalcluster}) {
> +	$self->log('info', "Creating a new VM on remote external node '$self->{node}'");
> +	## start on remote node
  misleading comment, s/start/create/
> +	my $cmdcreate = [@{$self->{rem_ssh}}];
> +	push @$cmdcreate , 'qm', 'create';
> +	
> +	PVE::Tools::run_command($cmdcreate, outfunc => sub {
> +            my $line = shift;
> +
> +            if ($line =~ m/^vm (\d+) created$/) {
> +                $vmid = $1;
> +            }
> +	});
> +    }
> +

You have no exception handling for the case that the create command 
failed here.

Do you thought about doing this in the incoming migration API call on 
the remote side?

>       $self->log('info', "starting VM $vmid on remote node '$self->{node}'");
>   
>       my $raddr;





More information about the pve-devel mailing list