Hi,
Firstly thanks for your attention.
On Thu, 2014-05-15 at 11:50 +0200, Jiri Denemark wrote:
On Wed, May 14, 2014 at 15:18:09 +0800, Chen Fan wrote:
> For now, we set the migration URI via command line '--migrate_uri' or
> construct the URI by looking up the dest host's hostname which could be
> solved by DNS automatically.
>
> But in cases the dest host have two or more NICs to reach, we may need to
> send the migration data over a specific NIC which is different from the
> automatically resloved one for some reason like performance, security, etc.
> thus we must explicitly specify the migrateuri in command line everytime,
> but it is too troublesome if there are many such hosts(and don't forget
> virt-manager).
>
> This patches add a configuration file option on dest host to save the
> default migrate uri which explicitly specify which of this host's
> addresses is used for transferring data, thus user doesn't boring
> to specify it in command line everytime.
>
> Signed-off-by: Chen Fan <chen.fan.fnst(a)cn.fujitsu.com>
> ---
>
> v3-v4: move up the default uri_in setting to
> qemuDomainMigratePrepare3Params()
>
> src/qemu/qemu.conf | 6 +++++-
> src/qemu/qemu_conf.c | 1 +
> src/qemu/qemu_conf.h | 1 +
> src/qemu/qemu_driver.c | 2 +-
> 4 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
> index f0e802f..6b443d0 100644
> --- a/src/qemu/qemu.conf
> +++ b/src/qemu/qemu.conf
> @@ -449,7 +449,11 @@
> #
> #seccomp_sandbox = 1
>
> -
> +# Override the migration URI for specifying one of host's IP addresses
> +# to transfer the migration data stream.
> +# Defaults to hostname, both IPv4 and IPv6 addresses are accepted.
> +#
> +#migrate_uri = "tcp://192.168.0.1"
>
> # Override the listen address for all incoming migrations. Defaults to
> # 0.0.0.0, or :: if both host and qemu are capable of IPv6.
The more I think about this the more I incline to a slightly different
approach. Rather than providing a way to override migration URI, we
could just provide an option in libvirtd.conf to override what
virGetHostname returns. That is, the option (naturally called hostname)
would tell libvirt to use the configured hostname (which might even be
just an IP address) instead of trying to detect it.
If I understand correctly. you
prefer using a hostname(or IP address)
option in libvirtd.conf to configuring a default migration URI in
qemu.conf, right? do you want to affect the all virGetHostname()
returns? I'm afraid I can't see any benefit to the goal, could you tell
me that?
Thanks,
Chen
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 198ee2f..43361dc 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -574,6 +574,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
>
> GET_VALUE_LONG("seccomp_sandbox", cfg->seccompSandbox);
>
> + GET_VALUE_STR("migrate_uri", cfg->migrateUri);
> GET_VALUE_STR("migration_address", cfg->migrationAddress);
>
> ret = 0;
> diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
> index a36ea63..f99c56e 100644
> --- a/src/qemu/qemu_conf.h
> +++ b/src/qemu/qemu_conf.h
> @@ -163,6 +163,7 @@ struct _virQEMUDriverConfig {
>
> int seccompSandbox;
>
> + char *migrateUri;
> /* The default for -incoming */
> char *migrationAddress;
> int migrationPortMin;
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index fca1a91..56c24b5 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -10888,7 +10888,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
> virDomainDefPtr def = NULL;
> const char *dom_xml = NULL;
> const char *dname = NULL;
> - const char *uri_in = NULL;
> + const char *uri_in = cfg->migrateUri;
> const char *listenAddress = cfg->migrationAddress;
> char *origname = NULL;
> int ret = -1;
And in any case, the change you made between v3 and v4 is wrong, since
now you are only change one entry point to the Prepare phase while
changing qemuMigrationPrepareDirect makes this work for all APIs and
migration protocol versions.
Oh, you are right. thanks.
Chen
Jirka