[libvirt] problem in pciFindStubDriver

Chunyan Liu cyliu at suse.com
Fri Jan 4 02:22:09 UTC 2013


For Xen PV guests, pciback is the only working driver, pci-stub
doesn't work. Current function finds pci-stub driver first, if
pci-stub doesn't exist, find pciback. It won't work for Xen PV guests
since it will find pci-stub driver and return, but in fact it needs
pciback.

One way is to prefer pciback rather than pci-stub like in following
patch. But that will change the behaviour of other drivers too. Is
there any preferred aprroach to handle this?

diff --git a/src/util/virpci.c b/src/util/virpci.c
index 5971764..c0a1c05 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -861,22 +861,22 @@ pciFindStubDriver(void)
     int probed = 0;

 recheck:
-    if (pciDriverDir(&drvpath, "pci-stub") < 0) {
+    if (pciDriverDir(&drvpath, "pciback") < 0) {
         return NULL;
     }

     if (virFileExists(drvpath)) {
         VIR_FREE(drvpath);
-        return "pci-stub";
+        return "pciback";
     }

-    if (pciDriverDir(&drvpath, "pciback") < 0) {
+    if (pciDriverDir(&drvpath, "pci-stub") < 0) {
         return NULL;
     }

     if (virFileExists(drvpath)) {
         VIR_FREE(drvpath);
-        return "pciback";
+        return "pci-stub";
     }

     VIR_FREE(drvpath);




More information about the libvir-list mailing list