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

[libvirt] PATCH: Always reset PCI devices



Mark's patches added a attribute  managed='yes|no' for PCI <hostdev> 
configuration. This allows the caller app to indicate  who is responsible
for attaching/detaching the PCI device from the host drivers. When using
managed=yes, libvirt does it, while using managed=no, the someone else
should do it - typically blacklist the devices in /etc/modprobe.conf

Before launching a guest though the devices need to be reset. Mark made
the reset operation conditional on managed=yes, which was not what I
had intended. libvirtd should always reset the devices so they are in
a sane state before booting, regardless of who manages the host driver
binding. The forthcoming PCI passthrough suppor in the Xen driver will
work in this way - we'll only support managed=no, but XenD will still
always do the reset of devices

I also add a comment to remind us that we should add validation that
the PCI device is not still in use in the non-managed case.

Daniel

Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.132
diff -u -p -u -p -r1.132 qemu_conf.c
--- src/qemu_conf.c	2 Mar 2009 16:40:31 -0000	1.132
+++ src/qemu_conf.c	2 Mar 2009 18:23:07 -0000
@@ -1411,7 +1411,9 @@ int qemudBuildCommandLine(virConnectPtr 
                 }
 
                 pciFreeDevice(conn, dev);
-            }
+            } /* else {
+                XXX validate that non-managed device isn't in use
+            } */
         }
 
     }
@@ -1421,8 +1423,7 @@ int qemudBuildCommandLine(virConnectPtr 
         virDomainHostdevDefPtr hostdev = vm->def->hostdevs[i];
         pciDevice *dev;
 
-        if (!hostdev->managed ||
-            hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
+        if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
             hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
             continue;
 



-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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