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.
Patches 1~6 are to switch existing qemu and lxc driver to use common library
lists, so that to maintain a global state of every host device.
Patches 7~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 v12:
* split "add hostdev passthrough common library" patch into small patches
for easier review.
* fix v12 comments
* rebase to libxl changes
Chunyan Liu (49):
add 'driver' info to used_by
qemu: reuse hostdev interfaces to avoid duplicate
qemu: remove functions now used internally only from qemu_hostdev.h
add virhostdev files to maintain global state of host devices
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
qemuPrepareUSBDevices: code adjustment for extracting general code
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 virHostdevDomainReAttachHostUsbDevices 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 +
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 19 +
src/libxl/libxl_conf.c | 63 ++
src/libxl/libxl_conf.h | 4 +
src/libxl/libxl_domain.c | 9 +
src/libxl/libxl_driver.c | 447 +++++++++++-
src/lxc/lxc_conf.h | 4 -
src/lxc/lxc_driver.c | 17 +-
src/lxc/lxc_hostdev.c | 315 +--------
src/qemu/qemu_command.c | 3 +-
src/qemu/qemu_conf.h | 10 +-
src/qemu/qemu_driver.c | 88 +--
src/qemu/qemu_hostdev.c | 1220 ++-----------------------------
src/qemu/qemu_hostdev.h | 27 +-
src/qemu/qemu_hotplug.c | 77 +--
src/qemu/qemu_process.c | 8 +-
src/util/virhostdev.c | 1621 +++++++++++++++++++++++++++++++++++++++++
src/util/virhostdev.h | 140 ++++
src/util/virpci.c | 31 +-
src/util/virpci.h | 9 +-
src/util/virscsi.c | 32 +-
src/util/virscsi.h | 7 +-
src/util/virusb.c | 31 +-
src/util/virusb.h | 8 +-
tests/Makefile.am | 5 +
tests/virhostdevtest.c | 507 +++++++++++++
tests/virscsitest.c | 6 +-
32 files changed, 3081 insertions(+), 1635 deletions(-)
create mode 100644 src/util/virhostdev.c
create mode 100644 src/util/virhostdev.h
create mode 100644 tests/virhostdevtest.c