mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
qemu: cleanup code to release VNC websocket port
VNC websocket port cleanup looks a bit repetetive. Let's set websocketReserved flag whenever we reserve port (auto or not). Also websocketReserved flag is not cleared on stop in case of reconnect with auto port (flags is set on reconnect in qemuProcessGraphicsReservePorts call). Yeah config is freed in the end of stopping domain but still. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
2f99afbd9a
commit
39d93fd8b0
@ -4002,6 +4002,7 @@ qemuProcessVNCAllocatePorts(virQEMUDriver *driver,
|
||||
return -1;
|
||||
graphics->data.vnc.websocket = port;
|
||||
graphics->data.vnc.websocketGenerated = true;
|
||||
graphics->data.vnc.websocketReserved = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -8268,12 +8269,13 @@ void qemuProcessStop(virQEMUDriver *driver,
|
||||
virPortAllocatorRelease(graphics->data.vnc.port);
|
||||
graphics->data.vnc.portReserved = false;
|
||||
}
|
||||
if (graphics->data.vnc.websocketGenerated) {
|
||||
if (graphics->data.vnc.websocketReserved) {
|
||||
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
||||
graphics->data.vnc.websocketReserved = false;
|
||||
}
|
||||
if (graphics->data.vnc.websocketGenerated) {
|
||||
graphics->data.vnc.websocketGenerated = false;
|
||||
graphics->data.vnc.websocket = -1;
|
||||
} else if (graphics->data.vnc.websocketReserved) {
|
||||
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
||||
}
|
||||
}
|
||||
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
|
||||
|
Loading…
Reference in New Issue
Block a user