1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-04-01 20:05:19 +00:00

qemu: add RDP ports range allocator

RDP server uses port 3389 by default.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Marc-André Lureau 2025-03-16 12:18:31 +04:00 committed by Martin Kletzander
parent 14146b05b6
commit cab7d25371
3 changed files with 20 additions and 0 deletions

View File

@ -65,6 +65,9 @@ VIR_LOG_INIT("qemu.qemu_conf");
#define QEMU_REMOTE_PORT_MIN 5900
#define QEMU_REMOTE_PORT_MAX 65535
#define QEMU_RDP_PORT_MIN 3389
#define QEMU_RDP_PORT_MAX 65535
#define QEMU_WEBSOCKET_PORT_MIN 5700
#define QEMU_WEBSOCKET_PORT_MAX 65535
@ -248,6 +251,9 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
cfg->remotePortMin = QEMU_REMOTE_PORT_MIN;
cfg->remotePortMax = QEMU_REMOTE_PORT_MAX;
cfg->rdpPortMin = QEMU_RDP_PORT_MIN;
cfg->rdpPortMax = QEMU_RDP_PORT_MAX;
cfg->webSocketPortMin = QEMU_WEBSOCKET_PORT_MIN;
cfg->webSocketPortMax = QEMU_WEBSOCKET_PORT_MAX;

View File

@ -169,6 +169,9 @@ struct _virQEMUDriverConfig {
unsigned int remotePortMin;
unsigned int remotePortMax;
unsigned int rdpPortMin;
unsigned int rdpPortMax;
unsigned int webSocketPortMin;
unsigned int webSocketPortMax;
@ -312,6 +315,9 @@ struct _virQEMUDriver {
/* Immutable pointer, immutable object */
virPortAllocatorRange *webSocketPorts;
/* Immutable pointer, immutable object */
virPortAllocatorRange *rdpPorts;
/* Immutable pointer, immutable object */
virPortAllocatorRange *migrationPorts;

View File

@ -701,6 +701,13 @@ qemuStateInitialize(bool privileged,
cfg->webSocketPortMax)) == NULL)
goto error;
if ((qemu_driver->rdpPorts =
virPortAllocatorRangeNew(_("rdp"),
cfg->rdpPortMin,
cfg->rdpPortMax)) == NULL)
goto error;
if ((qemu_driver->migrationPorts =
virPortAllocatorRangeNew(_("migration"),
cfg->migrationPortMin,
@ -1050,6 +1057,7 @@ qemuStateCleanup(void)
virSysinfoDefFree(qemu_driver->hostsysinfo);
virPortAllocatorRangeFree(qemu_driver->migrationPorts);
virPortAllocatorRangeFree(qemu_driver->webSocketPorts);
virPortAllocatorRangeFree(qemu_driver->rdpPorts);
virPortAllocatorRangeFree(qemu_driver->remotePorts);
virObjectUnref(qemu_driver->hostdevMgr);
virObjectUnref(qemu_driver->securityManager);