43fe83
From 53ff78bcd85b2e8df67edd1ecf2c70de4c9c96fe Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <53ff78bcd85b2e8df67edd1ecf2c70de4c9c96fe.1382534061.git.jdenemar@redhat.com>
43fe83
From: Michal Privoznik <mprivozn@redhat.com>
43fe83
Date: Fri, 11 Oct 2013 11:24:33 +0200
43fe83
Subject: [PATCH] Migration: Introduce VIR_MIGRATE_PARAM_LISTEN_ADDRESS
43fe83
43fe83
https://bugzilla.redhat.com/show_bug.cgi?id=1015215
43fe83
43fe83
The parameter allows overriding default listen address for '-incoming'
43fe83
cmd line argument on destination.
43fe83
43fe83
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
43fe83
(cherry picked from commit 72aafe9c812e17547df185abebb3fe4e56d0d982)
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 include/libvirt/libvirt.h.in | 10 ++++++++++
43fe83
 tools/virsh-domain.c         | 11 +++++++++++
43fe83
 tools/virsh.pod              | 10 ++++++++--
43fe83
 3 files changed, 29 insertions(+), 2 deletions(-)
43fe83
43fe83
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
43fe83
index 52ac95d..1bc6624 100644
43fe83
--- a/include/libvirt/libvirt.h.in
43fe83
+++ b/include/libvirt/libvirt.h.in
43fe83
@@ -1270,6 +1270,16 @@ typedef enum {
43fe83
  */
43fe83
 #define VIR_MIGRATE_PARAM_GRAPHICS_URI      "graphics_uri"
43fe83
 
43fe83
+/**
43fe83
+ * VIR_MIGRATE_PARAM_LISTEN_ADDRESS:
43fe83
+ *
43fe83
+ * virDomainMigrate* params field: The listen address that hypervisor on the
43fe83
+ * destination side should bind to for incoming migration. Both, IPv4 and IPv6
43fe83
+ * addresses are accepted as well as hostnames (the resolving is done on
43fe83
+ * destination). Some hypervisors do not support this feature an will return an
43fe83
+ * error if this field is used.
43fe83
+ */
43fe83
+#define VIR_MIGRATE_PARAM_LISTEN_ADDRESS    "listen_address"
43fe83
 
43fe83
 /* Domain migration. */
43fe83
 virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
43fe83
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
43fe83
index bf5f425..b4faa69 100644
43fe83
--- a/tools/virsh-domain.c
43fe83
+++ b/tools/virsh-domain.c
43fe83
@@ -8405,6 +8405,10 @@ static const vshCmdOptDef opts_migrate[] = {
43fe83
      .type = VSH_OT_DATA,
43fe83
      .help = N_("graphics URI to be used for seamless graphics migration")
43fe83
     },
43fe83
+    {.name = "listen-address",
43fe83
+     .type = VSH_OT_DATA,
43fe83
+     .help = N_("listen address that destination should bind to for incoming migration")
43fe83
+    },
43fe83
     {.name = "dname",
43fe83
      .type = VSH_OT_DATA,
43fe83
      .help = N_("rename to new name during migration (if supported)")
43fe83
@@ -8461,6 +8465,13 @@ doMigrate(void *opaque)
43fe83
                                 VIR_MIGRATE_PARAM_GRAPHICS_URI, opt) < 0)
43fe83
         goto save_error;
43fe83
 
43fe83
+    if (vshCommandOptStringReq(ctl, cmd, "listen-address", &opt) < 0)
43fe83
+        goto out;
43fe83
+    if (opt &&
43fe83
+        virTypedParamsAddString(&params, &nparams, &maxparams,
43fe83
+                                VIR_MIGRATE_PARAM_LISTEN_ADDRESS, opt) < 0)
43fe83
+        goto save_error;
43fe83
+
43fe83
     if (vshCommandOptStringReq(ctl, cmd, "dname", &opt) < 0)
43fe83
         goto out;
43fe83
     if (opt &&
43fe83
diff --git a/tools/virsh.pod b/tools/virsh.pod
43fe83
index 3ff6da1..808a90c 100644
43fe83
--- a/tools/virsh.pod
43fe83
+++ b/tools/virsh.pod
43fe83
@@ -1070,8 +1070,8 @@ stats.
43fe83
 [I<--persistent>] [I<--undefinesource>] [I<--suspend>] [I<--copy-storage-all>]
43fe83
 [I<--copy-storage-inc>] [I<--change-protection>] [I<--unsafe>] [I<--verbose>]
43fe83
 [I<--compressed>] [I<--abort-on-error>]
43fe83
-I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<dname>]
43fe83
-[I<--timeout> B<seconds>] [I<--xml> B<file>]
43fe83
+I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<listen-address>]
43fe83
+[I<dname>] [I<--timeout> B<seconds>] [I<--xml> B<file>]
43fe83
 
43fe83
 Migrate domain to another host.  Add I<--live> for live migration; <--p2p>
43fe83
 for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled>
43fe83
@@ -1178,6 +1178,12 @@ specific parameters separated by '&'. Currently recognized parameters are
43fe83
 
43fe83
     spice://target.host.com:1234/?tlsPort=4567
43fe83
 
43fe83
+Optional I<listen-address> sets the listen address that hypervisor on the
43fe83
+destination side should bind to for incoming migration. Both IPv4 and IPv6
43fe83
+addresses are accepted as well as hostnames (the resolving is done on
43fe83
+destination). Some hypervisors do not support this feature and will return an
43fe83
+error if this parameter is used.
43fe83
+
43fe83
 =item B<migrate-setmaxdowntime> I<domain> I<downtime>
43fe83
 
43fe83
 Set maximum tolerable downtime for a domain which is being live-migrated to
43fe83
-- 
43fe83
1.8.4
43fe83