Check if the hostdev has set the sgio filtered/unfiltered and handle appropriately. This restores functionality removed by commit id 'ce346623' to remove sgio support for the SCSI generic host device in the formerly named method qemuCheckSharedDevice. For most kernels the result of this operation is a no-op; however, for those that do support it the check is necessary. Note that this patch fixes a bug found in the reverted change where if the qemuGetDeviceUnprivSGIO returned either 0 or 1 in 'val', the 'disk' would be dereferenced; however, since a hostdev didn't have one - that dereference would have caused a segfault. That was fixed by commit id 'cd01d2ad5' using virDomainDiskGetSource. Instead these changes use the hostdev's address value. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/qemu/qemu_conf.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 3d28c03fa1..3f24c8b8fc 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1473,6 +1473,8 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver, { char *dev_path = NULL; char *key = NULL; + virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; int ret = -1; if (!qemuIsSharedHostdev(hostdev)) @@ -1481,6 +1483,19 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver, if (!(dev_path = qemuGetHostdevPath(hostdev))) goto cleanup; + if ((ret = qemuCheckUnprivSGIO(driver->sharedDevices, dev_path, + scsisrc->sgio)) < 0) { + if (ret == -2) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("sgio of shared scsi host device '%s-%u-%u-%llu' " + "conflicts with other active domains"), + scsihostsrc->adapter, scsihostsrc->bus, + scsihostsrc->target, scsihostsrc->unit); + ret = -1; + } + goto cleanup; + } + if (!(key = qemuGetSharedDeviceKey(dev_path))) goto cleanup; -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list