#seccomp_sandbox = 1
-
# Override the listen address for all incoming migrations. Defaults to
# 0.0.0.0, or :: if both host and qemu are capable of IPv6.
#migration_address = "127.0.0.1"
+# The default hostname or IP address which will be used by a migration
+# source for transferring migration data to this host. The migration
+# source has to be able to resolve this hostname and connect to it so
+# setting "localhost" will not work. By default, the host's configured
+# hostname is used.
+#migration_host = "host.example.com"
+
+
# Override the port range used for incoming migrations.
#
# Minimum must be greater than 0, however when QEMU is not running as root,
GET_VALUE_LONG("seccomp_sandbox", cfg->seccompSandbox);
+ GET_VALUE_STR("migration_host", cfg->migrateHost);
GET_VALUE_STR("migration_address", cfg->migrationAddress);
GET_VALUE_BOOL("log_timestamp", cfg->logTimestamp);
int ret = -1;
virURIPtr uri = NULL;
bool well_formed_uri = true;
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ const char *migrateHost = cfg->migrateHost;
VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
"cookieout=%p, cookieoutlen=%p, uri_in=%s, uri_out=%p, "
/* The URI passed in may be NULL or a string "tcp://somehostname:port".
*
* If the URI passed in is NULL then we allocate a port number
- * from our pool of port numbers and return a URI of
- * "tcp://ourhostname:port".
+ * from our pool of port numbers, and if the migrateHost is configured,
+ * we return a URI of "tcp://migrateHost:port", otherwise return a URI
+ * of "tcp://ourhostname:port".
*
* If the URI passed in is not NULL then we try to parse out the
* port number and use that (note that the hostname is assumed
if (virPortAllocatorAcquire(driver->migrationPorts, &port) < 0)
goto cleanup;
- if ((hostname = virGetHostname()) == NULL)
- goto cleanup;
+ if (migrateHost != NULL) {
+ if (virSocketAddrIsNumeric(migrateHost) &&
+ virSocketAddrParse(NULL, migrateHost, AF_UNSPEC) < 0)
+ goto cleanup;
+
+ if (VIR_STRDUP(hostname, migrateHost) < 0)
+ goto cleanup;
+ } else {
+ if ((hostname = virGetHostname()) == NULL)
+ goto cleanup;
+ }
if (STRPREFIX(hostname, "localhost")) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
cleanup:
virURIFree(uri);
VIR_FREE(hostname);
+ virObjectUnref(cfg);
if (ret != 0) {
VIR_FREE(*uri_out);
if (autoPort)
{ "keepalive_count" = "5" }
{ "seccomp_sandbox" = "1" }
{ "migration_address" = "127.0.0.1" }
+{ "migration_host" = "host.example.com" }
{ "migration_port_min" = "49152" }
{ "migration_port_max" = "49215" }
{ "log_timestamp" = "0" }