diff --git a/libvirt-RHEL-Enable-usage-of-x-blockdev-reopen.patch b/libvirt-RHEL-Enable-usage-of-x-blockdev-reopen.patch index 44a445d..f1b6e1a 100644 --- a/libvirt-RHEL-Enable-usage-of-x-blockdev-reopen.patch +++ b/libvirt-RHEL-Enable-usage-of-x-blockdev-reopen.patch @@ -1,7 +1,7 @@ -From e764e6b0a72f5dae5457178661d88982017ff07d Mon Sep 17 00:00:00 2001 -Message-Id: +From 8eaad4cc89e78c25ccca3481741cded0538046b0 Mon Sep 17 00:00:00 2001 +Message-Id: <8eaad4cc89e78c25ccca3481741cded0538046b0@dist-git> From: Peter Krempa -Date: Mon, 16 Mar 2020 22:12:34 +0100 +Date: Wed, 28 Jul 2021 17:37:21 +0200 Subject: [PATCH] RHEL: Enable usage of x-blockdev-reopen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -17,54 +17,112 @@ is going to use it and wire up code to call the x- prefixed command. This implementation will become dormant once qemu starts supporting upstream-stable blockdev-reopen. -https://bugzilla.redhat.com/show_bug.cgi?id=1953939 +https://bugzilla.redhat.com/show_bug.cgi?id=1799013 -Message-Id: <098dc0e73e1b561af991f2a9ecf13436dde3b33d.1584391727.git.pkrempa@redhat.com> +Starting with libvirt-7.6, upstream has adapted to the new format of +arguments so this patch was modified to support blockdev-reopen which +takes an array of nodes to reopen. + +https://bugzilla.redhat.com/show_bug.cgi?id=1929765 +Message-Id: <3fcde2fc6add36d5276ae224caf18adc8bca7d48.1627486352.git.pkrempa@redhat.com> Reviewed-by: Ján Tomko --- - src/qemu/qemu_block.c | 3 ++- + src/qemu/qemu_block.c | 24 +++++++++++++++--------- + src/qemu/qemu_block.h | 3 ++- src/qemu/qemu_capabilities.c | 11 +++++++++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_monitor.c | 5 +++-- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 12 +++++++++--- src/qemu/qemu_monitor_json.h | 3 ++- - 7 files changed, 30 insertions(+), 8 deletions(-) + tests/qemumonitorjsontest.c | 2 +- + 9 files changed, 46 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c -index 6627d044cd..a531bdd704 100644 +index 4691dff4f7..1f731fff3d 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c -@@ -3317,6 +3317,7 @@ qemuBlockReopenFormat(virDomainObj *vm, +@@ -3289,7 +3289,8 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc, + + int + qemuBlockReopenFormatMon(qemuMonitor *mon, +- virStorageSource *src) ++ virStorageSource *src, ++ bool downstream) + { + g_autoptr(virJSONValue) reopenprops = NULL; + g_autoptr(virJSONValue) srcprops = NULL; +@@ -3298,15 +3299,19 @@ qemuBlockReopenFormatMon(qemuMonitor *mon, + if (!(srcprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore))) + return -1; + +- if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0) +- return -1; ++ if (downstream) { ++ reopenprops = g_steal_pointer(&srcprops); ++ } else { ++ if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0) ++ return -1; + +- if (virJSONValueObjectCreate(&reopenprops, +- "a:options", &reopenoptions, +- NULL) < 0) +- return -1; ++ if (virJSONValueObjectCreate(&reopenprops, ++ "a:options", &reopenoptions, ++ NULL) < 0) ++ return -1; ++ } + +- if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0) ++ if (qemuMonitorBlockdevReopen(mon, &reopenprops, downstream) < 0) + return -1; + + return 0; +@@ -3330,6 +3335,7 @@ qemuBlockReopenFormat(virDomainObj *vm, + { qemuDomainObjPrivate *priv = vm->privateData; virQEMUDriver *driver = priv->driver; - g_autoptr(virJSONValue) reopenprops = NULL; + bool downstream = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API); int rc; /* If we are lacking the object here, qemu might have opened an image with -@@ -3333,7 +3334,7 @@ qemuBlockReopenFormat(virDomainObj *vm, +@@ -3343,7 +3349,7 @@ qemuBlockReopenFormat(virDomainObj *vm, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; -- rc = qemuMonitorBlockdevReopen(priv->mon, &reopenprops); -+ rc = qemuMonitorBlockdevReopen(priv->mon, &reopenprops, downstream); +- rc = qemuBlockReopenFormatMon(priv->mon, src); ++ rc = qemuBlockReopenFormatMon(priv->mon, src, downstream); if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) return -1; +diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h +index 54601a48a9..88fc9974c4 100644 +--- a/src/qemu/qemu_block.h ++++ b/src/qemu/qemu_block.h +@@ -268,7 +268,8 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc, + /* only for use in qemumonitorjsontest */ + int + qemuBlockReopenFormatMon(qemuMonitor *mon, +- virStorageSource *src); ++ virStorageSource *src, ++ bool downstream); + + int + qemuBlockReopenReadWrite(virDomainObj *vm, diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index d1cd8f11ac..c663bf456e 100644 +index 9558938866..6734ed213d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c -@@ -636,6 +636,7 @@ VIR_ENUM_IMPL(virQEMUCaps, - /* 405 */ +@@ -637,6 +637,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "confidential-guest-support", "query-display-options", + "s390-pv-guest", + "blockdev-reopen.__com.redhat_rhel-av-8_2_0-api", ); -@@ -1549,6 +1550,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVhostUserFS[] = +@@ -1551,6 +1552,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVhostUserFS[] = /* see documentation for virQEMUQAPISchemaPathGet for the query format */ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { @@ -72,7 +130,7 @@ index d1cd8f11ac..c663bf456e 100644 { "blockdev-add/arg-type/options/+gluster/debug-level", QEMU_CAPS_GLUSTER_DEBUG_LEVEL}, { "blockdev-add/arg-type/+gluster/debug", QEMU_CAPS_GLUSTER_DEBUG_LEVEL}, { "blockdev-add/arg-type/+vxhs", QEMU_CAPS_VXHS}, -@@ -5191,6 +5193,15 @@ virQEMUCapsInitProcessCaps(virQEMUCaps *qemuCaps) +@@ -5204,6 +5206,15 @@ virQEMUCapsInitProcessCaps(virQEMUCaps *qemuCaps) qemuCaps->arch == VIR_ARCH_MIPS) virQEMUCapsSet(qemuCaps, QEMU_CAPS_SCSI_NCR53C90); @@ -89,22 +147,22 @@ index d1cd8f11ac..c663bf456e 100644 } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h -index 7944b9170a..a4792ebd27 100644 +index 2b1bb57a49..def0dd2030 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h -@@ -616,6 +616,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ - /* 405 */ +@@ -617,6 +617,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT, /* -machine confidential-guest-support */ QEMU_CAPS_QUERY_DISPLAY_OPTIONS, /* 'query-display-options' qmp command present */ + QEMU_CAPS_S390_PV_GUEST, /* -object s390-pv-guest,... */ + QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API, /* downstream support for blockdev reopen in rhel-av-8.2.0 */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c -index 8f35b4240f..14e38a2abc 100644 +index 6e2d8010c5..7ebaa7b099 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c -@@ -4458,14 +4458,15 @@ qemuMonitorBlockdevAdd(qemuMonitor *mon, +@@ -4339,14 +4339,15 @@ qemuMonitorBlockdevAdd(qemuMonitor *mon, int qemuMonitorBlockdevReopen(qemuMonitor *mon, @@ -123,10 +181,10 @@ index 8f35b4240f..14e38a2abc 100644 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h -index 6a25def78b..14bfbb600e 100644 +index 1491c1297c..5a93447e23 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h -@@ -1371,7 +1371,8 @@ int qemuMonitorBlockdevAdd(qemuMonitor *mon, +@@ -1366,7 +1366,8 @@ int qemuMonitorBlockdevAdd(qemuMonitor *mon, virJSONValue **props); int qemuMonitorBlockdevReopen(qemuMonitor *mon, @@ -137,10 +195,10 @@ index 6a25def78b..14bfbb600e 100644 int qemuMonitorBlockdevDel(qemuMonitor *mon, const char *nodename); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c -index 223777739d..6e7b28c6c7 100644 +index ca2c3bb6cf..8ecd5f3bbd 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c -@@ -8704,13 +8704,19 @@ qemuMonitorJSONBlockdevAdd(qemuMonitor *mon, +@@ -8687,13 +8687,19 @@ qemuMonitorJSONBlockdevAdd(qemuMonitor *mon, int qemuMonitorJSONBlockdevReopen(qemuMonitor *mon, @@ -177,6 +235,19 @@ index 01a3ba25f1..90792c9939 100644 ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int qemuMonitorJSONBlockdevDel(qemuMonitor *mon, +diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c +index 2122d9d999..c20287afee 100644 +--- a/tests/qemumonitorjsontest.c ++++ b/tests/qemumonitorjsontest.c +@@ -2820,7 +2820,7 @@ testQemuMonitorJSONBlockdevReopen(const void *opaque) + if (qemuMonitorTestAddItem(test, "blockdev-reopen", "{\"return\":{}}") < 0) + return -1; + +- if (qemuBlockReopenFormatMon(qemuMonitorTestGetMonitor(test), src) < 0) ++ if (qemuBlockReopenFormatMon(qemuMonitorTestGetMonitor(test), src, false) < 0) + return -1; + + return 0; -- 2.32.0 diff --git a/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch b/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch index c3878ef..cce7793 100644 --- a/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch +++ b/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch @@ -1,5 +1,5 @@ -From 482de1261b2cdb52eea365e8e6419be7d6e713ab Mon Sep 17 00:00:00 2001 -Message-Id: <482de1261b2cdb52eea365e8e6419be7d6e713ab@dist-git> +From 8232ba78dea7336282f65e94d575beb9b27d03f4 Mon Sep 17 00:00:00 2001 +Message-Id: <8232ba78dea7336282f65e94d575beb9b27d03f4@dist-git> From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Mon, 27 Aug 2018 13:09:38 +0200 Subject: [PATCH] RHEL: Fix virConnectGetMaxVcpus output @@ -26,7 +26,7 @@ Reviewed-by: Andrea Bolognani 1 file changed, 5 insertions(+) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c -index bf7fda23af..0dfa56b8d7 100644 +index 7aa92ad11d..337f03b41b 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1192,6 +1192,11 @@ virHostCPUGetKVMMaxVCPUs(void) diff --git a/libvirt-RHEL-qemu-Add-ability-to-set-sgio-values-for-hostdev.patch b/libvirt-RHEL-qemu-Add-ability-to-set-sgio-values-for-hostdev.patch deleted file mode 100644 index 4ddc2b5..0000000 --- a/libvirt-RHEL-qemu-Add-ability-to-set-sgio-values-for-hostdev.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 34ded5c6dfa0d565901b80d60b3feeab7c13e4c0 Mon Sep 17 00:00:00 2001 -Message-Id: <34ded5c6dfa0d565901b80d60b3feeab7c13e4c0@dist-git> -From: John Ferlan -Date: Mon, 17 Dec 2018 20:42:30 -0500 -Subject: [PATCH] RHEL: qemu: Add ability to set sgio values for hostdev -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1582424 - -RHEL-only - -Add necessary checks in order to allow setting sgio values for a scsi -host device - -Signed-off-by: John Ferlan -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_conf.c | 25 ++++++++++++++++--------- - 1 file changed, 16 insertions(+), 9 deletions(-) - -diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c -index 916a3d36ee..a749fc1bbc 100644 ---- a/src/qemu/qemu_conf.c -+++ b/src/qemu/qemu_conf.c -@@ -1836,8 +1836,9 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev) - virDomainDiskDef *disk = NULL; - virDomainHostdevDef *hostdev = NULL; - g_autofree char *sysfs_path = NULL; -+ g_autofree char *hostdev_path = NULL; - const char *path = NULL; -- int val = -1; -+ int val = 0; - - /* "sgio" is only valid for block disk; cdrom - * and floopy disk can have empty source. -@@ -1853,17 +1854,14 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev) - } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) { - hostdev = dev->data.hostdev; - -- if (!qemuIsSharedHostdev(hostdev)) -+ if (hostdev->source.subsys.u.scsi.protocol == -+ VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) - return 0; - -- if (hostdev->source.subsys.u.scsi.sgio) { -- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -- _("'sgio' is not supported for SCSI " -- "generic device yet ")); -+ if (!(hostdev_path = qemuGetHostdevPath(hostdev))) - return -1; -- } - -- return 0; -+ path = hostdev_path; - } else { - return 0; - } -@@ -1872,7 +1870,16 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev) - return -1; - - /* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */ -- val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED); -+ if (dev->type == VIR_DOMAIN_DEVICE_DISK) { -+ if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) -+ val = 1; -+ } else { -+ /* Only settable if was present for hostdev */ -+ if (qemuIsSharedHostdev(hostdev) && -+ hostdev->source.subsys.u.scsi.sgio == -+ VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) -+ val = 1; -+ } - - /* Do not do anything if unpriv_sgio is not supported by the kernel and the - * whitelist is enabled. But if requesting unfiltered access, always call --- -2.32.0 - diff --git a/libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch b/libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch deleted file mode 100644 index 3af13be..0000000 --- a/libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch +++ /dev/null @@ -1,66 +0,0 @@ -From e85d335bc6660dd3e8b86d7305e837c97da1b0b2 Mon Sep 17 00:00:00 2001 -Message-Id: -From: John Ferlan -Date: Mon, 17 Dec 2018 20:42:31 -0500 -Subject: [PATCH] RHEL: qemu: Add check for unpriv sgio for SCSI generic host - device -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1582424 - -RHEL-only - -Check if the hostdev has set the sgio filtered/unfiltered and handle -appropriately. - -This restores functionality removed by upstream commit id 'ce346623' -to remove sgio support for the SCSI generic host device. - -Signed-off-by: John Ferlan -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_conf.c | 20 ++++++++++++++++++-- - 1 file changed, 18 insertions(+), 2 deletions(-) - -diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c -index a749fc1bbc..2beef89cd1 100644 ---- a/src/qemu/qemu_conf.c -+++ b/src/qemu/qemu_conf.c -@@ -1743,13 +1743,29 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriver *driver, - { - g_autofree char *dev_path = NULL; - g_autofree char *key = NULL; -+ virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi; -+ virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host; - int ret = -1; - - if (!qemuIsSharedHostdev(hostdev)) - return 0; - -- if (!(dev_path = qemuGetHostdevPath(hostdev)) || -- !(key = qemuGetSharedDeviceKey(dev_path))) -+ if (!(dev_path = qemuGetHostdevPath(hostdev))) -+ return -1; -+ -+ 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); -+ } -+ return -1; -+ } -+ -+ if (!(key = qemuGetSharedDeviceKey(dev_path))) - return -1; - - qemuDriverLock(driver); --- -2.32.0 - diff --git a/libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch b/libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch deleted file mode 100644 index 7eebbbf..0000000 --- a/libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch +++ /dev/null @@ -1,215 +0,0 @@ -From 277db698d2e33100be4007ff00ed59d122067827 Mon Sep 17 00:00:00 2001 -Message-Id: <277db698d2e33100be4007ff00ed59d122067827@dist-git> -From: Michal Privoznik -Date: Fri, 6 Mar 2020 15:52:21 +0100 -Subject: [PATCH] RHEL: virscsi: Check device type before getting it's /dev - node name - -Not all SCSI devices are block devices, therefore -/sys/bus/scsi/devices/X:X:X:X/block/ directory does not always -exist. Check if the SCSI device is a block device beforehand. - -https://bugzilla.redhat.com/show_bug.cgi?id=1808390 - -Signed-off-by: Michal Privoznik -Signed-off-by: Andrea Bolognani -Message-Id: <20200306145226.1610708-2-abologna@redhat.com> -Reviewed-by: Jiri Denemark ---- - src/util/virscsi.c | 140 ++++++++++++++++++++++++++++++--- - tests/virscsidata/0-0-0-0/type | 1 + - tests/virscsidata/1-0-0-0/type | 1 + - 3 files changed, 131 insertions(+), 11 deletions(-) - create mode 100644 tests/virscsidata/0-0-0-0/type - create mode 100644 tests/virscsidata/1-0-0-0/type - -diff --git a/src/util/virscsi.c b/src/util/virscsi.c -index b1f202eef1..3d68f829e4 100644 ---- a/src/util/virscsi.c -+++ b/src/util/virscsi.c -@@ -47,6 +47,32 @@ struct _virUsedByInfo { - }; - typedef struct _virUsedByInfo virUsedByInfo; - -+ -+/* Keep in sync with scsi/scsi_proto.h */ -+typedef enum { -+ VIR_SCSI_DEVICE_TYPE_NONE = -1, -+ VIR_SCSI_DEVICE_TYPE_DISK = 0x00, -+ VIR_SCSI_DEVICE_TYPE_TAPE = 0x01, -+ VIR_SCSI_DEVICE_TYPE_PRINTER = 0x02, -+ VIR_SCSI_DEVICE_TYPE_PROCESSOR = 0x03, -+ VIR_SCSI_DEVICE_TYPE_WORM = 0x04, -+ VIR_SCSI_DEVICE_TYPE_ROM = 0x05, -+ VIR_SCSI_DEVICE_TYPE_SCANNER = 0x06, -+ VIR_SCSI_DEVICE_TYPE_MOD = 0x07, -+ VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER = 0x08, -+ VIR_SCSI_DEVICE_TYPE_COMM = 0x09, -+ VIR_SCSI_DEVICE_TYPE_RAID = 0x0c, -+ VIR_SCSI_DEVICE_TYPE_ENCLOSURE = 0x0d, -+ VIR_SCSI_DEVICE_TYPE_RBC = 0x0e, -+ VIR_SCSI_DEVICE_TYPE_OSD = 0x11, -+ VIR_SCSI_DEVICE_TYPE_ZBC = 0x14, -+ VIR_SCSI_DEVICE_TYPE_WLUN = 0x1e, -+ VIR_SCSI_DEVICE_TYPE_NO_LUN = 0x7f, -+ -+ VIR_SCSI_DEVICE_TYPE_LAST, -+} virSCSIDeviceType; -+ -+ - struct _virSCSIDevice { - unsigned int adapter; - unsigned int bus; -@@ -126,6 +152,78 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix, - return NULL; - } - -+ -+static int -+virSCSIDeviceGetType(const char *prefix, -+ unsigned int adapter, -+ unsigned int bus, -+ unsigned int target, -+ unsigned long long unit, -+ virSCSIDeviceType *type) -+{ -+ int intType; -+ -+ if (virFileReadValueInt(&intType, -+ "%s/%d:%u:%u:%llu/type", -+ prefix, adapter, bus, target, unit) < 0) -+ return -1; -+ -+ switch (intType) { -+ case VIR_SCSI_DEVICE_TYPE_DISK: -+ case VIR_SCSI_DEVICE_TYPE_TAPE: -+ case VIR_SCSI_DEVICE_TYPE_PRINTER: -+ case VIR_SCSI_DEVICE_TYPE_PROCESSOR: -+ case VIR_SCSI_DEVICE_TYPE_WORM: -+ case VIR_SCSI_DEVICE_TYPE_ROM: -+ case VIR_SCSI_DEVICE_TYPE_SCANNER: -+ case VIR_SCSI_DEVICE_TYPE_MOD: -+ case VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER: -+ case VIR_SCSI_DEVICE_TYPE_COMM: -+ case VIR_SCSI_DEVICE_TYPE_RAID: -+ case VIR_SCSI_DEVICE_TYPE_ENCLOSURE: -+ case VIR_SCSI_DEVICE_TYPE_RBC: -+ case VIR_SCSI_DEVICE_TYPE_OSD: -+ case VIR_SCSI_DEVICE_TYPE_ZBC: -+ case VIR_SCSI_DEVICE_TYPE_WLUN: -+ case VIR_SCSI_DEVICE_TYPE_NO_LUN: -+ *type = intType; -+ break; -+ -+ default: -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("unknown SCSI device type: %x"), -+ intType); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+ -+static char * -+virSCSIDeviceGetDevNameBlock(const char *prefix, -+ unsigned int adapter, -+ unsigned int bus, -+ unsigned int target, -+ unsigned long long unit) -+{ -+ g_autoptr(DIR) dir = NULL; -+ struct dirent *entry; -+ g_autofree char *path = NULL; -+ -+ path = g_strdup_printf("%s/%d:%u:%u:%llu/block", -+ prefix, adapter, bus, target, unit); -+ -+ if (virDirOpen(&dir, path) < 0) -+ return NULL; -+ -+ if (virDirRead(dir, &entry, path) > 0) -+ return g_strdup(entry->d_name); -+ -+ return NULL; -+} -+ -+ - /* Returns device name (e.g. "sdc") on success, or NULL - * on failure. - */ -@@ -136,25 +234,45 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix, - unsigned int target, - unsigned long long unit) - { -- g_autoptr(DIR) dir = NULL; -- struct dirent *entry; -- g_autofree char *path = NULL; - unsigned int adapter_id; -+ virSCSIDeviceType type; - const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_DEVICES; - - if (virSCSIDeviceGetAdapterId(adapter, &adapter_id) < 0) - return NULL; - -- path = g_strdup_printf("%s/%d:%u:%u:%llu/block", prefix, adapter_id, bus, -- target, unit); -- -- if (virDirOpen(&dir, path) < 0) -+ if (virSCSIDeviceGetType(prefix, adapter_id, -+ bus, target, unit, &type) < 0) - return NULL; - -- if (virDirRead(dir, &entry, path) > 0) -- return g_strdup(entry->d_name); -- -- return NULL; -+ switch (type) { -+ case VIR_SCSI_DEVICE_TYPE_DISK: -+ return virSCSIDeviceGetDevNameBlock(prefix, adapter_id, bus, target, unit); -+ -+ case VIR_SCSI_DEVICE_TYPE_TAPE: -+ case VIR_SCSI_DEVICE_TYPE_PRINTER: -+ case VIR_SCSI_DEVICE_TYPE_PROCESSOR: -+ case VIR_SCSI_DEVICE_TYPE_WORM: -+ case VIR_SCSI_DEVICE_TYPE_ROM: -+ case VIR_SCSI_DEVICE_TYPE_SCANNER: -+ case VIR_SCSI_DEVICE_TYPE_MOD: -+ case VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER: -+ case VIR_SCSI_DEVICE_TYPE_COMM: -+ case VIR_SCSI_DEVICE_TYPE_RAID: -+ case VIR_SCSI_DEVICE_TYPE_ENCLOSURE: -+ case VIR_SCSI_DEVICE_TYPE_RBC: -+ case VIR_SCSI_DEVICE_TYPE_OSD: -+ case VIR_SCSI_DEVICE_TYPE_ZBC: -+ case VIR_SCSI_DEVICE_TYPE_WLUN: -+ case VIR_SCSI_DEVICE_TYPE_NO_LUN: -+ case VIR_SCSI_DEVICE_TYPE_NONE: -+ case VIR_SCSI_DEVICE_TYPE_LAST: -+ default: -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("unsupported SCSI device type: %x"), -+ type); -+ return NULL; -+ } - } - - virSCSIDevice * -diff --git a/tests/virscsidata/0-0-0-0/type b/tests/virscsidata/0-0-0-0/type -new file mode 100644 -index 0000000000..573541ac97 ---- /dev/null -+++ b/tests/virscsidata/0-0-0-0/type -@@ -0,0 +1 @@ -+0 -diff --git a/tests/virscsidata/1-0-0-0/type b/tests/virscsidata/1-0-0-0/type -new file mode 100644 -index 0000000000..573541ac97 ---- /dev/null -+++ b/tests/virscsidata/1-0-0-0/type -@@ -0,0 +1 @@ -+0 --- -2.32.0 - diff --git a/libvirt-RHEL-virscsi-Introduce-and-use-virSCSIDeviceGetUnprivSGIOSysfsPath.patch b/libvirt-RHEL-virscsi-Introduce-and-use-virSCSIDeviceGetUnprivSGIOSysfsPath.patch deleted file mode 100644 index 2930bd5..0000000 --- a/libvirt-RHEL-virscsi-Introduce-and-use-virSCSIDeviceGetUnprivSGIOSysfsPath.patch +++ /dev/null @@ -1,267 +0,0 @@ -From ab13cb0cce89c6f77bf1530af787015bae71c5fa Mon Sep 17 00:00:00 2001 -Message-Id: -From: Michal Privoznik -Date: Fri, 6 Mar 2020 15:52:23 +0100 -Subject: [PATCH] RHEL: virscsi: Introduce and use - virSCSIDeviceGetUnprivSGIOSysfsPath() - -When constructing a path to the 'unpriv_sgio' file of given SCSI -device we don't need to go through /dev/* and major() + minor() -path. The generated path points to -/sys/dev/block/MAJ:MIN/queue/unpriv_sgio which is wrong if the -SCSI device in question is not a block device. We can generate a -different path: /sys/bus/scsi/devices/X:X:X:X/unpriv_sgio where -the file is directly accessible regardless of the SCSI device -type. - -https://bugzilla.redhat.com/show_bug.cgi?id=1808390 - -Signed-off-by: Michal Privoznik -Signed-off-by: Andrea Bolognani -Message-Id: <20200306145226.1610708-4-abologna@redhat.com> -Reviewed-by: Jiri Denemark ---- - src/libvirt_private.syms | 1 + - src/qemu/qemu_conf.c | 29 ++++++++++++++++++----------- - src/util/virscsi.c | 19 +++++++++++++++++++ - src/util/virscsi.h | 5 +++++ - src/util/virutil.c | 24 ++++++------------------ - src/util/virutil.h | 2 -- - 6 files changed, 49 insertions(+), 31 deletions(-) - -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index 68e4b6aab8..5af3eec2e9 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -3159,6 +3159,7 @@ virSCSIDeviceGetSgName; - virSCSIDeviceGetShareable; - virSCSIDeviceGetTarget; - virSCSIDeviceGetUnit; -+virSCSIDeviceGetUnprivSGIOSysfsPath; - virSCSIDeviceIsAvailable; - virSCSIDeviceListAdd; - virSCSIDeviceListCount; -diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c -index 2beef89cd1..90ff7f56f0 100644 ---- a/src/qemu/qemu_conf.c -+++ b/src/qemu/qemu_conf.c -@@ -1500,7 +1500,7 @@ qemuCheckUnprivSGIO(GHashTable *sharedDevices, - if (!(virHashLookup(sharedDevices, key))) - return 0; - -- if (virGetDeviceUnprivSGIO(device_path, NULL, &val) < 0) -+ if (virGetDeviceUnprivSGIO(sysfs_path, &val) < 0) - return -1; - - /* Error message on failure needs to be handled in caller -@@ -1852,39 +1852,46 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev) - virDomainDiskDef *disk = NULL; - virDomainHostdevDef *hostdev = NULL; - g_autofree char *sysfs_path = NULL; -- g_autofree char *hostdev_path = NULL; -- const char *path = NULL; - int val = 0; - - /* "sgio" is only valid for block disk; cdrom - * and floopy disk can have empty source. - */ - if (dev->type == VIR_DOMAIN_DEVICE_DISK) { -+ const char *path; -+ - disk = dev->data.disk; -+ path = virDomainDiskGetSource(disk); - - if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN || - !virStorageSourceIsBlockLocal(disk->src)) - return 0; - -- path = virDomainDiskGetSource(disk); -+ if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL))) -+ return -1; -+ - } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) { -+ virDomainHostdevSubsysSCSI *scsisrc; -+ virDomainHostdevSubsysSCSIHost *scsihostsrc; -+ - hostdev = dev->data.hostdev; -+ scsisrc = &hostdev->source.subsys.u.scsi; -+ scsihostsrc = &scsisrc->u.host; - - if (hostdev->source.subsys.u.scsi.protocol == - VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) - return 0; - -- if (!(hostdev_path = qemuGetHostdevPath(hostdev))) -+ if (!(sysfs_path = virSCSIDeviceGetUnprivSGIOSysfsPath(NULL, -+ scsihostsrc->adapter, -+ scsihostsrc->bus, -+ scsihostsrc->target, -+ scsihostsrc->unit))) - return -1; -- -- path = hostdev_path; - } else { - return 0; - } - -- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL))) -- return -1; -- - /* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */ - if (dev->type == VIR_DOMAIN_DEVICE_DISK) { - if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) -@@ -1902,7 +1909,7 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev) - * virSetDeviceUnprivSGIO, to report an error for unsupported unpriv_sgio. - */ - if ((virFileExists(sysfs_path) || val == 1) && -- virSetDeviceUnprivSGIO(path, NULL, val) < 0) -+ virSetDeviceUnprivSGIO(sysfs_path, val) < 0) - return -1; - - return 0; -diff --git a/src/util/virscsi.c b/src/util/virscsi.c -index d6c10c0667..7a8e6b3b23 100644 ---- a/src/util/virscsi.c -+++ b/src/util/virscsi.c -@@ -302,6 +302,25 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix, - } - } - -+ -+char * -+virSCSIDeviceGetUnprivSGIOSysfsPath(const char *sysfs_prefix, -+ const char *adapter, -+ unsigned int bus, -+ unsigned int target, -+ unsigned long long unit) -+{ -+ unsigned int adapter_id; -+ const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_DEVICES; -+ -+ if (virSCSIDeviceGetAdapterId(adapter, &adapter_id) < 0) -+ return NULL; -+ -+ return g_strdup_printf("%s/%d:%u:%u:%llu/unpriv_sgio", -+ prefix, adapter_id, bus, target, unit); -+} -+ -+ - virSCSIDevice * - virSCSIDeviceNew(const char *sysfs_prefix, - const char *adapter, -diff --git a/src/util/virscsi.h b/src/util/virscsi.h -index 65ad15ed76..5721985939 100644 ---- a/src/util/virscsi.h -+++ b/src/util/virscsi.h -@@ -40,6 +40,11 @@ char *virSCSIDeviceGetDevName(const char *sysfs_prefix, - unsigned int bus, - unsigned int target, - unsigned long long unit); -+char *virSCSIDeviceGetUnprivSGIOSysfsPath(const char *sysfs_prefix, -+ const char *adapter, -+ unsigned int bus, -+ unsigned int target, -+ unsigned long long unit); - - virSCSIDevice *virSCSIDeviceNew(const char *sysfs_prefix, - const char *adapter, -diff --git a/src/util/virutil.c b/src/util/virutil.c -index 199d405286..50ed1cabab 100644 ---- a/src/util/virutil.c -+++ b/src/util/virutil.c -@@ -1382,18 +1382,13 @@ virGetUnprivSGIOSysfsPath(const char *path, - - int - virSetDeviceUnprivSGIO(const char *path, -- const char *sysfs_dir, - int unpriv_sgio) - { -- char *sysfs_path = NULL; - char *val = NULL; - int ret = -1; - int rc; - -- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir))) -- return -1; -- -- if (!virFileExists(sysfs_path)) { -+ if (!virFileExists(path)) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("unpriv_sgio is not supported by this kernel")); - goto cleanup; -@@ -1401,38 +1396,32 @@ virSetDeviceUnprivSGIO(const char *path, - - val = g_strdup_printf("%d", unpriv_sgio); - -- if ((rc = virFileWriteStr(sysfs_path, val, 0)) < 0) { -- virReportSystemError(-rc, _("failed to set %s"), sysfs_path); -+ if ((rc = virFileWriteStr(path, val, 0)) < 0) { -+ virReportSystemError(-rc, _("failed to set %s"), path); - goto cleanup; - } - - ret = 0; - cleanup: -- VIR_FREE(sysfs_path); - VIR_FREE(val); - return ret; - } - - int - virGetDeviceUnprivSGIO(const char *path, -- const char *sysfs_dir, - int *unpriv_sgio) - { -- char *sysfs_path = NULL; - char *buf = NULL; - char *tmp = NULL; - int ret = -1; - -- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir))) -- return -1; -- -- if (!virFileExists(sysfs_path)) { -+ if (!virFileExists(path)) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("unpriv_sgio is not supported by this kernel")); - goto cleanup; - } - -- if (virFileReadAll(sysfs_path, 1024, &buf) < 0) -+ if (virFileReadAll(path, 1024, &buf) < 0) - goto cleanup; - - if ((tmp = strchr(buf, '\n'))) -@@ -1440,13 +1429,12 @@ virGetDeviceUnprivSGIO(const char *path, - - if (virStrToLong_i(buf, NULL, 10, unpriv_sgio) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("failed to parse value of %s"), sysfs_path); -+ _("failed to parse value of %s"), path); - goto cleanup; - } - - ret = 0; - cleanup: -- VIR_FREE(sysfs_path); - VIR_FREE(buf); - return ret; - } -diff --git a/src/util/virutil.h b/src/util/virutil.h -index 854b494890..da267c6446 100644 ---- a/src/util/virutil.h -+++ b/src/util/virutil.h -@@ -120,10 +120,8 @@ int virGetDeviceID(const char *path, - int *maj, - int *min) G_GNUC_NO_INLINE; - int virSetDeviceUnprivSGIO(const char *path, -- const char *sysfs_dir, - int unpriv_sgio); - int virGetDeviceUnprivSGIO(const char *path, -- const char *sysfs_dir, - int *unpriv_sgio); - char *virGetUnprivSGIOSysfsPath(const char *path, - const char *sysfs_dir); --- -2.32.0 - diff --git a/libvirt-RHEL-virscsi-Support-TAPEs-in-virSCSIDeviceGetDevName.patch b/libvirt-RHEL-virscsi-Support-TAPEs-in-virSCSIDeviceGetDevName.patch deleted file mode 100644 index ecbc43a..0000000 --- a/libvirt-RHEL-virscsi-Support-TAPEs-in-virSCSIDeviceGetDevName.patch +++ /dev/null @@ -1,201 +0,0 @@ -From 7ed1929b385b577f2b3c2a0faae3aa582555bf7b Mon Sep 17 00:00:00 2001 -Message-Id: <7ed1929b385b577f2b3c2a0faae3aa582555bf7b@dist-git> -From: Michal Privoznik -Date: Fri, 6 Mar 2020 15:52:22 +0100 -Subject: [PATCH] RHEL: virscsi: Support TAPEs in virSCSIDeviceGetDevName() - -If the SCSI device we want to get /dev node name for is TAPE -device we need to look at 'tape' symlink in the sysfs dir -corresponding to the device. - -https://bugzilla.redhat.com/show_bug.cgi?id=1808390 - -Signed-off-by: Michal Privoznik -Signed-off-by: Andrea Bolognani -Message-Id: <20200306145226.1610708-3-abologna@redhat.com> -Reviewed-by: Jiri Denemark ---- - src/util/virscsi.c | 27 +++++++++++++++ - tests/virscsidata/2-0-0-0/model | 1 + - tests/virscsidata/2-0-0-0/scsi_tape/st0/dev | 1 + - tests/virscsidata/2-0-0-0/sg3/dev | 1 + - tests/virscsidata/2-0-0-0/tape | 1 + - tests/virscsidata/2-0-0-0/type | 1 + - tests/virscsidata/2-0-0-0/vendor | 1 + - tests/virscsidata/sg3 | 0 - tests/virscsitest.c | 38 ++++++++++++++++++--- - 9 files changed, 66 insertions(+), 5 deletions(-) - create mode 100644 tests/virscsidata/2-0-0-0/model - create mode 100644 tests/virscsidata/2-0-0-0/scsi_tape/st0/dev - create mode 100644 tests/virscsidata/2-0-0-0/sg3/dev - create mode 120000 tests/virscsidata/2-0-0-0/tape - create mode 100644 tests/virscsidata/2-0-0-0/type - create mode 100644 tests/virscsidata/2-0-0-0/vendor - create mode 100644 tests/virscsidata/sg3 - -diff --git a/src/util/virscsi.c b/src/util/virscsi.c -index 3d68f829e4..d6c10c0667 100644 ---- a/src/util/virscsi.c -+++ b/src/util/virscsi.c -@@ -224,6 +224,31 @@ virSCSIDeviceGetDevNameBlock(const char *prefix, - } - - -+static char * -+virSCSIDeviceGetDevNameTape(const char *prefix, -+ unsigned int adapter, -+ unsigned int bus, -+ unsigned int target, -+ unsigned long long unit) -+{ -+ g_autofree char *path = NULL; -+ g_autofree char *resolvedPath = NULL; -+ g_autoptr(GError) err = NULL; -+ -+ path = g_strdup_printf("%s/%d:%u:%u:%llu/tape", -+ prefix, adapter, bus, target, unit); -+ -+ if (!(resolvedPath = g_file_read_link(path, &err))) { -+ virReportError(VIR_ERR_SYSTEM_ERROR, -+ _("Unable to read link: %s"), -+ err->message); -+ return NULL; -+ } -+ -+ return g_path_get_basename(resolvedPath); -+} -+ -+ - /* Returns device name (e.g. "sdc") on success, or NULL - * on failure. - */ -@@ -250,6 +275,8 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix, - return virSCSIDeviceGetDevNameBlock(prefix, adapter_id, bus, target, unit); - - case VIR_SCSI_DEVICE_TYPE_TAPE: -+ return virSCSIDeviceGetDevNameTape(prefix, adapter_id, bus, target, unit); -+ - case VIR_SCSI_DEVICE_TYPE_PRINTER: - case VIR_SCSI_DEVICE_TYPE_PROCESSOR: - case VIR_SCSI_DEVICE_TYPE_WORM: -diff --git a/tests/virscsidata/2-0-0-0/model b/tests/virscsidata/2-0-0-0/model -new file mode 100644 -index 0000000000..d2ab4715c3 ---- /dev/null -+++ b/tests/virscsidata/2-0-0-0/model -@@ -0,0 +1 @@ -+scsi_debug -diff --git a/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev b/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev -new file mode 100644 -index 0000000000..3dd777e840 ---- /dev/null -+++ b/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev -@@ -0,0 +1 @@ -+9:0 -diff --git a/tests/virscsidata/2-0-0-0/sg3/dev b/tests/virscsidata/2-0-0-0/sg3/dev -new file mode 100644 -index 0000000000..b369a59b3e ---- /dev/null -+++ b/tests/virscsidata/2-0-0-0/sg3/dev -@@ -0,0 +1 @@ -+21:3 -diff --git a/tests/virscsidata/2-0-0-0/tape b/tests/virscsidata/2-0-0-0/tape -new file mode 120000 -index 0000000000..6ca7f77539 ---- /dev/null -+++ b/tests/virscsidata/2-0-0-0/tape -@@ -0,0 +1 @@ -+scsi_tape/st0 -\ No newline at end of file -diff --git a/tests/virscsidata/2-0-0-0/type b/tests/virscsidata/2-0-0-0/type -new file mode 100644 -index 0000000000..d00491fd7e ---- /dev/null -+++ b/tests/virscsidata/2-0-0-0/type -@@ -0,0 +1 @@ -+1 -diff --git a/tests/virscsidata/2-0-0-0/vendor b/tests/virscsidata/2-0-0-0/vendor -new file mode 100644 -index 0000000000..9b075671ea ---- /dev/null -+++ b/tests/virscsidata/2-0-0-0/vendor -@@ -0,0 +1 @@ -+Linux -diff --git a/tests/virscsidata/sg3 b/tests/virscsidata/sg3 -new file mode 100644 -index 0000000000..e69de29bb2 -diff --git a/tests/virscsitest.c b/tests/virscsitest.c -index 0d7c35a261..0647bb4841 100644 ---- a/tests/virscsitest.c -+++ b/tests/virscsitest.c -@@ -33,18 +33,34 @@ VIR_LOG_INIT("tests.scsitest"); - - static char *virscsi_prefix; - -+typedef struct { -+ const char *adapter; -+ unsigned int bus; -+ unsigned int target; -+ unsigned int unit; -+ const char *expectedName; -+} testGetDevNameData; -+ - static int --test1(const void *data G_GNUC_UNUSED) -+testGetDevName(const void *opaque) - { -+ const testGetDevNameData *data = opaque; - char *name = NULL; - int ret = -1; - - if (!(name = virSCSIDeviceGetDevName(virscsi_prefix, -- "scsi_host1", 0, 0, 0))) -+ data->adapter, -+ data->bus, -+ data->target, -+ data->unit))) - return -1; - -- if (STRNEQ(name, "sdh")) -+ if (STRNEQ(name, data->expectedName)) { -+ fprintf(stderr, -+ "SCSI dev name mismatch, expected %s got %s", -+ data->expectedName, name); - goto cleanup; -+ } - - ret = 0; - cleanup: -@@ -213,15 +229,27 @@ mymain(void) - - CREATE_SYMLINK("0-0-0-0", "0:0:0:0"); - CREATE_SYMLINK("1-0-0-0", "1:0:0:0"); -+ CREATE_SYMLINK("2-0-0-0", "2:0:0:0"); - CREATE_SYMLINK("sg0", "sg0"); -+ CREATE_SYMLINK("sg3", "sg3"); - CREATE_SYMLINK("sg8", "sg8"); - - VIR_FREE(virscsi_prefix); - - virscsi_prefix = g_strdup(tmpdir); - -- if (virTestRun("test1", test1, NULL) < 0) -- ret = -1; -+#define TEST_GET_DEV_NAME(adapter, bus, target, unit, expectedName) \ -+ do { \ -+ testGetDevNameData data = {adapter, bus, target, unit, expectedName}; \ -+ if (virTestRun("test getDevname " expectedName, \ -+ testGetDevName, &data) < 0) \ -+ ret = -1; \ -+ } while (0) -+ -+ TEST_GET_DEV_NAME("scsi_host0", 0, 0, 0, "sda"); -+ TEST_GET_DEV_NAME("scsi_host1", 0, 0, 0, "sdh"); -+ TEST_GET_DEV_NAME("scsi_host2", 0, 0, 0, "st0"); -+ - if (virTestRun("test2", test2, NULL) < 0) - ret = -1; - --- -2.32.0 - diff --git a/libvirt-RHEL-virutil-Accept-non-block-devices-in-virGetDeviceID.patch b/libvirt-RHEL-virutil-Accept-non-block-devices-in-virGetDeviceID.patch deleted file mode 100644 index fa50bcb..0000000 --- a/libvirt-RHEL-virutil-Accept-non-block-devices-in-virGetDeviceID.patch +++ /dev/null @@ -1,37 +0,0 @@ -From b6045e61d3402cccba88e1b3be55871603c61d4f Mon Sep 17 00:00:00 2001 -Message-Id: -From: Michal Privoznik -Date: Fri, 6 Mar 2020 15:52:24 +0100 -Subject: [PATCH] RHEL: virutil: Accept non-block devices in virGetDeviceID() - -If a caller wants to learn major or minor number for a device, -let them. There's no need to check if the device is a block -device here. - -https://bugzilla.redhat.com/show_bug.cgi?id=1808390 - -Signed-off-by: Michal Privoznik -Signed-off-by: Andrea Bolognani -Message-Id: <20200306145226.1610708-5-abologna@redhat.com> -Reviewed-by: Jiri Denemark ---- - src/util/virutil.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/src/util/virutil.c b/src/util/virutil.c -index 50ed1cabab..2e5a6abff2 100644 ---- a/src/util/virutil.c -+++ b/src/util/virutil.c -@@ -1338,9 +1338,6 @@ virGetDeviceID(const char *path, int *maj, int *min) - if (stat(path, &sb) < 0) - return -errno; - -- if (!S_ISBLK(sb.st_mode)) -- return -EINVAL; -- - if (maj) - *maj = major(sb.st_rdev); - if (min) --- -2.32.0 - diff --git a/libvirt.spec b/libvirt.spec index ff5b96e..948a3a4 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -192,7 +192,7 @@ %if 0%{?rhel} %define enable_werror -Dwerror=true %else - %define enable_werror -Dwerror=false + %define enable_werror -Dwerror=false -Dgit_werror=disabled %endif %define tls_priority "@LIBVIRT,SYSTEM" @@ -200,7 +200,7 @@ Summary: Library providing a simple virtualization API Name: libvirt -Version: 7.5.0 +Version: 7.6.0 Release: 1%{?dist}%{?extra_release} License: LGPLv2+ URL: https://libvirt.org/ @@ -212,13 +212,7 @@ Source: https://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz Source1: symlinks Patch1: libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch -Patch2: libvirt-RHEL-qemu-Add-ability-to-set-sgio-values-for-hostdev.patch -Patch3: libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch -Patch4: libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch -Patch5: libvirt-RHEL-virscsi-Support-TAPEs-in-virSCSIDeviceGetDevName.patch -Patch6: libvirt-RHEL-virscsi-Introduce-and-use-virSCSIDeviceGetUnprivSGIOSysfsPath.patch -Patch7: libvirt-RHEL-virutil-Accept-non-block-devices-in-virGetDeviceID.patch -Patch8: libvirt-RHEL-Enable-usage-of-x-blockdev-reopen.patch +Patch2: libvirt-RHEL-Enable-usage-of-x-blockdev-reopen.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -1929,6 +1923,12 @@ exit 0 %changelog +* Wed Aug 4 2021 Jiri Denemark - 7.6.0-1 +- Rebased to libvirt-7.6.0 (rhbz#1950948) +- The rebase also fixes the following bugs: + rhbz#1986509, rhbz#1984318, rhbz#1810661, rhbz#1977776, rhbz#1948433 + rhbz#1978526, rhbz#1976690 + * Wed Jul 14 2021 Jiri Denemark - 7.5.0-1 - Rebased to libvirt-7.5.0 (rhbz#1950948) - The rebase also fixes the following bugs: diff --git a/sources b/sources index 99e1ba6..ff3d19e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libvirt-7.5.0.tar.xz) = cf89800c8970b8b1373ee32cc49ea88b87e76b50fd134df5da354be83e0ef490e514f16425c1c16eb3989fbadd3ba7d9976972fbbae6cb40db3d2ae94863219d +SHA512 (libvirt-7.6.0.tar.xz) = bad6cc02af071ca909bbbe3c07165e91cad863c9a759b26d9cff6aed6ea5643bc723d2f3c61ad41436dffd4fd50389333d74b131e37eaa54a5071a3ae26df627