diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 19d0c581d9..b791125117 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 04259735ec..5257416543 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; + if (opt && + virTypedParamsAddString(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_GRAPHICS_URI, opt) < 0) + goto save_error; + if (vshCommandOptStringReq(ctl, cmd, "dname", &opt) < 0) goto out; if (opt && diff --git a/tools/virsh.pod b/tools/virsh.pod index f4746cc915..94fe8976a4 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 I [I] [I] +I I [I] [I] [I] [I<--timeout> B] [I<--xml> B] 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 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 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 I I Set maximum tolerable downtime for a domain which is being live-migrated to