]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: virtportallocator: Add VIR_DEBUG statements for port allocations and release
authorPeter Krempa <pkrempa@redhat.com>
Tue, 16 Jan 2024 14:10:55 +0000 (15:10 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 31 Jan 2024 14:25:53 +0000 (15:25 +0100)
Add a few debug statements to be able to trace lifetime of a
reserved/allocated port.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/util/virportallocator.c

index 6d6f99778ec39d4cbb9ea2db9b490e2e244ad758..70393d87ee40a079fdc0c593efe11e72fc748005 100644 (file)
 #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;