[libvirt] [PATCH 20/21] Introduce VIR_MIGRATE_PARAM_GRAPHICS_URI parameter

Jiri Denemark jdenemar at redhat.com
Tue Jun 18 14:06:02 UTC 2013


The parameter specifies connection parameters to use for migrating
client's connection to domain's graphical console.
---
 include/libvirt/libvirt.h.in | 21 +++++++++++++++++++++
 tools/virsh-domain.c         | 11 +++++++++++
 tools/virsh.pod              | 18 +++++++++++++++++-
 3 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 5f3a006..a25c7d2 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1246,6 +1246,27 @@ typedef enum {
  */
 #define VIR_MIGRATE_PARAM_BANDWIDTH         "bandwidth"
 
+/**
+ * VIR_MIGRATE_PARAM_GRAPHICS_URI:
+ *
+ * virDomainMigrate* params field: URI to use for migrating client's connection
+ * to domain's graphical console as VIR_TYPED_PARAM_STRING. If specified, the
+ * client will be asked to automatically reconnect using these parameters
+ * instead of the automatically computed ones. This can be useful if, e.g., the
+ * client does not have a direct access to the network virtualization hosts are
+ * connected to and needs to connect through a proxy. The URI is formed as
+ * follows:
+ *
+ *      protocol://hostname[:port]/[?parameters]
+ *
+ * where protocol is either "spice" or "vnc" and parameters is a list of
+ * protocol specific parameters separated by '&'. Currently recognized
+ * parameters are "tlsPort" and "tlsSubject". For example,
+ *
+ *      spice://target.host.com:1234/?tlsPort=4567
+ */
+#define VIR_MIGRATE_PARAM_GRAPHICS_URI      "graphics_uri"
+
 
 /* Domain migration. */
 virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 2226b5c..873f123 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8324,6 +8324,10 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_DATA,
      .help = N_("migration URI, usually can be omitted")
     },
+    {.name = "graphicsuri",
+     .type = VSH_OT_DATA,
+     .help = N_("graphics URI to be used for seamless graphics migration")
+    },
     {.name = "dname",
      .type = VSH_OT_DATA,
      .help = N_("rename to new name during migration (if supported)")
@@ -8373,6 +8377,13 @@ doMigrate(void *opaque)
                                      VIR_MIGRATE_PARAM_URI, opt) < 0)
         goto save_error;
 
+    if (vshCommandOptStringReq(ctl, cmd, "graphicsuri", &opt) < 0)
+        goto out;
+    else if (opt &&
+             virTypedParamsAddString(&params, &nparams, &maxparams,
+                                     VIR_MIGRATE_PARAM_GRAPHICS_URI, opt) < 0)
+        goto save_error;
+
     if (vshCommandOptStringReq(ctl, cmd, "dname", &opt) < 0)
         goto out;
     else if (opt &&
diff --git a/tools/virsh.pod b/tools/virsh.pod
index f4746cc..94fe897 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1044,7 +1044,7 @@ stats.
 [I<--persistent>] [I<--undefinesource>] [I<--suspend>] [I<--copy-storage-all>]
 [I<--copy-storage-inc>] [I<--change-protection>] [I<--unsafe>] [I<--verbose>]
 [I<--compressed>] [I<--abort-on-error>]
-I<domain> I<desturi> [I<migrateuri>] [I<dname>]
+I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<dname>]
 [I<--timeout> B<seconds>] [I<--xml> B<file>]
 
 Migrate domain to another host.  Add I<--live> for live migration; <--p2p>
@@ -1136,6 +1136,22 @@ order to comply with local firewall policies.
 
 =back
 
+Optional I<graphicsuri> overrides connection parameters used for automatically
+reconnecting a graphical clients at the end of migration. If omitted, libvirt
+will compute the parameters based on target host IP address. In case the
+client does not have a direct access to the network virtualization hosts are
+connected to and needs to connect through a proxy, I<graphicsuri> may be used
+to specify the address the client should connect to. The URI is formed as
+follows:
+
+    protocol://hostname[:port]/[?parameters]
+
+where protocol is either "spice" or "vnc" and parameters is a list of protocol
+specific parameters separated by '&'. Currently recognized parameters are
+"tlsPort" and "tlsSubject". For example,
+
+    spice://target.host.com:1234/?tlsPort=4567
+
 =item B<migrate-setmaxdowntime> I<domain> I<downtime>
 
 Set maximum tolerable downtime for a domain which is being live-migrated to
-- 
1.8.2.1




More information about the libvir-list mailing list