diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index d6cdfca870..4ac29cd788 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -773,6 +773,16 @@ typedef enum { */ # define VIR_MIGRATE_PARAM_MIGRATE_DISKS "migrate_disks" +/** + * VIR_MIGRATE_PARAM_DISKS_PORT: + * + * virDomainMigrate* params field: port that destination server should use + * for incoming disks migration. Type is VIR_TYPED_PARAM_INT. If set to 0 or + * omitted, libvirt will choose a suitable default. At the moment this is only + * supported by the QEMU driver. + */ +# define VIR_MIGRATE_PARAM_DISKS_PORT "disks_port" + /* Domain migration. */ virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn, unsigned long flags, const char *dname, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index d60eafeafc..854823ebca 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9667,6 +9667,10 @@ static const vshCmdOptDef opts_migrate[] = { .type = VSH_OT_STRING, .help = N_("comma separated list of disks to be migrated") }, + {.name = "disks-port", + .type = VSH_OT_INT, + .help = N_("port to use by target server for incoming disks migration") + }, {.name = NULL} }; @@ -9677,6 +9681,7 @@ doMigrate(void *opaque) virDomainPtr dom = NULL; const char *desturi = NULL; const char *opt = NULL; + int disksPort = 0; unsigned int flags = 0; virshCtrlData *data = opaque; vshControl *ctl = data->ctl; @@ -9719,6 +9724,13 @@ doMigrate(void *opaque) VIR_MIGRATE_PARAM_LISTEN_ADDRESS, opt) < 0) goto save_error; + if (vshCommandOptInt(ctl, cmd, "disks-port", &disksPort) < 0) + goto out; + if (disksPort && + virTypedParamsAddInt(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_DISKS_PORT, disksPort) < 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 4662658893..1e2c6a6837 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1532,7 +1532,7 @@ to the I namespace is displayed instead of being modified. [I<--compressed>] [I<--abort-on-error>] [I<--auto-converge>] I I [I] [I] [I] [I] [I<--timeout> B] [I<--xml> B] -[I<--migrate-disks> B] +[I<--migrate-disks> B] [I<--disks-port> B] Migrate domain to another host. Add I<--live> for live migration; <--p2p> for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled> @@ -1659,6 +1659,9 @@ addresses are accepted as well as hostnames (the resolving is done on destination). Some hypervisors do not support this feature and will return an error if this parameter is used. +Optional I sets the port that hypervisor on destination side should +bind to for incoming disks traffic. Currently it is supported only by qemu. + =item B I I Set maximum tolerable downtime for a domain which is being live-migrated to