mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-08-30 05:50:08 +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:
@ -4002,6 +4002,7 @@ qemuProcessVNCAllocatePorts(virQEMUDriver *driver,
|
|||||||
return -1;
|
return -1;
|
||||||
graphics->data.vnc.websocket = port;
|
graphics->data.vnc.websocket = port;
|
||||||
graphics->data.vnc.websocketGenerated = true;
|
graphics->data.vnc.websocketGenerated = true;
|
||||||
|
graphics->data.vnc.websocketReserved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -8268,12 +8269,13 @@ void qemuProcessStop(virQEMUDriver *driver,
|
|||||||
virPortAllocatorRelease(graphics->data.vnc.port);
|
virPortAllocatorRelease(graphics->data.vnc.port);
|
||||||
graphics->data.vnc.portReserved = false;
|
graphics->data.vnc.portReserved = false;
|
||||||
}
|
}
|
||||||
if (graphics->data.vnc.websocketGenerated) {
|
if (graphics->data.vnc.websocketReserved) {
|
||||||
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
||||||
|
graphics->data.vnc.websocketReserved = false;
|
||||||
|
}
|
||||||
|
if (graphics->data.vnc.websocketGenerated) {
|
||||||
graphics->data.vnc.websocketGenerated = false;
|
graphics->data.vnc.websocketGenerated = false;
|
||||||
graphics->data.vnc.websocket = -1;
|
graphics->data.vnc.websocket = -1;
|
||||||
} else if (graphics->data.vnc.websocketReserved) {
|
|
||||||
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
|
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
|
||||||
|
Reference in New Issue
Block a user