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

Michal Privoznik mprivozn at redhat.com
Fri Feb 22 16:20:34 UTC 2013


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




More information about the libvir-list mailing list