[libvirt] [PATCH] qemu: only release SPICE TLS port if it has been allocated

Silence the error message that happens during shutdown of a domain with spice graphics, autoport enabled if spice_tls is disabled in qemu.conf: error : virPortAllocatorRelease:174 : port 0 must be in range (5900, 65534) --- src/qemu/qemu_process.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b560d2e..1e2bcae 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4321,8 +4321,10 @@ retry: graphics->data.spice.autoport) { ignore_value(virPortAllocatorRelease(driver->remotePorts, graphics->data.spice.port)); - ignore_value(virPortAllocatorRelease(driver->remotePorts, - graphics->data.spice.tlsPort)); + if (cfg->spiceTLS) { + ignore_value(virPortAllocatorRelease(driver->remotePorts, + graphics->data.spice.tlsPort)); + } } } -- 1.7.12.4

On 22.02.2013 16:55, Ján Tomko wrote:
Silence the error message that happens during shutdown of a domain with spice graphics, autoport enabled if spice_tls is disabled in qemu.conf:
error : virPortAllocatorRelease:174 : port 0 must be in range (5900, 65534) --- src/qemu/qemu_process.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b560d2e..1e2bcae 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4321,8 +4321,10 @@ retry: graphics->data.spice.autoport) { ignore_value(virPortAllocatorRelease(driver->remotePorts, graphics->data.spice.port)); - ignore_value(virPortAllocatorRelease(driver->remotePorts, - graphics->data.spice.tlsPort)); + if (cfg->spiceTLS) { + ignore_value(virPortAllocatorRelease(driver->remotePorts, + graphics->data.spice.tlsPort)); + } } }
This patch is incomplete. I believe qemuProcessStop can be entered even without any port allocated. If there's a failure at very early phase in qemuProcessStart, e.g. we fail to get qemu caps or set a hook fails, we goto cleanup label, where the qemuProcessStop() is called. Hence I think we should return port only when we allocated it (in which case it is nonzero). Moreover, not only tlsPort is affected. Michal
participants (2)
-
Ján Tomko
-
Michal Privoznik