These patches implements a separate module for hostdev passthrough so that it could be shared by different drivers and can maintain a global state of a host device. Patch 1: fix memory leak in virscsi.c Patch 2: improve virHostdevManager to use virOject wrapper and keep reference Patches 3~7: switch existing qemu and lxc driver to use virHostdevManager's lists, so that to maintain a global state of every host device. Patches 8~45 are to extract general code from qemu_hostdev.c piece by piece, make them reusable common APIs. Patches 46: unit test for the virhostdev common library Patches 47: add a hostdev backend type for xen Patches 48: add pci passthrough to libxl driver based on the common library Patches 49: change lxc to use common library APIs --- changes to v13: * change virHostdevManager, use virObject and keep reference, solve 'free' problem * add .hostdevMgr to qemu/lxc/libxl driver, get virHostdevManager in StateInitialize for once and keep reference, instead of getting it every time virHostdevManager is used. * fix v13 3/49 "qemu-reuse-hostdev-interfaces-to-avoid-duplicate.patch": update qemuPrepareHostUSBDevices parameters to specify hostdevs and nhostdevs, so that could be reused in qemu_hotplug. * rebase left patches Chunyan Liu (49): virscsi: fix memory leak virhostdev: use virObject to virHostdevManager to keep reference update qemuPrepareHostUSBDevices parameters to keep consistency qemu: reuse hostdev interfaces to avoid duplicate qemu: remove functions used internally only from qemu_hostdev.h qemu: use general virhostdev lists instead of its own lxc: use general virhostdev lists instead of its own qemu_hostdev: move cfg->relaxedACS as a flag qemu_hostdev: move ColdBoot as a flag qemu_hostdev: move netconfig file location to virhostdev stateDir extract general code from qemuPrepareHostdevPCIDevices rename qemu*NetConfigRestore/Replace to virHostdevNetConfigRestore/Replace rename qemuGet*PciHostDeviceList to virHostdevGet*PciHostDeviceList pass driver name as a parameter to virHostdevPrepareHostdevPCIDevices extract general code from qemuDomainReAttachHostdevDevices pass driver name as a parameter to virHostdevReAttachPCIDevices rename qemuReAttachPciDevice to virHostdevReAttachPciDevice move virHostdevPrepare(ReAttach)PCIDevices to virhostdev.c extract general code from qemuUpdateActivePciHostdevs extract general code from qemuUpdateActiveUsbHostdevs extract general code from qemuUpdateActiveScsiHostdevs pass driver_name as parameter of virHostdevUpdate*Hostdevs functions move virHostdevUpdate* functions to virhostdev.c extract general code from qemuPrepareHostUSBDevices rename qemu*USBDevices to virHostdev*USBDevices pass driver name to virHostdevPrepareUSBDevices move virHostdevPrepareHostUSBDevices to virhostdev.c extract general code from qemuPrepareHostSCSIDevices pass driver name as parameter to virHostdevPrepareSCSIDevices move virHostdevPrepareHostSCSIDevices to virhostdev.c extract general code from qemuDomainReAttachHostUsbDevices pass driver name as paramter to virHostdevReAttachUsbHostdevs move virHostdevReAttachUsbHostdevs to virhostdev.c extract general code from qemuDomainReAttachHostScsiDevices pass driver name as parameter to virHostdevReAttachScciHostdevs move virHostdevReAttachHostScsiDevices to virhostdev.c extract general code of NodeDeviceDetach extract general code of NodeDeviceReAttach extract general code of NodeDeviceReset move virHostdevNodeDevice* to virhostdev.c improve parameter name to let it more meaningful rename some function names to keep consistency improve virHostdevUpdate* parameters to make it more widely used add 3 wrapper functions for prepare/reattach/update domain hostdevs add parameter checks to common interfaces add unit test for new virhostdev common library change lxc_hostdev.c to use virhostdev common library APIs add hostdev pci backend type for xen add pci passthrough to libxl driver .gitignore | 1 + docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 3 +- src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 15 + src/libxl/libxl_conf.c | 63 ++ src/libxl/libxl_conf.h | 7 +- src/libxl/libxl_domain.c | 9 + src/libxl/libxl_driver.c | 454 +++++++++++- src/lxc/lxc_conf.h | 5 +- src/lxc/lxc_driver.c | 12 +- src/lxc/lxc_hostdev.c | 307 +------- src/qemu/qemu_command.c | 3 +- src/qemu/qemu_conf.h | 9 +- src/qemu/qemu_driver.c | 76 +- src/qemu/qemu_hostdev.c | 1203 ++----------------------------- src/qemu/qemu_hostdev.h | 29 +- src/qemu/qemu_hotplug.c | 78 +- src/qemu/qemu_process.c | 8 +- src/util/virhostdev.c | 1565 ++++++++++++++++++++++++++++++++++++++++- src/util/virhostdev.h | 96 +++ src/util/virscsi.c | 13 +- tests/Makefile.am | 5 + tests/virhostdevtest.c | 507 +++++++++++++ 24 files changed, 2832 insertions(+), 1638 deletions(-) create mode 100644 tests/virhostdevtest.c -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list