mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
qemu: Make migration port range configurable
https://bugzilla.redhat.com/show_bug.cgi?id=1019053 (cherry picked from commit e3ef20d7f7fee595ac4fc6094e04b7d65ee0583a) Conflicts: missing support for changing migration listen address src/qemu/qemu.conf src/qemu/qemu_conf.h src/qemu/test_libvirtd_qemu.aug.in
This commit is contained in:
parent
97e7e2660d
commit
15110e1835
@ -424,3 +424,14 @@
|
|||||||
# Defaults to -1.
|
# Defaults to -1.
|
||||||
#
|
#
|
||||||
#seccomp_sandbox = 1
|
#seccomp_sandbox = 1
|
||||||
|
|
||||||
|
|
||||||
|
# Override the port range used for incoming migrations.
|
||||||
|
#
|
||||||
|
# Minimum must be greater than 0, however when QEMU is not running as root,
|
||||||
|
# setting the minimum to be lower than 1024 will not work.
|
||||||
|
#
|
||||||
|
# Maximum must not be greater than 65535.
|
||||||
|
#
|
||||||
|
#migration_port_min = 49152
|
||||||
|
#migration_port_max = 49215
|
||||||
|
@ -225,6 +225,9 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
|
|||||||
cfg->webSocketPortMin = QEMU_WEBSOCKET_PORT_MIN;
|
cfg->webSocketPortMin = QEMU_WEBSOCKET_PORT_MIN;
|
||||||
cfg->webSocketPortMax = QEMU_WEBSOCKET_PORT_MAX;
|
cfg->webSocketPortMax = QEMU_WEBSOCKET_PORT_MAX;
|
||||||
|
|
||||||
|
cfg->migrationPortMin = QEMU_MIGRATION_PORT_MIN;
|
||||||
|
cfg->migrationPortMax = QEMU_MIGRATION_PORT_MAX;
|
||||||
|
|
||||||
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
|
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
|
||||||
/* For privileged driver, try and find hugepage mount automatically.
|
/* For privileged driver, try and find hugepage mount automatically.
|
||||||
* Non-privileged driver requires admin to create a dir for the
|
* Non-privileged driver requires admin to create a dir for the
|
||||||
@ -459,6 +462,24 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GET_VALUE_LONG("migration_port_min", cfg->migrationPortMin);
|
||||||
|
if (cfg->migrationPortMin <= 0) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("%s: migration_port_min: port must be greater than 0"),
|
||||||
|
filename);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
GET_VALUE_LONG("migration_port_max", cfg->migrationPortMax);
|
||||||
|
if (cfg->migrationPortMax > 65535 ||
|
||||||
|
cfg->migrationPortMax < cfg->migrationPortMin) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("%s: migration_port_max: port must be between "
|
||||||
|
"the minimal port %d and 65535"),
|
||||||
|
filename, cfg->migrationPortMin);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
p = virConfGetValue(conf, "user");
|
p = virConfGetValue(conf, "user");
|
||||||
CHECK_TYPE("user", VIR_CONF_STRING);
|
CHECK_TYPE("user", VIR_CONF_STRING);
|
||||||
if (p && p->str &&
|
if (p && p->str &&
|
||||||
|
@ -155,6 +155,9 @@ struct _virQEMUDriverConfig {
|
|||||||
unsigned int keepAliveCount;
|
unsigned int keepAliveCount;
|
||||||
|
|
||||||
int seccompSandbox;
|
int seccompSandbox;
|
||||||
|
|
||||||
|
int migrationPortMin;
|
||||||
|
int migrationPortMax;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Main driver state */
|
/* Main driver state */
|
||||||
|
@ -688,8 +688,8 @@ qemuStateInitialize(bool privileged,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if ((qemu_driver->migrationPorts =
|
if ((qemu_driver->migrationPorts =
|
||||||
virPortAllocatorNew(QEMU_MIGRATION_PORT_MIN,
|
virPortAllocatorNew(cfg->migrationPortMin,
|
||||||
QEMU_MIGRATION_PORT_MAX)) == NULL)
|
cfg->migrationPortMax)) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (qemuSecurityInit(qemu_driver) < 0)
|
if (qemuSecurityInit(qemu_driver) < 0)
|
||||||
|
@ -66,3 +66,5 @@ module Test_libvirtd_qemu =
|
|||||||
{ "keepalive_interval" = "5" }
|
{ "keepalive_interval" = "5" }
|
||||||
{ "keepalive_count" = "5" }
|
{ "keepalive_count" = "5" }
|
||||||
{ "seccomp_sandbox" = "1" }
|
{ "seccomp_sandbox" = "1" }
|
||||||
|
{ "migration_port_min" = "1234" }
|
||||||
|
{ "migration_port_max" = "12345" }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user