[PATCH 1/3] util: virtportallocator: Add VIR_DEBUG statements for port allocations and release

Peter Krempa posted 3 patches 12 months ago
[PATCH 1/3] util: virtportallocator: Add VIR_DEBUG statements for port allocations and release
Posted by Peter Krempa 12 months ago
Add a few debug statements to be able to trace lifetime of a
reserved/allocated port.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/util/virportallocator.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/util/virportallocator.c b/src/util/virportallocator.c
index 6d6f99778e..70393d87ee 100644
--- a/src/util/virportallocator.c
+++ b/src/util/virportallocator.c
@@ -29,9 +29,12 @@
 #include "virthread.h"
 #include "virerror.h"
 #include "virutil.h"
+#include "virlog.h"

 #define VIR_FROM_THIS VIR_FROM_NONE

+VIR_LOG_INIT("util.virportallocator");
+
 #define VIR_PORT_ALLOCATOR_NUM_PORTS 65536

 typedef struct _virPortAllocator virPortAllocator;
@@ -228,6 +231,8 @@ virPortAllocatorAcquire(const virPortAllocatorRange *range,
                     return -1;
                 }
                 *port = i;
+                VIR_DEBUG("port='%u'", *port);
+
                 return 0;
             }
         }
@@ -247,6 +252,8 @@ virPortAllocatorRelease(unsigned short port)
     if (!pa)
         return -1;

+    VIR_DEBUG("port='%u'", port);
+
     if (!port)
         return 0;

@@ -265,6 +272,8 @@ virPortAllocatorSetUsed(unsigned short port)
     if (!pa)
         return -1;

+    VIR_DEBUG("port='%u'", port);
+
     if (!port)
         return 0;

-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH 1/3] util: virtportallocator: Add VIR_DEBUG statements for port allocations and release
Posted by Andrea Bolognani 11 months, 3 weeks ago
On Tue, Jan 16, 2024 at 04:25:02PM +0100, Peter Krempa wrote:
> Add a few debug statements to be able to trace lifetime of a
> reserved/allocated port.
>
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  src/util/virportallocator.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org