[pve-devel] [PATCH common 3/3] AbstractMigrate: use get_ssh_base_cmd to assemble ssh_cmd

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jan 20 16:13:13 CET 2017


this sets the HostKeyAlias for us, so that users using the dedicated
migration network do not need to add each cluster node to every
cluster members known_hosts file for each network they want to use

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/AbstractMigrate.pm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/PVE/AbstractMigrate.pm b/src/PVE/AbstractMigrate.pm
index 772444a..11629ef 100644
--- a/src/PVE/AbstractMigrate.pm
+++ b/src/PVE/AbstractMigrate.pm
@@ -125,8 +125,6 @@ my $eval_int = sub {
     };
 };
 
-my @ssh_opts = ('-o', 'BatchMode=yes');
-my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
 sub migrate {
     my ($class, $node, $nodeip, $vmid, $opts) = @_;
 
@@ -138,7 +136,7 @@ sub migrate {
 	vmid => $vmid,
 	node => $node,
 	nodeip => $nodeip,
-	rem_ssh => [ @ssh_cmd, "root\@$nodeip" ],
+	rem_ssh => PVE::Cluster::get_ssh_base_cmd($node, $nodeip),
     };
 
     $self = bless $self, $class;
@@ -165,7 +163,7 @@ sub migrate {
 	if (defined($remote_migration_ip)) {
 	    $nodeip = $remote_migration_ip;
 	    $self->{nodeip} = $remote_migration_ip;
-	    $self->{rem_ssh} = [ @ssh_cmd, "root\@$nodeip" ];
+	    $self->{rem_ssh} = PVE::Cluster::get_ssh_base_cmd($node, $nodeip),
 
 	    $self->log('info', "use dedicated network address for sending " .
 	               "migration traffic ($self->{nodeip})");
-- 
2.1.4





More information about the pve-devel mailing list