qemu_conf: Introduce "migration_address"

This configuration knob is there to override default listen address for
-incoming for all qemu domains.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2013-10-09 11:32:55 +02:00
parent c4ac7ef663
commit 1606d89c86
6 changed files with 21 additions and 4 deletions

View File

@ -78,6 +78,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
@ -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 ]

View File

@ -424,3 +424,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"

View File

@ -546,6 +546,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
GET_VALUE_LONG("seccomp_sandbox", cfg->seccompSandbox);
GET_VALUE_STR("migration_address", cfg->migrationAddress);
ret = 0;
cleanup:

View File

@ -155,6 +155,9 @@ struct _virQEMUDriverConfig {
unsigned int keepAliveCount;
int seccompSandbox;
/* The default for -incoming */
char *migrationAddress;
};
/* Main driver state */

View File

@ -10262,17 +10262,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,
@ -10286,7 +10287,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
@ -10313,6 +10314,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
cleanup:
VIR_FREE(origname);
virDomainDefFree(def);
virObjectUnref(cfg);
return ret;
}

View File

@ -66,3 +66,4 @@ module Test_libvirtd_qemu =
{ "keepalive_interval" = "5" }
{ "keepalive_count" = "5" }
{ "seccomp_sandbox" = "1" }
{ "migration_address" = "127.0.0.1" }