render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
43fe83
From 7d3cfd66fca3cea0ae883fa2cc565b9240cecfcd Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <7d3cfd66fca3cea0ae883fa2cc565b9240cecfcd.1382534061.git.jdenemar@redhat.com>
43fe83
From: Michal Privoznik <mprivozn@redhat.com>
43fe83
Date: Fri, 11 Oct 2013 11:24:36 +0200
43fe83
Subject: [PATCH] qemu_conf: Introduce "migration_address"
43fe83
43fe83
https://bugzilla.redhat.com/show_bug.cgi?id=1015215
43fe83
43fe83
This configuration knob is there to override default listen address for
43fe83
-incoming for all qemu domains.
43fe83
43fe83
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
43fe83
(cherry picked from commit 1606d89c86545e63402ae4e379ceb98a1ca818e3)
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 src/qemu/libvirtd_qemu.aug         |  3 +++
43fe83
 src/qemu/qemu.conf                 |  6 ++++++
43fe83
 src/qemu/qemu_conf.c               |  2 ++
43fe83
 src/qemu/qemu_conf.h               |  3 +++
43fe83
 src/qemu/qemu_driver.c             | 10 ++++++----
43fe83
 src/qemu/test_libvirtd_qemu.aug.in |  1 +
43fe83
 6 files changed, 21 insertions(+), 4 deletions(-)
43fe83
43fe83
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
43fe83
index 3a874ca..8ce6885 100644
43fe83
--- a/src/qemu/libvirtd_qemu.aug
43fe83
+++ b/src/qemu/libvirtd_qemu.aug
43fe83
@@ -77,6 +77,8 @@ module Libvirtd_qemu =
43fe83
                  | int_entry "keepalive_interval"
43fe83
                  | int_entry "keepalive_count"
43fe83
 
43fe83
+   let network_entry = str_entry "migration_address"
43fe83
+
43fe83
    (* Each entry in the config is one of the following ... *)
43fe83
    let entry = vnc_entry
43fe83
              | spice_entry
43fe83
@@ -86,6 +88,7 @@ module Libvirtd_qemu =
43fe83
              | process_entry
43fe83
              | device_entry
43fe83
              | rpc_entry
43fe83
+             | network_entry
43fe83
 
43fe83
    let comment = [ label "#comment" . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
43fe83
    let empty = [ label "#empty" . eol ]
43fe83
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
43fe83
index be6ab2a..541db64 100644
43fe83
--- a/src/qemu/qemu.conf
43fe83
+++ b/src/qemu/qemu.conf
43fe83
@@ -421,3 +421,9 @@
43fe83
 # Defaults to -1.
43fe83
 #
43fe83
 #seccomp_sandbox = 1
43fe83
+
43fe83
+
43fe83
+
43fe83
+# Override the listen address for all incoming migrations. Defaults to
43fe83
+# 0.0.0.0 or :: in case if both host and qemu are capable of IPv6.
43fe83
+#migration_address = "127.0.0.1"
43fe83
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
43fe83
index c9d90db..cea139d 100644
43fe83
--- a/src/qemu/qemu_conf.c
43fe83
+++ b/src/qemu/qemu_conf.c
43fe83
@@ -529,6 +529,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
43fe83
 
43fe83
     GET_VALUE_LONG("seccomp_sandbox", cfg->seccompSandbox);
43fe83
 
43fe83
+    GET_VALUE_STR("migration_address", cfg->migrationAddress);
43fe83
+
43fe83
     ret = 0;
43fe83
 
43fe83
 cleanup:
43fe83
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
43fe83
index dc5f8db..356e501 100644
43fe83
--- a/src/qemu/qemu_conf.h
43fe83
+++ b/src/qemu/qemu_conf.h
43fe83
@@ -155,6 +155,9 @@ struct _virQEMUDriverConfig {
43fe83
     unsigned int keepAliveCount;
43fe83
 
43fe83
     int seccompSandbox;
43fe83
+
43fe83
+    /* The default for -incoming */
43fe83
+    char *migrationAddress;
43fe83
 };
43fe83
 
43fe83
 /* Main driver state */
43fe83
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
43fe83
index 91549fb..c2445d9 100644
43fe83
--- a/src/qemu/qemu_driver.c
43fe83
+++ b/src/qemu/qemu_driver.c
43fe83
@@ -10556,17 +10556,18 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
43fe83
                                 unsigned int flags)
43fe83
 {
43fe83
     virQEMUDriverPtr driver = dconn->privateData;
43fe83
+    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
43fe83
     virDomainDefPtr def = NULL;
43fe83
     const char *dom_xml = NULL;
43fe83
     const char *dname = NULL;
43fe83
     const char *uri_in = NULL;
43fe83
-    const char *listenAddress = NULL;
43fe83
+    const char *listenAddress = cfg->migrationAddress;
43fe83
     char *origname = NULL;
43fe83
     int ret = -1;
43fe83
 
43fe83
-    virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
43fe83
+    virCheckFlagsGoto(QEMU_MIGRATION_FLAGS, cleanup);
43fe83
     if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS) < 0)
43fe83
-        return -1;
43fe83
+        goto cleanup;
43fe83
 
43fe83
     if (virTypedParamsGetString(params, nparams,
43fe83
                                 VIR_MIGRATE_PARAM_DEST_XML,
43fe83
@@ -10580,7 +10581,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
43fe83
         virTypedParamsGetString(params, nparams,
43fe83
                                 VIR_MIGRATE_PARAM_LISTEN_ADDRESS,
43fe83
                                 &listenAddress) < 0)
43fe83
-        return -1;
43fe83
+        goto cleanup;
43fe83
 
43fe83
     if (flags & VIR_MIGRATE_TUNNELLED) {
43fe83
         /* this is a logical error; we never should have gotten here with
43fe83
@@ -10607,6 +10608,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
43fe83
 cleanup:
43fe83
     VIR_FREE(origname);
43fe83
     virDomainDefFree(def);
43fe83
+    virObjectUnref(cfg);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
43fe83
index d5df46c..be4518c 100644
43fe83
--- a/src/qemu/test_libvirtd_qemu.aug.in
43fe83
+++ b/src/qemu/test_libvirtd_qemu.aug.in
43fe83
@@ -66,3 +66,4 @@ module Test_libvirtd_qemu =
43fe83
 { "keepalive_interval" = "5" }
43fe83
 { "keepalive_count" = "5" }
43fe83
 { "seccomp_sandbox" = "1" }
43fe83
+{ "migration_address" = "127.0.0.1" }
43fe83
-- 
43fe83
1.8.4
43fe83