[Libvir] [PATCH] Fix driver counting in virConnectOpen

Atsushi SAKAI sakaia at jp.fujitsu.com
Mon Mar 19 09:45:01 UTC 2007


Hi,

I think virConnectOpen driver counting check is wrong.
If we does not run libvirt_qemud, virsh does not run on root privilege.
This restriction forces Xen user to run verbose libvirt_qemud. 

Signed-off-by: Atsushi SAKAI <sakaia at jp.fujitsu.com>

Thanks
Atsushi SAKAI

diff -urpN libvirt-0.2.1/src/libvirt.c libvirt-0.2.1.check/src/libvirt.c
--- libvirt-0.2.1/src/libvirt.c	2007-03-16 01:45:36.000000000 +0900
+++ libvirt-0.2.1.check/src/libvirt.c	2007-03-19 18:37:22.000000000 +0900
@@ -322,7 +322,7 @@ virConnectOpen(const char *name)
         }
     }
 
-    if (ret->nb_drivers == 0 || ret->nb_network_drivers == 0) {
+    if (ret->nb_drivers == 0 && ret->nb_network_drivers == 0) {
 	/* we failed to find an adequate driver */
 	virLibConnError(NULL, VIR_ERR_NO_SUPPORT, name);
 	goto failed;
@@ -389,7 +389,7 @@ virConnectOpenReadOnly(const char *name)
             ret->networkDrivers[ret->nb_network_drivers++] = virNetworkDriverTab[i];
         }
     }
-    if (ret->nb_drivers == 0) {
+    if (ret->nb_drivers == 0 && ret->nb_network_drivers == 0) {
 	if (name == NULL)
 	    virLibConnError(NULL, VIR_ERR_NO_CONNECT,
 			    _("Xen Daemon or Xen Store"));





More information about the libvir-list mailing list