[PATCH] Fix virConnectOpen.*() name requirements

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

 



virConnectOpenAuth didn't require 'name' to be specified (VIR_DEBUG
used NULLSTR() for the output) and by default, if name == NULL, the
default connection uri is used.  This was not indicated in the
documentation and wasn't checked for in other API's VIR_DEBUG outputs.
---
Thanks to Guannan's patch, this makes the following possible in python:

conn = libvirt.open()

which I personally find pretty nice.
---
 src/libvirt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 1624776..4b9ea75 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1334,7 +1334,7 @@ failed:

 /**
  * virConnectOpen:
- * @name: URI of the hypervisor
+ * @name: (optional) URI of the hypervisor
  *
  * This function should be called first to get a connection to the
  * Hypervisor and xen store
@@ -1362,7 +1362,7 @@ virConnectOpen(const char *name)
     if (virInitialize() < 0)
         goto error;

-    VIR_DEBUG("name=%s", name);
+    VIR_DEBUG("name=%s", NULLSTR(name));
     virResetLastError();
     ret = do_open(name, NULL, 0);
     if (!ret)
@@ -1376,7 +1376,7 @@ error:

 /**
  * virConnectOpenReadOnly:
- * @name: URI of the hypervisor
+ * @name: (optional) URI of the hypervisor
  *
  * This function should be called first to get a restricted connection to the
  * library functionalities. The set of APIs usable are then restricted
@@ -1397,7 +1397,7 @@ virConnectOpenReadOnly(const char *name)
     if (virInitialize() < 0)
         goto error;

-    VIR_DEBUG("name=%s", name);
+    VIR_DEBUG("name=%s", NULLSTR(name));
     virResetLastError();
     ret = do_open(name, NULL, VIR_CONNECT_RO);
     if (!ret)
@@ -1411,7 +1411,7 @@ error:

 /**
  * virConnectOpenAuth:
- * @name: URI of the hypervisor
+ * @name: (optional) URI of the hypervisor
  * @auth: Authenticate callback parameters
  * @flags: bitwise-OR of virConnectFlags
  *
--
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]