[libvirt] [PATCH v4 1/1] migration: add support for migrateURI configuration

Chen Fan chen.fan.fnst at cn.fujitsu.com
Wed May 14 07:18:09 UTC 2014


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 at 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.
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;
-- 
1.8.1.4




More information about the libvir-list mailing list