[libvirt PATCH] remote: slightly improve debugging of socket selection

Daniel P. Berrangé posted 1 patch 1 week ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200916170555.1564950-1-berrange@redhat.com
src/remote/remote_sockets.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

[libvirt PATCH] remote: slightly improve debugging of socket selection

Posted by Daniel P. Berrangé 1 week ago
The current debug message reports the "mode" after selection has
completed, however, the "mode" value can be changed by the selection
logic. It is thus beneficial to report most values upfront, and only
report newly changed values at the end.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/remote/remote_sockets.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c
index 7c69ed9e7f..478c78edc2 100644
--- a/src/remote/remote_sockets.c
+++ b/src/remote/remote_sockets.c
@@ -145,6 +145,11 @@ remoteGetUNIXSocket(remoteDriverTransport transport,
     g_autofree char *direct_sock_name = NULL;
     g_autofree char *legacy_sock_name = NULL;
 
+    VIR_DEBUG("Choosing remote socket for transport=%s mode=%s driver=%s ro=%d session=%d",
+              remoteDriverTransportTypeToString(transport),
+              remoteDriverModeTypeToString(mode),
+              driver, ro, session);
+
     if (driver)
         direct_daemon = g_strdup_printf("virt%sd", driver);
 
@@ -208,12 +213,9 @@ remoteGetUNIXSocket(remoteDriverTransport transport,
         return NULL;
     }
 
-    VIR_DEBUG("Chosen UNIX sockname=%s daemon=%s "
-              "for mode=%s transport=%s ro=%d session=%d",
+    VIR_DEBUG("Chosen UNIX sockname=%s daemon=%s with mode=%s",
               sock_name, NULLSTR(*daemon),
-              remoteDriverModeTypeToString(mode),
-              remoteDriverTransportTypeToString(transport),
-              ro, session);
+              remoteDriverModeTypeToString(mode));
     return sock_name;
 }
 
-- 
2.26.2

Re: [libvirt PATCH] remote: slightly improve debugging of socket selection

Posted by Andrea Bolognani 1 week ago
On Wed, 2020-09-16 at 18:05 +0100, Daniel P. Berrangé wrote:
> The current debug message reports the "mode" after selection has
> completed, however, the "mode" value can be changed by the selection
> logic. It is thus beneficial to report most values upfront, and only
> report newly changed values at the end.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  src/remote/remote_sockets.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)

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

-- 
Andrea Bolognani / Red Hat / Virtualization