[PATCH] Allow network drivers to decline to take a connection

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

 



A couple of problems fixed in the attached patch.

Firstly the path used to connect to the network driver in non-root mode was wrong. This may have affected you if you tried to use the test:///default driver as non-root. I haven't tested this fully, but in any case the path is obviously wrong and needs to be fixed.

Secondly remote introduces its own network driver, and so we now need to allow network drivers to decline to take a connection (currently they either succeed or give an error - meaning in effect that there can only be one network driver). The first part of the attached patch allows this.

Rich.

--
Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421

Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.
Registered in England and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA) and David
Owens (Ireland)
Index: src/libvirt.c
===================================================================
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.70
diff -u -r1.70 libvirt.c
--- src/libvirt.c	30 Apr 2007 17:30:11 -0000	1.70
+++ src/libvirt.c	1 May 2007 16:45:00 -0000
@@ -295,8 +299,8 @@
 
     for (i = 0; i < virNetworkDriverTabCount; i++) {
         res = virNetworkDriverTab[i]->open (ret, name, flags);
-        if (res == -1) goto failed;
-        else if (res == 0) {
+        if (res == VIR_DRV_OPEN_ERROR) goto failed;
+        else if (res == VIR_DRV_OPEN_SUCCESS) {
             ret->networkDriver = virNetworkDriverTab[i];
             break;
         }
Index: src/qemu_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_internal.c,v
retrieving revision 1.22
diff -u -r1.22 qemu_internal.c
--- src/qemu_internal.c	30 Apr 2007 17:30:11 -0000	1.22
+++ src/qemu_internal.c	1 May 2007 16:45:01 -0000
@@ -949,10 +1022,10 @@
         netpriv->qemud_fd = priv->qemud_fd;
         netpriv->shared = 1;
         conn->networkPrivateData = netpriv;
-        return 0;
+        return VIR_DRV_OPEN_SUCCESS;
     } else {
         /* Non-QEMU driver is active - open a new connection */
-        const char *drvname = geteuid() == 0 ? "qemu:///system" : "qemu://session";
+        const char *drvname = geteuid() == 0 ? "qemu:///system" : "qemu:///session";
         xmlURIPtr uri = xmlParseURI(drvname);
         int ret = qemuOpenConnection(conn, uri, flags & VIR_DRV_OPEN_RO ? 1 : 0);
         xmlFreeURI(uri);
@@ -964,7 +1037,7 @@
             netpriv->qemud_fd = ret;
             netpriv->shared = 0;
             conn->networkPrivateData = netpriv;
-            return 0;
+            return VIR_DRV_OPEN_SUCCESS;
         }
     }
 }

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[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]