[PATCH v2 4/9] remote: remoteOpenConn: Use virConnectOpenAuth instead of virConnectOpen(ReadOnly)

Peter Krempa pkrempa at redhat.com
Fri Sep 9 11:58:14 UTC 2022


virConnectOpenAuth provides an unified interface with using 'flags' to
select the proper mode.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/remote/remote_daemon_dispatch.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index dc5790f077..061e0f7811 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1790,6 +1790,7 @@ remoteOpenConn(const char *uri,
 {
     g_autoptr(virTypedParamList) identparams = NULL;
     g_autoptr(virConnect) newconn = NULL;
+    unsigned int connectFlags = 0;

     VIR_DEBUG("Getting secondary uri=%s readonly=%d preserveIdent=%d conn=%p",
               NULLSTR(uri), readonly, preserveIdentity, conn);
@@ -1814,11 +1815,9 @@ remoteOpenConn(const char *uri,

     VIR_DEBUG("Opening driver %s", uri);
     if (readonly)
-        newconn = virConnectOpenReadOnly(uri);
-    else
-        newconn = virConnectOpen(uri);
+        connectFlags |= VIR_CONNECT_RO;

-    if (!newconn)
+    if (!(newconn = virConnectOpenAuth(uri, NULL, connectFlags)))
         return -1;

     VIR_DEBUG("Opened driver %p", newconn);
-- 
2.37.1



More information about the libvir-list mailing list