This configuration knob is there to override default listen address for
-incoming for all qemu domains.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/libvirtd_qemu.aug | 3 +++
src/qemu/qemu.conf | 6 ++++++
src/qemu/qemu_conf.c | 2 ++
src/qemu/qemu_conf.h | 2 ++
src/qemu/qemu_driver.c | 7 +++++++
src/qemu/test_libvirtd_qemu.aug.in | 1 +
6 files changed, 21 insertions(+)
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index cd13d53..d837e54 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -78,6 +78,8 @@ module Libvirtd_qemu =
| int_entry "keepalive_interval"
| int_entry "keepalive_count"
+ let network_entry = str_entry "listen_address"
+
(* Each entry in the config is one of the following ... *)
let entry = vnc_entry
| spice_entry
@@ -88,6 +90,7 @@ module Libvirtd_qemu =
| process_entry
| device_entry
| rpc_entry
+ | network_entry
let comment = [ label "#comment" . del /#[ \t]*/ "# " . store
/([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
let empty = [ label "#empty" . eol ]
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 5fd6263..8c6c3fc 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -424,3 +424,9 @@
# Defaults to -1.
#
#seccomp_sandbox = 1
+
+
+
+# Override listen address for all incoming migrations.
+# Defaults to 0.0.0.0 or :: in case if host is capable of IPv6.
+#listen_address = "127.0.0.1"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 1a41caf..084642c 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -546,6 +546,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
GET_VALUE_LONG("seccomp_sandbox", cfg->seccompSandbox);
+ GET_VALUE_STR("listen_address", cfg->listenAddress);
+
ret = 0;
cleanup:
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index da29a2a..a310896 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -155,6 +155,8 @@ struct _virQEMUDriverConfig {
unsigned int keepAliveCount;
int seccompSandbox;
+
+ char *listenAddress;
};
/* Main driver state */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e12a1de..bf81439 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10264,6 +10264,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
unsigned int flags)
{
virQEMUDriverPtr driver = dconn->privateData;
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
virDomainDefPtr def = NULL;
const char *dom_xml = NULL;
const char *dname = NULL;
@@ -10306,6 +10307,11 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
goto cleanup;
+ /* If no listenAddress has been passed via @params,
+ * use the one from qemu.conf */
+ if (!listenAddress)
+ listenAddress = cfg->listenAddress;
+
ret = qemuMigrationPrepareDirect(driver, dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
@@ -10315,6 +10321,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
cleanup:
VIR_FREE(origname);
virDomainDefFree(def);
+ virObjectUnref(cfg);
return ret;
}
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
index ea770dc..b1e4a4d 100644
--- a/src/qemu/test_libvirtd_qemu.aug.in
+++ b/src/qemu/test_libvirtd_qemu.aug.in
@@ -66,3 +66,4 @@ module Test_libvirtd_qemu =
{ "keepalive_interval" = "5" }
{ "keepalive_count" = "5" }
{ "seccomp_sandbox" = "1" }
+{ "listen_address" = "127.0.0.1" }
--
1.8.1.5