Re: [PATCH v3 1/4] qemu: Unify port-wise SPICE and VNC behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

> +        } else if (vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
> +                   vm->def->graphics[0]->data.spice.autoport) {
> +            int port;
> +            if (vm->def->graphics[0]->data.spice.port > 0)
> +                port = qemuProcessNextFreePort(driver, vm->def->graphics[0]->data.spice.port);
> +            else
> +                port = qemuProcessNextFreePort(driver, QEMU_REMOTE_PORT_MIN);

And again.

> +            if (driver->spiceTLS) {
> +                if (vm->def->graphics[0]->data.spice.tlsPort > 0)
> +                    port = qemuProcessNextFreePort(driver, vm->def->graphics[0]->data.spice.tlsPort);
> +                else
> +                    port = qemuProcessNextFreePort(driver, vm->def->graphics[0]->data.spice.port + 1);

And again.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]