[pve-devel] [PATCH guest-common] migration: use Cluster's new node_address info

Wolfgang Bumiller w.bumiller at proxmox.com
Mon May 22 10:29:59 CEST 2017


---
 PVE/AbstractMigrate.pm | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/PVE/AbstractMigrate.pm b/PVE/AbstractMigrate.pm
index 4b974e6..0baef34 100644
--- a/PVE/AbstractMigrate.pm
+++ b/PVE/AbstractMigrate.pm
@@ -4,6 +4,7 @@ use strict;
 use warnings;
 use POSIX qw(strftime);
 use PVE::Tools;
+use PVE::Cluster;
 
 my $msg2text = sub {
     my ($level, $msg) = @_;
@@ -128,18 +129,24 @@ my $eval_int = sub {
 my @ssh_opts = ('-o', 'BatchMode=yes');
 my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
 
+# FIXME: nodeip is now unused
 sub migrate {
     my ($class, $node, $nodeip, $vmid, $opts) = @_;
 
     $class = ref($class) || $class;
 
+    my $migration_network = $opts->{migration_network};
+    my $node_addr = PVE::Cluster::node_address($node, $migration_network);
+    $nodeip = $node_addr->{ip};
+
     my $self = {
 	delayed_interrupt => 0,
 	opts => $opts,
 	vmid => $vmid,
 	node => $node,
+	node_addr => $node_addr,
 	nodeip => $nodeip,
-	rem_ssh => [ @ssh_cmd, "root\@$nodeip" ],
+	rem_ssh => PVE::Cluster::node_address_to_ssh($node_addr)
     };
 
     $self = bless $self, $class;
@@ -158,16 +165,7 @@ sub migrate {
 	&$eval_int($self, sub { $self->{running} = $self->prepare($self->{vmid}); });
 	die $@ if $@;
 
-	# get dedicated migration address from remote node, if set.
-	# as a side effect this checks also if the other node can be accessed
-	# through ssh and that it has quorum
-	my $remote_migration_ip = $self->get_remote_migration_ip();
-
-	if (defined($remote_migration_ip)) {
-	    $nodeip = $remote_migration_ip;
-	    $self->{nodeip} = $remote_migration_ip;
-	    $self->{rem_ssh} = [ @ssh_cmd, "root\@$nodeip" ];
-
+	if (defined($migration_network)) {
 	    $self->log('info', "use dedicated network address for sending " .
 	               "migration traffic ($self->{nodeip})");
 
-- 
2.11.0





More information about the pve-devel mailing list