https://bugzilla.redhat.com/show_bug.cgi?id=957293 Allow iSCSI <hostdev/> devices to be added similarly to the existing <disk/> devices. Initially do a little bit of refactoring of the hostdev subsys structures to make it easier to model an iSCSI hostdev after the SCSI scsi_host. Although the bulk of the non-structure changes are "technically unnecessary", it just looked nicer to see {usb|pci|scsi}src rather than the longer "->source.subsys.u.{usb|pci|scsi}" in many places in the code. The end result is the guest will have /dev/sdX devices created. I have run this code through my Coverity environment and will be running the virttest suite over the weekend. Patches 1-3 are repetitive moves of the various hostdev subsys types (USB, PCI, and SCSI) into separate typedefs and then modifying code use the Ptr instead of the long union path to each field. I think I got most, but I'm sure there's still a few that could be cleaned up or that were added since I started this. Patch 4 more or less redoes patch 3 and I suppose could be combined. I left it separate because it's showing the progression to patch 6. This patch uses 'scsihost' to reference the specific portions while still using 'scsisrc' to reference the shared portion (which is only sgio). Patch 5 adds a virConnectPtr since patch 6 will need a way to get the secret value for the iSCSI secret/auth in qemuBuildSCSIHostdevDrvStr. Patch 6 adds the qemu code to handle a new hostdev protocol type VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI. The code will mimic the network disk (VIR_STORAGE_NET_PROTOCOL_ISCSI) code when making decisions. The new 'scsisrc' field 'protocol' will be the decision point. The default of VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE was chosen over TYPE_SCSI_HOST. The changes were made in this order to reduce the size of the patch when the XML is added (patch 8). Most of the code was done inline using the iscsisrc->protocol (when the iSCSI code had nothing to do). The remaining changes refactored code into "SCSIHost" and "SCSIiSCSI" to process the differences. Patch 7 just refactors domain_conf to add what will be a common routine to handle the "<host/>" element network disks. The iSCSI code will reuse the code to have it's own element. Patch 8 adds the XML, schema, and updates the docs to describe the <hostdev/> entry as well as of course adding new tests. The tests are a copy/merge of the scsi_host and network iscsi tests to define and describe the expected model. John Ferlan (8): hostdev: Introduce virDomainHostdevSubsysUSB hostdev: Introduce virDomainHostdevSubsysPCI hostdev: Introduce virDomainHostdevSubsysSCSI hostdev: Introduce virDomainHostdevSubsysSCSIHost Add virConnectPtr for qemuBuildSCSIHostdevDrvStr hostdev: Introduce virDomainHostdevSubsysSCSIiSCSI domain_conf: Common routine to handle network storage host xml def hostdev: Add iSCSI hostdev XML docs/formatdomain.html.in | 142 +++++-- docs/schemas/domaincommon.rng | 46 +- src/conf/domain_audit.c | 38 +- src/conf/domain_conf.c | 463 +++++++++++++++------ src/conf/domain_conf.h | 80 +++- src/libxl/libxl_conf.c | 9 +- src/libxl/libxl_domain.c | 5 +- src/libxl/libxl_driver.c | 34 +- src/lxc/lxc_cgroup.c | 4 +- src/lxc/lxc_controller.c | 10 +- src/lxc/lxc_driver.c | 16 +- src/qemu/qemu_cgroup.c | 69 +-- src/qemu/qemu_command.c | 158 ++++--- src/qemu/qemu_command.h | 5 +- src/qemu/qemu_conf.c | 20 +- src/qemu/qemu_driver.c | 6 +- src/qemu/qemu_hotplug.c | 93 +++-- src/qemu/qemu_hotplug.h | 9 +- src/security/security_apparmor.c | 33 +- src/security/security_dac.c | 66 +-- src/security/security_selinux.c | 64 +-- src/security/virt-aa-helper.c | 5 +- src/util/virhostdev.c | 295 +++++++------ .../qemuxml2argv-hostdev-scsi-lsi-iscsi-auth.args | 14 + .../qemuxml2argv-hostdev-scsi-lsi-iscsi-auth.xml | 46 ++ .../qemuxml2argv-hostdev-scsi-lsi-iscsi.args | 14 + .../qemuxml2argv-hostdev-scsi-lsi-iscsi.xml | 40 ++ ...emuxml2argv-hostdev-scsi-virtio-iscsi-auth.args | 16 + ...qemuxml2argv-hostdev-scsi-virtio-iscsi-auth.xml | 46 ++ .../qemuxml2argv-hostdev-scsi-virtio-iscsi.args | 16 + .../qemuxml2argv-hostdev-scsi-virtio-iscsi.xml | 40 ++ tests/qemuxml2argvtest.c | 16 + tests/qemuxml2xmltest.c | 5 + 33 files changed, 1317 insertions(+), 606 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-lsi-iscsi-auth.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-lsi-iscsi-auth.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-lsi-iscsi.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-lsi-iscsi.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-virtio-iscsi-auth.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-virtio-iscsi-auth.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-virtio-iscsi.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-virtio-iscsi.xml -- 1.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list