On 10/09/2013 03:32 PM, Michal Privoznik wrote: > This configuration knob is there to override default listen address for > -incoming for all qemu domains. > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > 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 | 7 +++++++ > src/qemu/test_libvirtd_qemu.aug.in | 1 + > 6 files changed, 22 insertions(+) > > diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug > index cd13d53..591d78d 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 "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 ] > diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf > index 5fd6263..4403aaf 100644 > --- a/src/qemu/qemu.conf > +++ b/src/qemu/qemu.conf > @@ -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" > diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c > index 1a41caf..16a0b92 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("migration_address", cfg->migrationAddress); > + > ret = 0; > > cleanup: > diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h > index da29a2a..40adfce 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 e12a1de..7d87b2d 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); You'll leak a reference to cfg if @flags or @params are invalid. > 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->migrationAddress; > + You can initialize listenAddress to this instead of NULL. ACK with the leak fixed. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list