mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
qemu: fix releasing VNC websocket port domain does not own
Scenario is with two domains with same VNC websocket port. - start first domain - start second, it will fail as port is occupied As a result port will be released which breaks port reservation logic. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
658ce2c3d4
commit
2f99afbd9a
@ -1901,6 +1901,7 @@ struct _virDomainGraphicsDef {
|
||||
bool portReserved;
|
||||
int websocket;
|
||||
bool websocketGenerated;
|
||||
bool websocketReserved;
|
||||
bool autoport;
|
||||
char *keymap;
|
||||
virDomainGraphicsAuthDef auth;
|
||||
|
@ -4678,9 +4678,11 @@ qemuProcessGraphicsReservePorts(virDomainGraphicsDef *graphics,
|
||||
return -1;
|
||||
graphics->data.vnc.portReserved = true;
|
||||
}
|
||||
if (graphics->data.vnc.websocket > 0 &&
|
||||
virPortAllocatorSetUsed(graphics->data.vnc.websocket) < 0)
|
||||
return -1;
|
||||
if (graphics->data.vnc.websocket > 0) {
|
||||
if (virPortAllocatorSetUsed(graphics->data.vnc.websocket) < 0)
|
||||
return -1;
|
||||
graphics->data.vnc.websocketReserved = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
||||
@ -8270,7 +8272,7 @@ void qemuProcessStop(virQEMUDriver *driver,
|
||||
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
||||
graphics->data.vnc.websocketGenerated = false;
|
||||
graphics->data.vnc.websocket = -1;
|
||||
} else if (graphics->data.vnc.websocket) {
|
||||
} else if (graphics->data.vnc.websocketReserved) {
|
||||
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user