
On 08/14/2012 11:42 AM, Daniel P. Berrange wrote:
On Mon, Aug 13, 2012 at 03:21:22PM +0200, Martin Kletzander wrote:
Port allocations for SPICE and VNC behave almost the same (with default ports), but there is some mess in the code. This patch clears these inconsistencies and makes sure the same behavior will be used when ports for remote displays are changed.
Changes: - hard-coded number 5900 removed (handled elsewhere like with VNC) - reservedVNCPorts renamed to reservedRemotePorts (it's not just for VNC anymore) - QEMU_VNC_PORT_{MIN,MAX} renamed to QEMU_REMOTE_PORT_{MIN,MAX} - port allocation unified for VNC and SPICE --- @@ -3417,41 +3417,47 @@ int qemuProcessStart(virConnectPtr conn, if (vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && !vm->def->graphics[0]->data.vnc.socket && vm->def->graphics[0]->data.vnc.autoport) { - int port = qemuProcessNextFreePort(driver, QEMU_VNC_PORT_MIN); + int port; + if (vm->def->graphics[0]->data.vnc.port > 0) + port = qemuProcessNextFreePort(driver, vm->def->graphics[0]->data.vnc.port); + else + port = qemuProcessNextFreePort(driver, QEMU_REMOTE_PORT_MIN); +
If 'autoport' is set, then 'vnc.port' should be completely ignored. This is changing that behaviour.
Since this wasn't mentioned anywhere, I figured this might be helpful to someone, but I've got no problem keeping it that way. Will post v2 then along with the fixes in PATCH 4/4. Martin