On Wed, Mar 22, 2017 at 04:27:37PM +0100, Erik Skultety wrote:
Keep track of the assigned mediated devices the same way we do it
for
the rest of hostdevs. Methods like 'Prepare', 'Update', and
'ReAttach'
are introduced by this patch.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/libvirt_private.syms | 3 +
src/qemu/qemu_hostdev.c | 56 ++++++++++++++++
src/qemu/qemu_hostdev.h | 10 +++
src/util/virhostdev.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++-
src/util/virhostdev.h | 23 +++++++
5 files changed, 256 insertions(+), 1 deletion(-)
@@ -305,6 +324,24 @@
qemuHostdevPrepareSCSIVHostDevices(virQEMUDriverPtr driver,
}
int
+qemuHostdevPrepareMediatedDevices(virQEMUDriverPtr driver,
+ const char *name,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs)
+{
+ virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+
+ if (!qemuHostdevHostSupportsPassthroughVFIO()) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("host doesn't support VFIO PCI interface"));
+ return -1;
+ }
This is unconditionally breaking *all* use of host devices on libvirt
if the system lacks VFIO, as it is not actually checking if any of
the 'hostdevs' are actually mediated devices, or indeed whether they
are even PCI devices. ie i can no longer boot a guest that uses USB
host device passthrough.
+
+ return virHostdevPrepareMediatedDevices(hostdev_mgr, QEMU_DRIVER_NAME,
+ name, hostdevs, nhostdevs);
+}
+
+int
qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver,
virDomainDefPtr def,
virQEMUCapsPtr qemuCaps,
@@ -330,6 +367,10 @@ qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver,
def->hostdevs, def->nhostdevs) < 0)
return -1;
+ if (qemuHostdevPrepareMediatedDevices(driver, def->name,
+ def->hostdevs, def->nhostdevs) < 0)
+ return -1;
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://entangle-photo.org -o-
http://search.cpan.org/~danberr/ :|