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

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



On 01/11/2013 05:13 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange 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

Attachment: signature.asc
Description: OpenPGP digital signature


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