mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-21 05:29:18 +00: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;
|
bool portReserved;
|
||||||
int websocket;
|
int websocket;
|
||||||
bool websocketGenerated;
|
bool websocketGenerated;
|
||||||
|
bool websocketReserved;
|
||||||
bool autoport;
|
bool autoport;
|
||||||
char *keymap;
|
char *keymap;
|
||||||
virDomainGraphicsAuthDef auth;
|
virDomainGraphicsAuthDef auth;
|
||||||
|
@ -4678,9 +4678,11 @@ qemuProcessGraphicsReservePorts(virDomainGraphicsDef *graphics,
|
|||||||
return -1;
|
return -1;
|
||||||
graphics->data.vnc.portReserved = true;
|
graphics->data.vnc.portReserved = true;
|
||||||
}
|
}
|
||||||
if (graphics->data.vnc.websocket > 0 &&
|
if (graphics->data.vnc.websocket > 0) {
|
||||||
virPortAllocatorSetUsed(graphics->data.vnc.websocket) < 0)
|
if (virPortAllocatorSetUsed(graphics->data.vnc.websocket) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
graphics->data.vnc.websocketReserved = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
||||||
@ -8270,7 +8272,7 @@ void qemuProcessStop(virQEMUDriver *driver,
|
|||||||
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
||||||
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.websocket) {
|
} else if (graphics->data.vnc.websocketReserved) {
|
||||||
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
virPortAllocatorRelease(graphics->data.vnc.websocket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user