[pve-devel] [PATCH cluster 4/4] add request for migration ip to mtunnel

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Oct 27 17:00:13 CEST 2016


reuse mtunnel to allow the migration source side to ask the
migration target side for its dedicated migration IP.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

Added this in a extra patch to let the actual changes to mtunnel
stand out more

 data/PVE/CLI/pvecm.pm | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
index 624c096..65a063d 100755
--- a/data/PVE/CLI/pvecm.pm
+++ b/data/PVE/CLI/pvecm.pm
@@ -841,7 +841,20 @@ __PACKAGE__->register_method ({
     description => "Used by VM/CT migration - do not use manually.",
     parameters => {
 	additionalProperties => 0,
-	properties => {},
+	properties => {
+	    get_migration_ip => {
+		type => 'boolean',
+		default => 0,
+		description => 'return the migration IP, if configured',
+		optional => 1,
+	    },
+	    migration_network => {
+		type => 'string',
+		format => 'CIDR',
+		description => 'the migration network used to detect the local migration IP',
+		optional => 1,
+	    },
+	},
     },
     returns => { type => 'null'},
     code => sub {
@@ -852,6 +865,17 @@ __PACKAGE__->register_method ({
 	    return undef;
 	}
 
+	if ($param->{get_migration_ip}) {
+	    my $network = $param->{migration_network};
+	    if (my $ip = PVE::Cluster::get_local_migration_ip($network, 1)) {
+		print "ip: '$ip'\n";
+	    } else {
+		print "no ip\n"
+	    }
+	    # do not keep tunnel open when asked for migration ip
+	    return undef;
+	}
+
 	print "tunnel online\n";
 	*STDOUT->flush();
 
-- 
2.1.4





More information about the pve-devel mailing list