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