[libvirt] [PATCH 6/7] Convert QEMU driver over to use virPortAllocator APIs

Eric Blake eblake at redhat.com
Wed Jan 16 00:39:06 UTC 2013


On 01/11/2013 05:13 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Replace the current QEMU driver code for managing port
> reservations with the new virPortAllocator APIs.
> ---
>  src/qemu/qemu_conf.h        |   4 +-
>  src/qemu/qemu_driver.c      |   9 ++--
>  src/qemu/qemu_process.c     | 100 ++++++++------------------------------------
>  src/util/virportallocator.c |   3 +-
>  4 files changed, 27 insertions(+), 89 deletions(-)

Nice reduction in size by reusing common code.

> +++ b/src/util/virportallocator.c
> @@ -103,7 +103,7 @@ int virPortAllocatorAcquire(virPortAllocatorPtr pa,
>      *port = 0;
>      virObjectLock(pa);
>  
> -    for (i = pa->start ; i < pa->end && fd == -1; i++) {
> +    for (i = pa->start ; i < pa->end && !*port; i++) {
>          int reuse = 1;
>          struct sockaddr_in addr;
>          bool used = false;
> @@ -150,6 +150,7 @@ int virPortAllocatorAcquire(virPortAllocatorPtr pa,
>                                 _("Failed to reserve port %d"), i);
>                  goto cleanup;
>              }
> +            *port = i;
>          }
>      }
>  

These two hunks should be squashed into 5/7.  ACK with that change.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130115/760ea80e/attachment-0001.sig>


More information about the libvir-list mailing list