[libvirt] [PATCH v3 4/4] qemu: allow searching for all open ports

Daniel P. Berrange berrange at redhat.com
Tue Aug 14 09:46:30 UTC 2012


On Mon, Aug 13, 2012 at 03:21:25PM +0200, Martin Kletzander wrote:
> This patch allows to specify a flag 'rotate' saying that the search
> for next port should not be limited from the 'startPort' upwards.
> 
> This is subsequently used in the search for open SPICE TLS port when
> none is specified and TLS is enabled.
> ---
>  src/qemu/qemu_process.c |   24 +++++++++++++++++-------
>  1 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 654cb51..097d73a 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -2450,10 +2450,12 @@ qemuProcessInitPCIAddresses(struct qemud_driver *driver,
> 
> 
>  static int qemuProcessNextFreePort(struct qemud_driver *driver,
> -                                   int startPort)
> +                                   int startPort,
> +                                   bool rotate)


I think this is bogus - we should simply not pass startPort or rotate
in as parameters at all. 

>  {
>      int i;
> 
> + retry:
>      for (i = startPort ; i < driver->remotePortMax; i++) {

This should just loop from driver->remotePortMin always


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 :|




More information about the libvir-list mailing list