ssh key need to be in /etc/pve/priv/migrate_external/id_rsa_mytargetnode --- PVE/API2/Qemu.pm | 5 +++++ PVE/QemuMigrate.pm | 2 ++ 2 files changed, 7 insertions(+)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 9971e73..549b129 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -3226,6 +3226,10 @@ __PACKAGE__->register_method({ die "HA must be disable for external migration." if PVE::HA::Config::vm_is_ha_managed($vmid); + my $migration_external_sshkey = "/etc/pve/priv/migrate_external/id_rsa_$target"; + + die "ssh privatekey is missing for $target" if !-e $migration_external_sshkey; + my $targetip = PVE::Network::get_ip_from_hostname($target, 1); # test if VM exists @@ -3239,6 +3243,7 @@ __PACKAGE__->register_method({ $param->{online} = 1; $param->{migration_external} = 1; + $param->{migration_external_sshkey} = $migration_external_sshkey; my $realcmd = sub { PVE::QemuMigrate->migrate($target, $targetip, $vmid, $param); diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index a1d9cdd..84b3b11 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -234,6 +234,8 @@ sub prepare { if($self->{opts}->{migration_external}) { + push @{$self->{rem_ssh}}, '-i', $self->{opts}->{migration_external_sshkey}; + #get remote nextvmid eval { my $cmd = [@{$self->{rem_ssh}}, 'pvesh', 'get', '/cluster/nextid']; -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel