mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
qemu: conf: add setup for automatic port allocation for pull-mode backup NBD servers
Add backup_port_min and backup_port_max configuration options to qemu.conf, defaulting to 10809-10872 (10809 is the IANA-assigned NBD port; range of 64 matches the migration port pattern). Signed-off-by: Lucas Amaral <lucaaamaral@gmail.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
1 parent
406b7fb0bd
commit
d1c6f0edc1
5 files changed
+41
No files matched your search
@@ -146,6 +146,8 @@ module Libvirtd_qemu =
|
||||
| int_entry "migration_port_min"
|
||||
| int_entry "migration_port_max"
|
||||
| str_entry "migration_host"
|
||||
| int_entry "backup_port_min"
|
||||
| int_entry "backup_port_max"
|
||||
|
||||
let log_entry = bool_entry "log_timestamp"
|
||||
|
||||
|
||||
@@ -969,6 +969,15 @@
|
||||
#migration_port_max = 49215
|
||||
|
||||
|
||||
# Port range used for automatic allocation of NBD backup server ports.
|
||||
# When a pull-mode backup is started without specifying a TCP port, a
|
||||
# port from this range will be assigned automatically. The NBD standard
|
||||
# port is 10809.
|
||||
#
|
||||
#backup_port_min = 10809
|
||||
#backup_port_max = 10872
|
||||
|
||||
|
||||
# Timestamp QEMU's log messages (if QEMU supports it)
|
||||
#
|
||||
# Defaults to 1.
|
||||
|
||||
@@ -74,6 +74,9 @@ VIR_LOG_INIT("qemu.qemu_conf");
|
||||
#define QEMU_MIGRATION_PORT_MIN 49152
|
||||
#define QEMU_MIGRATION_PORT_MAX 49215
|
||||
|
||||
#define QEMU_BACKUP_PORT_MIN 10809
|
||||
#define QEMU_BACKUP_PORT_MAX 10872
|
||||
|
||||
VIR_ENUM_IMPL(virQEMUSchedCore,
|
||||
QEMU_SCHED_CORE_LAST,
|
||||
"none",
|
||||
@@ -268,6 +271,9 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
|
||||
cfg->migrationPortMin = QEMU_MIGRATION_PORT_MIN;
|
||||
cfg->migrationPortMax = QEMU_MIGRATION_PORT_MAX;
|
||||
|
||||
cfg->backupPortMin = QEMU_BACKUP_PORT_MIN;
|
||||
cfg->backupPortMax = QEMU_BACKUP_PORT_MAX;
|
||||
|
||||
/* For privileged driver, try and find hugetlbfs mounts automatically.
|
||||
* Non-privileged driver requires admin to create a dir for the
|
||||
* user, chown it, and then let user configure it manually. */
|
||||
@@ -989,6 +995,25 @@ virQEMUDriverConfigLoadNetworkEntry(virQEMUDriverConfig *cfg,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virConfGetValueUInt(conf, "backup_port_min", &cfg->backupPortMin) < 0)
|
||||
return -1;
|
||||
if (cfg->backupPortMin <= 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("%1$s: backup_port_min: port must be greater than 0"),
|
||||
filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virConfGetValueUInt(conf, "backup_port_max", &cfg->backupPortMax) < 0)
|
||||
return -1;
|
||||
if (cfg->backupPortMax > 65535 ||
|
||||
cfg->backupPortMax < cfg->backupPortMin) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("%1$s: backup_port_max: port must be between the minimal port %2$d and 65535"),
|
||||
filename, cfg->backupPortMin);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virConfGetValueString(conf, "migration_host", &cfg->migrateHost) < 0)
|
||||
return -1;
|
||||
virStringStripIPv6Brackets(cfg->migrateHost);
|
||||
|
||||
@@ -241,6 +241,9 @@ struct _virQEMUDriverConfig {
|
||||
unsigned int migrationPortMin;
|
||||
unsigned int migrationPortMax;
|
||||
|
||||
unsigned int backupPortMin;
|
||||
unsigned int backupPortMax;
|
||||
|
||||
bool logTimestamp;
|
||||
bool stdioLogD;
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ module Test_libvirtd_qemu =
|
||||
{ "migration_host" = "host.example.com" }
|
||||
{ "migration_port_min" = "49152" }
|
||||
{ "migration_port_max" = "49215" }
|
||||
{ "backup_port_min" = "10809" }
|
||||
{ "backup_port_max" = "10872" }
|
||||
{ "log_timestamp" = "0" }
|
||||
{ "nvram"
|
||||
{ "1" = "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd" }
|
||||
|
||||
Reference in new issue
Block a user