Browse Source

import libvirt-8.0.0-5.module+el8.6.0+14480+c0a3aa0f

c8-stream-rhel imports/c8-stream-rhel/libvirt-8.0.0-5.module+el8.6.0+14480+c0a3aa0f
CentOS Sources 7 months ago
committed by Stepan Oksanichenko
parent
commit
9612d948f4
  1. 2
      .gitignore
  2. 2
      .libvirt.metadata
  3. 2173
      SOURCES/libvirt-Add-testdata-for-AMD-EPYC-7502.patch
  4. 456
      SOURCES/libvirt-Allow-NUMA-nodes-without-vCPUs.patch
  5. 37
      SOURCES/libvirt-RHEL-Add-rhel-machine-types-to-qemuDomainMachineNeedsFDC.patch
  6. 257
      SOURCES/libvirt-RHEL-Enable-usage-of-x-blockdev-reopen.patch
  7. 10
      SOURCES/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch
  8. 153
      SOURCES/libvirt-RHEL-Hack-around-changed-Broadwell-Haswell-CPUs.patch
  9. 89
      SOURCES/libvirt-RHEL-Remove-glib-2.64.0-workaround-for-GSource-race.patch
  10. 52
      SOURCES/libvirt-RHEL-qemu-Add-ability-to-set-sgio-values-for-hostdev.patch
  11. 17
      SOURCES/libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch
  12. 53
      SOURCES/libvirt-RHEL-qemu-Alter-qemuSetUnprivSGIO-hostdev-shareable-logic.patch
  13. 60
      SOURCES/libvirt-RHEL-qemu-Alter-val-usage-in-qemuSetUnprivSGIO.patch
  14. 45
      SOURCES/libvirt-RHEL-qemu-Fix-crash-trying-to-use-iSCSI-hostdev.patch
  15. 59
      SOURCES/libvirt-RHEL-qemu-Fix-logic-error-in-qemuSetUnprivSGIO.patch
  16. 42
      SOURCES/libvirt-RHEL-qemuCheckUnprivSGIO-use-sysfs_path-to-get-unpriv_sgio.patch
  17. 170
      SOURCES/libvirt-RHEL-qemuSetUnprivSGIO-Actually-use-calculated-sysfs_path-to-set-unpriv_sgio.patch
  18. 71
      SOURCES/libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch
  19. 185
      SOURCES/libvirt-RHEL-virscsi-Introduce-and-use-virSCSIDeviceGetUnprivSGIOSysfsPath.patch
  20. 36
      SOURCES/libvirt-RHEL-virscsi-Support-TAPEs-in-virSCSIDeviceGetDevName.patch
  21. 10
      SOURCES/libvirt-RHEL-virutil-Accept-non-block-devices-in-virGetDeviceID.patch
  22. 63
      SOURCES/libvirt-RNG-Allow-interleaving-of-domain-cpu-numa-cell-children.patch
  23. 62
      SOURCES/libvirt-Remove-checking-of-return-value-of-virHashNew.patch
  24. 109
      SOURCES/libvirt-Remove-qemuDomainSecretInfoNew.patch
  25. 103
      SOURCES/libvirt-Revert-report-error-when-virProcessGetStatInfo-is-unable-to-parse-data.patch
  26. 45
      SOURCES/libvirt-api-disallow-virDomainAgentSetResponseTimeout-on-read-only-connections.patch
  27. 146
      SOURCES/libvirt-cgroup-use-virCgroupSetCpuShares-instead-of-virCgroupSetupCpuShares.patch
  28. 77
      SOURCES/libvirt-check-for-NULL-before-calling-g_regex_unref.patch
  29. 449
      SOURCES/libvirt-conf-Add-support-for-cookies-for-HTTP-based-disks.patch
  30. 160
      SOURCES/libvirt-conf-Add-support-for-http-s-query-strings.patch
  31. 242
      SOURCES/libvirt-conf-Add-support-for-modifying-ssl-validation-for-https-ftps-disks.patch
  32. 205
      SOURCES/libvirt-conf-Add-support-for-setting-timeout-and-readahead-size-for-network-disks.patch
  33. 58
      SOURCES/libvirt-conf-Don-t-format-http-cookies-unless-VIR_DOMAIN_DEF_FORMAT_SECURE-is-used.patch
  34. 97
      SOURCES/libvirt-conf-Don-t-generate-machine-names-with-a-dot.patch
  35. 143
      SOURCES/libvirt-conf-Implement-support-for-slices-of-disk-source.patch
  36. 129
      SOURCES/libvirt-conf-Introduce-VIR_DOMAIN_TIMER_NAME_ARMVTIMER.patch
  37. 357
      SOURCES/libvirt-conf-Move-and-rename-virDomainParseScaledValue.patch
  38. 877
      SOURCES/libvirt-conf-Parse-and-format-HMAT.patch
  39. 166
      SOURCES/libvirt-conf-Validate-NUMA-HMAT-configuration.patch
  40. 87
      SOURCES/libvirt-conf-add-new-PCI_CONNECT-flag-AUTOASSIGN.patch
  41. 1510
      SOURCES/libvirt-conf-add-support-for-specifying-CPU-dies-parameter.patch
  42. 395
      SOURCES/libvirt-conf-add-virtiofs-related-elements-and-attributes.patch
  43. 146
      SOURCES/libvirt-conf-backup-Allow-configuration-of-names-exported-via-NBD.patch
  44. 67
      SOURCES/libvirt-conf-backup-Store-incremental-backup-checkpoint-name-per-disk.patch
  45. 51
      SOURCES/libvirt-conf-check-HOTPLUGGABLE-connect-flag-when-validating-a-PCI-address.patch
  46. 70
      SOURCES/libvirt-conf-do-not-generate-machine-names-ending-with-a-dash.patch
  47. 73
      SOURCES/libvirt-conf-domain-Remove-checking-of-return-value-of-virHashCreateFull.patch
  48. 47
      SOURCES/libvirt-conf-during-PCI-hotplug-require-that-the-controller-support-hotplug.patch
  49. 415
      SOURCES/libvirt-conf-introduce-support-for-firmware-auto-selection-feature-filtering.patch
  50. 124
      SOURCES/libvirt-conf-introduce-virDomainDefParseBootAcpiOptions.patch
  51. 86
      SOURCES/libvirt-conf-introduce-virDomainDefParseBootFirmwareOptions.patch
  52. 173
      SOURCES/libvirt-conf-introduce-virDomainDefParseBootInitOptions.patch
  53. 60
      SOURCES/libvirt-conf-introduce-virDomainDefParseBootKernelOptions.patch
  54. 97
      SOURCES/libvirt-conf-introduce-virDomainDefParseBootLoaderOptions.patch
  55. 290
      SOURCES/libvirt-conf-new-attribute-hotplug-for-pci-controllers.patch
  56. 468
      SOURCES/libvirt-conf-parse-format-teaming-subelement-of-interface.patch
  57. 117
      SOURCES/libvirt-conf-properly-clear-out-autogenerated-macvtap-names-when-formatting-parsing.patch
  58. 327
      SOURCES/libvirt-conf-qemu-add-virtiofs-fsdriver-type.patch
  59. 161
      SOURCES/libvirt-conf-qemu-s-VIR_PCI_CONNECT_HOTPLUGGABLE-VIR_PCI_CONNECT_AUTOASSIGN-g.patch
  60. 317
      SOURCES/libvirt-conf-remove-duplicated-firmware-type-attribute.patch
  61. 88
      SOURCES/libvirt-conf-remove-unused-virCapabilitiesSetHostCPU-method.patch
  62. 144
      SOURCES/libvirt-conf-rename-namespace-property-of-struct-_virStorageSourceNVMeDef.patch
  63. 83
      SOURCES/libvirt-conf-simplify-logic-when-checking-for-AUTOASSIGN-PCI-addresses.patch
  64. 89
      SOURCES/libvirt-conf-use-switch-in-virDomainDefParseBootOptions.patch
  65. 70
      SOURCES/libvirt-conf-use-virXMLFormatElement-in-virDomainFSDefFormat.patch
  66. 53
      SOURCES/libvirt-cpu-Change-control-flow-in-virCPUUpdateLive.patch
  67. 100
      SOURCES/libvirt-cpu-Honor-check-full-for-host-passthrough-CPUs.patch
  68. 41
      SOURCES/libvirt-cpu.c-Check-properly-for-virCapabilitiesGetNodeInfo-retval.patch
  69. 80
      SOURCES/libvirt-cpu_conf-Format-vendor_id-for-host-model-CPUs.patch
  70. 289
      SOURCES/libvirt-cpu_map-Add-Cooperlake-x86-CPU-model.patch
  71. 145
      SOURCES/libvirt-cpu_map-Add-EPYC-Milan-x86-CPU-model.patch
  72. 749
      SOURCES/libvirt-cpu_map-Add-decode-element-to-x86-CPU-model-definitions.patch
  73. 896
      SOURCES/libvirt-cpu_map-Add-missing-AMD-SVM-features.patch
  74. 107
      SOURCES/libvirt-cpu_map-Add-missing-x86-features-in-0x7-CPUID-leaf.patch
  75. 224
      SOURCES/libvirt-cpu_map-Add-missing-x86-features-in-0x80000008-CPUID-leaf.patch
  76. 831
      SOURCES/libvirt-cpu_map-Add-more-noTSX-x86-CPU-models.patch
  77. 212
      SOURCES/libvirt-cpu_map-Add-pschange-mc-no-bit-in-IA32_ARCH_CAPABILITIES-MSR.patch
  78. 76
      SOURCES/libvirt-cpu_map-Add-support-for-core-capability-CPU-feature.patch
  79. 76
      SOURCES/libvirt-cpu_map-Add-support-for-fsrm-CPU-feature.patch
  80. 72
      SOURCES/libvirt-cpu_map-Add-support-for-split-lock-detect-CPU-feature.patch
  81. 373
      SOURCES/libvirt-cpu_map-Define-and-enable-Snowridge-model.patch
  82. 310
      SOURCES/libvirt-cpu_map-Defined-and-enable-EPYC-Rome-model.patch
  83. 154
      SOURCES/libvirt-cpu_map-Distinguish-Cascadelake-Server-from-Skylake-Server.patch
  84. 37
      SOURCES/libvirt-cpu_map-Distribute-x86_Cooperlake.xml.patch
  85. 137
      SOURCES/libvirt-cpu_map-Don-t-use-new-noTSX-models-for-host-model-CPUs.patch
  86. 52
      SOURCES/libvirt-cpu_map-Fix-Icelake-Server-model-number.patch
  87. 59
      SOURCES/libvirt-cpu_map-Fix-spelling-of-svme-addr-chk-feature.patch
  88. 41
      SOURCES/libvirt-cpu_map-Install-x86_EPYC-Milan.xml.patch
  89. 90
      SOURCES/libvirt-cpu_map-Remove-monitor-feature-from-EPYC-Rome.patch
  90. 183
      SOURCES/libvirt-cpu_x86-Add-support-for-stepping-part-of-CPU-signature.patch
  91. 74
      SOURCES/libvirt-cpu_x86-Don-t-check-return-value-of-x86ModelCopy.patch
  92. 102
      SOURCES/libvirt-cpu_x86-Drop-noTSX-hint-for-incompatible-CPUs.patch
  93. 67
      SOURCES/libvirt-cpu_x86-Honor-CPU-models-decode-element.patch
  94. 71
      SOURCES/libvirt-cpu_x86-Introduce-virCPUx86SignatureFromCPUID.patch
  95. 64
      SOURCES/libvirt-cpu_x86-Introduce-virCPUx86SignaturesFree.patch
  96. 97
      SOURCES/libvirt-cpu_x86-Move-and-rename-x86FormatSignatures.patch
  97. 100
      SOURCES/libvirt-cpu_x86-Move-and-rename-x86ModelCopySignatures.patch
  98. 101
      SOURCES/libvirt-cpu_x86-Move-and-rename-x86ModelHasSignature.patch
  99. 59
      SOURCES/libvirt-cpu_x86-Prepare-virCPUx86UpdateLive-for-easier-extension.patch
  100. 325
      SOURCES/libvirt-cpu_x86-Replace-32b-signatures-in-virCPUx86Model-with-a-struct.patch

2
.gitignore

@ -1 +1 @@
SOURCES/libvirt-6.0.0.tar.xz
SOURCES/libvirt-8.0.0.tar.xz

2
.libvirt.metadata

@ -1 +1 @@
9939a559e652d44b27e3404a26bcabe58988e4b4 SOURCES/libvirt-6.0.0.tar.xz
e440412e9b45d7e24f0ef492d8edf5cf2cbd3f4c SOURCES/libvirt-8.0.0.tar.xz

2173
SOURCES/libvirt-Add-testdata-for-AMD-EPYC-7502.patch
File diff suppressed because it is too large
View File

456
SOURCES/libvirt-Allow-NUMA-nodes-without-vCPUs.patch

@ -1,456 +0,0 @@
From 5f6723e71e3765d1d43bfa9ba1c66e0e05e11a48 Mon Sep 17 00:00:00 2001
Message-Id: <5f6723e71e3765d1d43bfa9ba1c66e0e05e11a48@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 9 Nov 2020 17:22:32 +0100
Subject: [PATCH] Allow NUMA nodes without vCPUs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
QEMU allows creating NUMA nodes that have memory only.
These are somehow important for HMAT.
With check done in qemuValidateDomainDef() for QEMU 2.7 or newer
(checked via QEMU_CAPS_NUMA), we can be sure that the vCPUs are
fully assigned to NUMA nodes in domain XML.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
(cherry picked from commit a26f61ee0cffa421b87ef568002b684dd8025432)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749518
Conflicts:
- src/qemu/qemu_validate.c: This file doesn't exist in downstream
yet, so I've moved the change that original patch would do to
qemu_domain.c where the validator lives.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <365508c75e579e9037ad555d6c372068ccd50c95.1604938867.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
docs/formatdomain.html.in | 2 +
docs/schemas/cputypes.rng | 8 ++-
src/conf/numa_conf.c | 59 ++++++++++---------
src/libxl/xen_xl.c | 10 ++--
src/qemu/qemu_command.c | 26 ++++----
src/qemu/qemu_domain.c | 22 +++----
tests/qemuxml2argvdata/numatune-no-vcpu.args | 33 +++++++++++
tests/qemuxml2argvdata/numatune-no-vcpu.xml | 42 +++++++++++++
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmloutdata/numatune-no-vcpu.xml | 1 +
tests/qemuxml2xmltest.c | 1 +
11 files changed, 149 insertions(+), 56 deletions(-)
create mode 100644 tests/qemuxml2argvdata/numatune-no-vcpu.args
create mode 100644 tests/qemuxml2argvdata/numatune-no-vcpu.xml
create mode 120000 tests/qemuxml2xmloutdata/numatune-no-vcpu.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 76799f5ffc..4b8d312596 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1783,6 +1783,8 @@
<code>cpus</code> specifies the CPU or range of CPUs that are
part of the node. <code>memory</code> specifies the node memory
in kibibytes (i.e. blocks of 1024 bytes).
+ <span class="since">Since 6.6.0</span> the <code>cpus</code> attribute
+ is optional and if omitted a CPU-less NUMA node is created.
<span class="since">Since 1.2.11</span> one can use an additional <a
href="#elementsMemoryAllocation"><code>unit</code></a> attribute to
define units in which <code>memory</code> is specified.
diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng
index e2744acad3..a1682a1003 100644
--- a/docs/schemas/cputypes.rng
+++ b/docs/schemas/cputypes.rng
@@ -115,9 +115,11 @@
<ref name="unsignedInt"/>
</attribute>
</optional>
- <attribute name="cpus">
- <ref name="cpuset"/>
- </attribute>
+ <optional>
+ <attribute name="cpus">
+ <ref name="cpuset"/>
+ </attribute>
+ </optional>
<attribute name="memory">
<ref name="memoryKB"/>
</attribute>
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index c9cc8ac22e..a805336d16 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -889,32 +889,28 @@ virDomainNumaDefParseXML(virDomainNumaPtr def,
}
VIR_FREE(tmp);
- if (def->mem_nodes[cur_cell].cpumask) {
+ if (def->mem_nodes[cur_cell].mem) {
virReportError(VIR_ERR_XML_ERROR,
_("Duplicate NUMA cell info for cell id '%u'"),
cur_cell);
goto cleanup;
}
- if (!(tmp = virXMLPropString(nodes[i], "cpus"))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("Missing 'cpus' attribute in NUMA cell"));
- goto cleanup;
- }
+ if ((tmp = virXMLPropString(nodes[i], "cpus"))) {
+ g_autoptr(virBitmap) cpumask = NULL;
- if (virBitmapParse(tmp, &def->mem_nodes[cur_cell].cpumask,
- VIR_DOMAIN_CPUMASK_LEN) < 0)
- goto cleanup;
+ if (virBitmapParse(tmp, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ goto cleanup;
- if (virBitmapIsAllClear(def->mem_nodes[cur_cell].cpumask)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("NUMA cell %d has no vCPUs assigned"), cur_cell);
- goto cleanup;
+ if (!virBitmapIsAllClear(cpumask))
+ def->mem_nodes[cur_cell].cpumask = g_steal_pointer(&cpumask);
+ VIR_FREE(tmp);
}
- VIR_FREE(tmp);
for (j = 0; j < n; j++) {
- if (j == cur_cell || !def->mem_nodes[j].cpumask)
+ if (j == cur_cell ||
+ !def->mem_nodes[j].cpumask ||
+ !def->mem_nodes[cur_cell].cpumask)
continue;
if (virBitmapOverlaps(def->mem_nodes[j].cpumask,
@@ -976,7 +972,6 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
{
virDomainMemoryAccess memAccess;
virTristateBool discard;
- char *cpustr;
size_t ncells = virDomainNumaGetNodeCount(def);
size_t i;
@@ -986,17 +981,22 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
virBufferAddLit(buf, "<numa>\n");
virBufferAdjustIndent(buf, 2);
for (i = 0; i < ncells; i++) {
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(def, i);
int ndistances;
memAccess = virDomainNumaGetNodeMemoryAccessMode(def, i);
discard = virDomainNumaGetNodeDiscard(def, i);
- if (!(cpustr = virBitmapFormat(virDomainNumaGetNodeCpumask(def, i))))
- return -1;
-
virBufferAddLit(buf, "<cell");
virBufferAsprintf(buf, " id='%zu'", i);
- virBufferAsprintf(buf, " cpus='%s'", cpustr);
+
+ if (cpumask) {
+ g_autofree char *cpustr = virBitmapFormat(cpumask);
+
+ if (!cpustr)
+ return -1;
+ virBufferAsprintf(buf, " cpus='%s'", cpustr);
+ }
virBufferAsprintf(buf, " memory='%llu'",
virDomainNumaGetNodeMemorySize(def, i));
virBufferAddLit(buf, " unit='KiB'");
@@ -1032,8 +1032,6 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</cell>\n");
}
-
- VIR_FREE(cpustr);
}
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</numa>\n");
@@ -1048,8 +1046,12 @@ virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa)
size_t i;
unsigned int ret = 0;
- for (i = 0; i < numa->nmem_nodes; i++)
- ret += virBitmapCountBits(virDomainNumaGetNodeCpumask(numa, i));
+ for (i = 0; i < numa->nmem_nodes; i++) {
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(numa, i);
+
+ if (cpumask)
+ ret += virBitmapCountBits(cpumask);
+ }
return ret;
}
@@ -1061,11 +1063,14 @@ virDomainNumaGetMaxCPUID(virDomainNumaPtr numa)
unsigned int ret = 0;
for (i = 0; i < numa->nmem_nodes; i++) {
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(numa, i);
int bit;
- bit = virBitmapLastSetBit(virDomainNumaGetNodeCpumask(numa, i));
- if (bit > ret)
- ret = bit;
+ if (cpumask) {
+ bit = virBitmapLastSetBit(cpumask);
+ if (bit > ret)
+ ret = bit;
+ }
}
return ret;
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index edea30a86a..752fa925ec 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -1443,19 +1443,21 @@ xenFormatXLVnuma(virConfValuePtr list,
{
int ret = -1;
size_t i;
-
virBuffer buf = VIR_BUFFER_INITIALIZER;
virConfValuePtr numaVnode, tmp;
-
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(numa, node);
size_t nodeSize = virDomainNumaGetNodeMemorySize(numa, node) / 1024;
- char *nodeVcpus = virBitmapFormat(virDomainNumaGetNodeCpumask(numa, node));
+ g_autofree char *nodeVcpus = NULL;
- if (VIR_ALLOC(numaVnode) < 0)
+ if (!cpumask ||
+ VIR_ALLOC(numaVnode) < 0)
goto cleanup;
numaVnode->type = VIR_CONF_LIST;
numaVnode->list = NULL;
+ nodeVcpus = virBitmapFormat(cpumask);
+
/* pnode */
virBufferAsprintf(&buf, "pnode=%zu", node);
xenFormatXLVnode(numaVnode, &buf);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1a573c2817..ac63d18a42 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7364,8 +7364,6 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
size_t i, j;
virQEMUCapsPtr qemuCaps = priv->qemuCaps;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- char *cpumask = NULL;
- char *tmpmask = NULL;
char *next = NULL;
virBufferPtr nodeBackends = NULL;
bool needBackend = false;
@@ -7400,9 +7398,7 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
goto cleanup;
for (i = 0; i < ncells; i++) {
- VIR_FREE(cpumask);
- if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->numa, i))))
- goto cleanup;
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(def->numa, i);
if (needBackend) {
virCommandAddArg(cmd, "-object");
@@ -7412,11 +7408,19 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
virCommandAddArg(cmd, "-numa");
virBufferAsprintf(&buf, "node,nodeid=%zu", i);
- for (tmpmask = cpumask; tmpmask; tmpmask = next) {
- if ((next = strchr(tmpmask, ',')))
- *(next++) = '\0';
- virBufferAddLit(&buf, ",cpus=");
- virBufferAdd(&buf, tmpmask, -1);
+ if (cpumask) {
+ g_autofree char *cpumaskStr = NULL;
+ char *tmpmask;
+
+ if (!(cpumaskStr = virBitmapFormat(cpumask)))
+ goto cleanup;
+
+ for (tmpmask = cpumaskStr; tmpmask; tmpmask = next) {
+ if ((next = strchr(tmpmask, ',')))
+ *(next++) = '\0';
+ virBufferAddLit(&buf, ",cpus=");
+ virBufferAdd(&buf, tmpmask, -1);
+ }
}
if (needBackend)
@@ -7447,8 +7451,6 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
ret = 0;
cleanup:
- VIR_FREE(cpumask);
-
if (nodeBackends) {
for (i = 0; i < ncells; i++)
virBufferFreeAndReset(&nodeBackends[i]);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 35b536868a..be25790f12 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5373,7 +5373,7 @@ qemuDomainDefValidateNuma(const virDomainDef *def,
}
for (i = 0; i < ncells; i++) {
- g_autofree char * cpumask = NULL;
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(def->numa, i);
if (!hasMemoryCap &&
virDomainNumaGetNodeMemoryAccessMode(def->numa, i)) {
@@ -5383,17 +5383,19 @@ qemuDomainDefValidateNuma(const virDomainDef *def,
return -1;
}
- if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->numa, i))))
- return -1;
+ if (cpumask) {
+ g_autofree char * cpumaskStr = NULL;
+ if (!(cpumaskStr = virBitmapFormat(cpumask)))
+ return -1;
- if (strchr(cpumask, ',') &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("disjoint NUMA cpu ranges are not supported "
- "with this QEMU"));
- return -1;
+ if (strchr(cpumaskStr, ',') &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("disjoint NUMA cpu ranges are not supported "
+ "with this QEMU"));
+ return -1;
+ }
}
-
}
if (virDomainNumaNodesDistancesAreBeingSet(def->numa) &&
diff --git a/tests/qemuxml2argvdata/numatune-no-vcpu.args b/tests/qemuxml2argvdata/numatune-no-vcpu.args
new file mode 100644
index 0000000000..a1f1ee044e
--- /dev/null
+++ b/tests/qemuxml2argvdata/numatune-no-vcpu.args
@@ -0,0 +1,33 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name QEMUGuest \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 12288 \
+-realtime mlock=off \
+-smp 12,sockets=12,cores=1,threads=1 \
+-numa node,nodeid=0,cpus=0-3,mem=2048 \
+-numa node,nodeid=1,cpus=4-7,mem=2048 \
+-numa node,nodeid=2,cpus=8-11,mem=2048 \
+-numa node,nodeid=3,mem=2048 \
+-numa node,nodeid=4,mem=2048 \
+-numa node,nodeid=5,mem=2048 \
+-uuid c7a5fdb2-cdaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-usb \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/numatune-no-vcpu.xml b/tests/qemuxml2argvdata/numatune-no-vcpu.xml
new file mode 100644
index 0000000000..f25a07d7ed
--- /dev/null
+++ b/tests/qemuxml2argvdata/numatune-no-vcpu.xml
@@ -0,0 +1,42 @@
+<domain type='qemu'>
+ <name>QEMUGuest</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>12582912</memory>
+ <currentMemory unit='KiB'>12582912</currentMemory>
+ <vcpu placement='static'>12</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <cpu>
+ <numa>
+ <cell id='0' cpus='0-3' memory='2097152' unit='KiB'/>
+ <cell id='1' cpus='4-7' memory='2097152' unit='KiB'/>
+ <cell id='2' cpus='8-11' memory='2097152' unit='KiB'/>
+ <cell id='3' memory='2097152' unit='KiB'/>
+ <cell id='4' memory='2097152' unit='KiB'/>
+ <cell id='5' memory='2097152' unit='KiB'/>
+ </numa>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ff92af606d..49699e495d 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1812,6 +1812,7 @@ mymain(void)
DO_TEST_PARSE_ERROR("numatune-memnode-no-memory", NONE);
DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);
+ DO_TEST("numatune-no-vcpu", NONE);
DO_TEST("numatune-auto-nodeset-invalid", NONE);
DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM,
diff --git a/tests/qemuxml2xmloutdata/numatune-no-vcpu.xml b/tests/qemuxml2xmloutdata/numatune-no-vcpu.xml
new file mode 120000
index 0000000000..f213032685
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/numatune-no-vcpu.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/numatune-no-vcpu.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 6c3f5c4a9e..1ddeba30f0 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1105,6 +1105,7 @@ mymain(void)
DO_TEST("numatune-memnode", QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("numatune-memnode-no-memory", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);
+ DO_TEST("numatune-no-vcpu", QEMU_CAPS_NUMA);
DO_TEST("bios-nvram", NONE);
DO_TEST("bios-nvram-os-interleave", NONE);
--
2.29.2

37
SOURCES/libvirt-RHEL-Add-rhel-machine-types-to-qemuDomainMachineNeedsFDC.patch

@ -1,5 +1,5 @@
From a04fcb5b463c90c47705ca0f28e40b73c00b6b72 Mon Sep 17 00:00:00 2001
Message-Id: <a04fcb5b463c90c47705ca0f28e40b73c00b6b72@dist-git>
From f0d0a6a9701522eee013682eb0ef566ef7cdac61 Mon Sep 17 00:00:00 2001
Message-Id: <f0d0a6a9701522eee013682eb0ef566ef7cdac61@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Mon, 22 Feb 2016 12:51:51 +0100
Subject: [PATCH] RHEL: Add rhel machine types to qemuDomainMachineNeedsFDC
@ -13,24 +13,35 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1227880
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_domain.c | 4 ++++
1 file changed, 4 insertions(+)
src/qemu/qemu_domain.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a6dde15bad..0edf316fff 100644
index a8401bac30..40fe9985e6 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12631,6 +12631,10 @@ qemuDomainMachineNeedsFDC(const char *machine,
return false;
}
+ if (STRPREFIX(p, "rhel7.0.0") ||
+ STRPREFIX(p, "rhel7.1.0"))
@@ -8767,8 +8767,19 @@ qemuDomainHasBuiltinIDE(const virDomainDef *def)
bool
qemuDomainNeedsFDC(const virDomainDef *def)
{
- /* all supported Q35 machines need explicit FDC */
- return qemuDomainIsQ35(def);
+ const char *p;
+
+ /* all supported Q35 machines need explicit FDC except for old RHEL-7
+ * machine types */
+ if (!qemuDomainIsQ35(def))
+ return false;
+
return true;
+ if ((p = STRSKIP(def->os.machine, "pc-q35-")) &&
+ (STRPREFIX(p, "rhel7.0.0") ||
+ STRPREFIX(p, "rhel7.1.0")))
+ return false;
+
+ return true;
}
--
2.25.0
2.34.1

257
SOURCES/libvirt-RHEL-Enable-usage-of-x-blockdev-reopen.patch

@ -0,0 +1,257 @@
From b2529d5ff3a18a2b0022da75431cea5bf037819e Mon Sep 17 00:00:00 2001
Message-Id: <b2529d5ff3a18a2b0022da75431cea5bf037819e@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
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
Content-Transfer-Encoding: 8bit
RHEL-only
Introduce a new capability QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API
based on the presence of '__com.redhat_rhel-av-8_2_0-api' feature for
'x-blockdev-reopen' which states that reopen works for what libvirt
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=1799013
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 <jtomko@redhat.com>
---
src/qemu/qemu_block.c | 24 +++++++++++++++---------
src/qemu/qemu_block.h | 3 ++-
src/qemu/qemu_capabilities.c | 13 +++++++++++++
src/qemu/qemu_capabilities.h | 3 +++
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 ++-
tests/qemumonitorjsontest.c | 2 +-
9 files changed, 50 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index e5ff653a60..aa566d0097 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3331,7 +3331,8 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc,
int
qemuBlockReopenFormatMon(qemuMonitor *mon,
- virStorageSource *src)
+ virStorageSource *src,
+ bool downstream)
{
g_autoptr(virJSONValue) reopenprops = NULL;
g_autoptr(virJSONValue) srcprops = NULL;
@@ -3340,15 +3341,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 (virJSONValueObjectAdd(&reopenprops,
- "a:options", &reopenoptions,
- NULL) < 0)
- return -1;
+ if (virJSONValueObjectAdd(&reopenprops,
+ "a:options", &reopenoptions,
+ NULL) < 0)
+ return -1;
+ }
- if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0)
+ if (qemuMonitorBlockdevReopen(mon, &reopenprops, downstream) < 0)
return -1;
return 0;
@@ -3372,6 +3377,7 @@ qemuBlockReopenFormat(virDomainObj *vm,
{
qemuDomainObjPrivate *priv = vm->privateData;
virQEMUDriver *driver = priv->driver;
+ 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
@@ -3385,7 +3391,7 @@ qemuBlockReopenFormat(virDomainObj *vm,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
- rc = qemuBlockReopenFormatMon(priv->mon, src);
+ rc = qemuBlockReopenFormatMon(priv->mon, src, downstream);
qemuDomainObjExitMonitor(driver, vm);
if (rc < 0)
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 184a549d5c..130cfcdefd 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -267,7 +267,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 5f1eb5014c..8ae80ef8d7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -654,6 +654,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
"rbd-encryption", /* QEMU_CAPS_RBD_ENCRYPTION */
"sev-guest-kernel-hashes", /* QEMU_CAPS_SEV_GUEST_KERNEL_HASHES */
"sev-inject-launch-secret", /* QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET */
+
+ /* 420 */
+ "blockdev-reopen.__com.redhat_rhel-av-8_2_0-api", /* QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API */
);
@@ -1540,6 +1543,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVhostUserFS[] =
/* see documentation for virQEMUQAPISchemaPathGet for the query format */
static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
{ "block-commit/arg-type/*top", QEMU_CAPS_ACTIVE_COMMIT },
+ { "x-blockdev-reopen/$__com.redhat_rhel-av-8_2_0-api", QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API },
{ "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},
@@ -5235,6 +5239,15 @@ virQEMUCapsInitProcessCaps(virQEMUCaps *qemuCaps)
qemuCaps->arch == VIR_ARCH_MIPS)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SCSI_NCR53C90);
+ /* RHEL-only:
+ * - if upstream blockdev-reopen is enabled, clear the downstream flag
+ * - if the downstream flag is present but not the upstream, assert the upstream flag too
+ */
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API))
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN);
+
virQEMUCapsInitProcessCapsInterlock(qemuCaps);
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index e3a3ab4445..cde6c18b4c 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -634,6 +634,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_SEV_GUEST_KERNEL_HASHES, /* sev-guest.kernel-hashes= */
QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET, /* 'sev-inject-launch-secret' qmp command present */
+ /* 420 */
+ 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 babf9e62fb..23638d3fe8 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4247,14 +4247,15 @@ qemuMonitorBlockdevAdd(qemuMonitor *mon,
int
qemuMonitorBlockdevReopen(qemuMonitor *mon,
- virJSONValue **props)
+ virJSONValue **props,
+ bool downstream)
{
VIR_DEBUG("props=%p (node-name=%s)", *props,
NULLSTR(virJSONValueObjectGetString(*props, "node-name")));
QEMU_CHECK_MONITOR(mon);
- return qemuMonitorJSONBlockdevReopen(mon, props);
+ return qemuMonitorJSONBlockdevReopen(mon, props, downstream);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 9b2e4e1421..d2037914be 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1426,7 +1426,8 @@ int qemuMonitorBlockdevAdd(qemuMonitor *mon,
virJSONValue **props);
int qemuMonitorBlockdevReopen(qemuMonitor *mon,
- virJSONValue **props);
+ virJSONValue **props,
+ bool downstream);
int qemuMonitorBlockdevDel(qemuMonitor *mon,
const char *nodename);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index b0b513683b..34a46b9b41 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -8051,13 +8051,19 @@ qemuMonitorJSONBlockdevAdd(qemuMonitor *mon,
int
qemuMonitorJSONBlockdevReopen(qemuMonitor *mon,
- virJSONValue **props)
+ virJSONValue **props,
+ bool downstream)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", props)))
- return -1;
+ if (downstream) {
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("x-blockdev-reopen", props)))
+ return -1;
+ } else {
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", props)))
+ return -1;
+ }
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
return -1;
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 64d9ebdaa3..15ce03d7af 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -748,7 +748,8 @@ qemuMonitorJSONBlockdevAdd(qemuMonitor *mon,
int
qemuMonitorJSONBlockdevReopen(qemuMonitor *mon,
- virJSONValue **props)
+ virJSONValue **props,
+ bool downstream)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 48e2a457ab..8624a547b5 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2780,7 +2780,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.34.1

10
SOURCES/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch

@ -1,5 +1,5 @@
From 3e50b013277c7fa05987ceba440f8c4583b6c634 Mon Sep 17 00:00:00 2001
Message-Id: <3e50b013277c7fa05987ceba440f8c4583b6c634@dist-git>
From 29eb7b77805cf5fb756c964cdbe7fb7fb2c01f5f Mon Sep 17 00:00:00 2001
Message-Id: <29eb7b77805cf5fb756c964cdbe7fb7fb2c01f5f@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Mon, 27 Aug 2018 13:09:38 +0200
Subject: [PATCH] RHEL: Fix virConnectGetMaxVcpus output
@ -26,10 +26,10 @@ Reviewed-by: Andrea Bolognani <abologna@redhat.com>
1 file changed, 5 insertions(+)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 7f14340f49..256976cce1 100644
index a07c00a0e9..35f41daef2 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -1169,6 +1169,11 @@ virHostCPUGetKVMMaxVCPUs(void)
@@ -1166,6 +1166,11 @@ virHostCPUGetKVMMaxVCPUs(void)
return -1;
}
@ -42,5 +42,5 @@ index 7f14340f49..256976cce1 100644
/* at first try KVM_CAP_MAX_VCPUS to determine the maximum count */
if ((ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS)) > 0)
--
2.25.0
2.34.1

153
SOURCES/libvirt-RHEL-Hack-around-changed-Broadwell-Haswell-CPUs.patch

@ -1,5 +1,5 @@
From 0dd015e1aff1a56a4584824d1a97c9eacabf7f03 Mon Sep 17 00:00:00 2001
Message-Id: <0dd015e1aff1a56a4584824d1a97c9eacabf7f03@dist-git>
From 1d93a3944a200b7c955800faa598e0e11da098f8 Mon Sep 17 00:00:00 2001
Message-Id: <1d93a3944a200b7c955800faa598e0e11da098f8@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 27 Mar 2015 12:48:40 +0100
Subject: [PATCH] RHEL: Hack around changed Broadwell/Haswell CPUs
@ -18,34 +18,35 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1199446
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_command.c | 21 +++++++++++++++++++
src/qemu/qemu_command.c | 22 +++++++++++++++++++
tests/qemuxml2argvdata/cpu-Haswell.args | 2 +-
.../qemuxml2argvdata/cpu-host-model-cmt.args | 2 +-
.../cpu-translation.x86_64-4.0.0.args | 4 ++--
.../cpu-translation.x86_64-latest.args | 4 ++--
tests/qemuxml2argvdata/cpu-tsc-frequency.args | 4 ++--
.../cpu-translation.x86_64-4.0.0.args | 2 +-
.../cpu-translation.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-tsc-frequency.args | 2 +-
tests/qemuxml2argvdata/q35-acpi-nouefi.args | 2 +-
tests/qemuxml2argvdata/q35-acpi-uefi.args | 2 +-
tests/qemuxml2argvdata/q35-noacpi-nouefi.args | 2 +-
9 files changed, 32 insertions(+), 11 deletions(-)
9 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 904d2beab5..e10cc7fc74 100644
index d822533ccb..6b4647a711 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6469,6 +6469,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
@@ -6521,6 +6521,8 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver,
{
size_t i;
virCPUDefPtr cpu = def->cpu;
virCPUDef *cpu = def->cpu;
+ bool hle = false;
+ bool rtm = false;
switch ((virCPUMode) cpu->mode) {
case VIR_CPU_MODE_HOST_PASSTHROUGH:
@@ -6524,6 +6526,11 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id);
@@ -6587,6 +6589,12 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver,
for (i = 0; i < cpu->nfeatures; i++) {
const char *featname =
virQEMUCapsCPUFeatureToQEMU(qemuCaps, cpu->features[i].name);
+
+ if (STREQ("rtm", cpu->features[i].name))
+ rtm = true;
+ if (STREQ("hle", cpu->features[i].name))
@ -54,7 +55,7 @@ index 904d2beab5..e10cc7fc74 100644
switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
case VIR_CPU_FEATURE_FORCE:
case VIR_CPU_FEATURE_REQUIRE:
@@ -6541,6 +6548,20 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
@@ -6604,6 +6612,20 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver,
}
}
@ -67,124 +68,118 @@ index 904d2beab5..e10cc7fc74 100644
+ if (STREQ_NULLABLE(cpu->model, "Broadwell") ||
+ STREQ_NULLABLE(cpu->model, "Haswell")) {
+ if (!rtm)
+ qemuBuildCpuFeature(qemuCaps, buf, "rtm", true);
+ virBufferAddLit(buf, ",rtm=on");
+ if (!hle)
+ qemuBuildCpuFeature(qemuCaps, buf, "hle", true);
+ virBufferAddLit(buf, ",hle=on");
+ }
+
return 0;
}
diff --git a/tests/qemuxml2argvdata/cpu-Haswell.args b/tests/qemuxml2argvdata/cpu-Haswell.args
index a33b16f7ce..d35de5ea58 100644
index b57fdfddc5..965274c1f0 100644
--- a/tests/qemuxml2argvdata/cpu-Haswell.args
+++ b/tests/qemuxml2argvdata/cpu-Haswell.args
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name QEMUGuest1 \
-S \
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc,usb=off,dump-guest-core=off \
-accel kvm \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
+-cpu Haswell,rtm=on,hle=on \
-m 214 \
-realtime mlock=off \
-smp 6,sockets=6,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/cpu-host-model-cmt.args b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
index 42f969fd62..c8795acb3e 100644
index 0de04e877d..602f70de86 100644
--- a/tests/qemuxml2argvdata/cpu-host-model-cmt.args
+++ b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
@@ -12,7 +12,7 @@ QEMU_AUDIO_DRV=none \
-S \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
-+smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm \
++smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+rtm,+hle \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on \
+-cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on,rtm=on,hle=on \
-m 214 \
-realtime mlock=off \
-smp 6,sockets=6,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
index f8e19fca24..08c672fd2c 100644
index 09141106d5..ace08d5d76 100644
--- a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
@@ -14,8 +14,8 @@ QEMU_AUDIO_DRV=none \
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc-i440fx-4.0,accel=tcg,usb=off,dump-guest-core=off \
-cpu Haswell,pclmuldq=on,ds_cpl=on,tsc_adjust=on,fxsr_opt=on,lahf_lm=on,\
-cmp_legacy=on,nodeid_msr=on,perfctr_core=on,perfctr_nb=on,kvm_pv_eoi=on,\
-kvm_pv_unhalt=on \
+cmp_legacy=on,nodeid_msr=on,perfctr_core=on,perfctr_nb=on,rtm=on,hle=on,\
+kvm_pv_eoi=on,kvm_pv_unhalt=on \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc-i440fx-4.0,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
+-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
-m 214 \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
index 9322b826f4..1dbfc9553b 100644
index 2dab572a6b..a9f7c4b910 100644
--- a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
@@ -14,8 +14,8 @@ QEMU_AUDIO_DRV=none \
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,\
-cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,\
-kvm-pv-unhalt=on \
+cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,\
+kvm-pv-eoi=on,kvm-pv-unhalt=on \
@@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
-accel tcg \
--cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
+-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
-m 214 \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/cpu-tsc-frequency.args b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
index 55b72b4404..45a777d468 100644
index 4a032f5d85..48fb75abcc 100644
--- a/tests/qemuxml2argvdata/cpu-tsc-frequency.args
+++ b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
@@ -12,8 +12,8 @@ QEMU_AUDIO_DRV=none \
-S \
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
-+smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+invtsc,\
-tsc-frequency=3504000000 \
++smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+invtsc,+rtm,\
++hle,tsc-frequency=3504000000 \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc,usb=off,dump-guest-core=off \
-accel kvm \
--cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on,invtsc=on,tsc-frequency=4567890000 \
+-cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on,invtsc=on,rtm=on,hle=on,tsc-frequency=4567890000 \
-m 214 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/q35-acpi-nouefi.args b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
index 09e06c96ea..aed56fb1fc 100644
index 3faee48c77..a1f742712d 100644
--- a/tests/qemuxml2argvdata/q35-acpi-nouefi.args
+++ b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-guest/master-key.aes \
-machine q35,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
+-cpu Haswell,rtm=on,hle=on \
-m 1024 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/q35-acpi-uefi.args b/tests/qemuxml2argvdata/q35-acpi-uefi.args
index d00fe5bc1d..1f4bfe7f87 100644
index 60da1e282a..620056223a 100644
--- a/tests/qemuxml2argvdata/q35-acpi-uefi.args
+++ b/tests/qemuxml2argvdata/q35-acpi-uefi.args
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-guest/master-key.aes \
-machine q35,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
-drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,\
readonly=on \
-drive file=/var/lib/libvirt/qemu/nvram/guest_VARS.fd,if=pflash,format=raw,\
+-cpu Haswell,rtm=on,hle=on \
-drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on \
-drive file=/var/lib/libvirt/qemu/nvram/guest_VARS.fd,if=pflash,format=raw,unit=1 \
-m 1024 \
diff --git a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
index de34dff1cf..ccea7f91f9 100644
index 14e5bbc22a..ea66536c2a 100644
--- a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
+++ b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-guest/master-key.aes \
-machine q35,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
+-cpu Haswell,rtm=on,hle=on \
-m 1024 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
--
2.25.0
2.34.1

89
SOURCES/libvirt-RHEL-Remove-glib-2.64.0-workaround-for-GSource-race.patch

@ -0,0 +1,89 @@
From b550b671bace6d979a0763a837ce97ddf72e8fc8 Mon Sep 17 00:00:00 2001
Message-Id: <b550b671bace6d979a0763a837ce97ddf72e8fc8@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Fri, 28 Jan 2022 20:33:12 +0100
Subject: [PATCH] RHEL: Remove <glib-2.64.0 workaround for GSource race
https://bugzilla.redhat.com/show_bug.cgi?id=2045879
This is to accommodate for RHEL 8 downstream glib being fixed with a backport in
version 2.56.4-12 (Bug 1948988). Another reason for that is that our workaround
does not play nice with a fixed glib, leading to libvirt not properly
dereferencing the monitor socket, eventually leading to EMFILE: Too many open
files.
RHEL-only
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
---
src/util/glibcompat.c | 46 ++++++++-----------------------------------
1 file changed, 8 insertions(+), 38 deletions(-)
diff --git a/src/util/glibcompat.c b/src/util/glibcompat.c
index eb6dcc0111..bf890f10d2 100644
--- a/src/util/glibcompat.c
+++ b/src/util/glibcompat.c
@@ -212,51 +212,21 @@ vir_g_strdup_vprintf(const char *msg, va_list args)
return ret;
}
-
/*
- * If the last reference to a GSource is released in a non-main
- * thread we're exposed to a race condition that causes a
- * crash:
- *
- * https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1358
+ * This is a leftover of a hack that works around glib older than 2.64.0, but
+ * the fix in glib as backported in RHEL-8 to glib2-2.56.4-12 in BZ 1948988:
*
- * Thus we're using an idle func to release our ref...
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1948988
*
- * ...but this imposes a significant performance penalty on
- * I/O intensive workloads which are sensitive to the iterations
- * of the event loop, so avoid the workaround if we know we have
- * new enough glib.
+ * and our workaround coupled with that glib fix started causing leaks, which
+ * surfaced with us not unreferencing the qemu monitor socket in BZ 2045879:
*
- * The function below is used from a header file definition.
+ * https://bugzilla.redhat.com/show_bug.cgi?id=2045879
*
- * Drop when min glib >= 2.64.0
+ * Keeping this wrapper makes it easier to follow with other backports without
+ * conflicts in callers due to the function name change.
*/
-#if GLIB_CHECK_VERSION(2, 64, 0)
void vir_g_source_unref(GSource *src, GMainContext *ctx G_GNUC_UNUSED)
{
g_source_unref(src);
}
-#else
-
-static gboolean
-virEventGLibSourceUnrefIdle(gpointer data)
-{
- GSource *src = data;
-
- g_source_unref(src);
-
- return FALSE;
-}
-
-void vir_g_source_unref(GSource *src, GMainContext *ctx)
-{
- GSource *idle = g_idle_source_new();
-
- g_source_set_callback(idle, virEventGLibSourceUnrefIdle, src, NULL);
-
- g_source_attach(idle, ctx);
-
- g_source_unref(idle);
-}
-
-#endif
--
2.35.1

52
SOURCES/libvirt-RHEL-qemu-Add-ability-to-set-sgio-values-for-hostdev.patch

@ -1,5 +1,5 @@
From fce502cf5233d800479c2efcf7721ab895db8998 Mon Sep 17 00:00:00 2001
Message-Id: <fce502cf5233d800479c2efcf7721ab895db8998@dist-git>
From d6956a1aaa8757fab60132c3ee46c2bb199a78a8 Mon Sep 17 00:00:00 2001
Message-Id: <d6956a1aaa8757fab60132c3ee46c2bb199a78a8@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Mon, 17 Dec 2018 20:42:30 -0500
Subject: [PATCH] RHEL: qemu: Add ability to set sgio values for hostdev
@ -15,27 +15,34 @@ Add necessary checks in order to allow setting sgio values for a scsi
host device
Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit f2cf0ae7bc371c75f6c0e79192711f2b1d201b10)
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
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 b62dd1df52..ce7869e6be 100644
index 6077457ff4..ba85fc6e22 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1810,6 +1810,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
virDomainDiskDefPtr disk = NULL;
virDomainHostdevDefPtr hostdev = NULL;
@@ -1841,8 +1841,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 = -1;
+ int val = 0;
@@ -1830,14 +1831,10 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
if (!qemuIsSharedHostdev(hostdev))
/* "sgio" is only valid for block disk; cdrom
* and floopy disk can have empty source.
@@ -1858,17 +1859,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) {
@ -51,19 +58,24 @@ index b62dd1df52..ce7869e6be 100644
} else {
return 0;
}
@@ -1846,7 +1843,11 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
@@ -1877,7 +1875,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)
+ val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
+ else
+ val = (hostdev->source.subsys.u.scsi.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 <shareable/> 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.25.0
2.34.1

17
SOURCES/libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch

@ -1,5 +1,5 @@
From 5a192657ad4e08fc773fef90c6b07df3620fa1c2 Mon Sep 17 00:00:00 2001
Message-Id: <5a192657ad4e08fc773fef90c6b07df3620fa1c2@dist-git>
From f562b4c83d342002291f6bd7c5776eaecbd3147f Mon Sep 17 00:00:00 2001
Message-Id: <f562b4c83d342002291f6bd7c5776eaecbd3147f@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Mon, 17 Dec 2018 20:42:31 -0500
Subject: [PATCH] RHEL: qemu: Add check for unpriv sgio for SCSI generic host
@ -19,23 +19,22 @@ This restores functionality removed by upstream commit id 'ce346623'
to remove sgio support for the SCSI generic host device.
Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 712005bcf26190dc6fd1fe56283377987909cc4b)
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
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 ce7869e6be..2a84972fd9 100644
index ba85fc6e22..28c334761b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1717,13 +1717,29 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriverPtr driver,
@@ -1749,13 +1749,29 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriver *driver,
{
g_autofree char *dev_path = NULL;
g_autofree char *key = NULL;
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+ virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
+ virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host;
int ret = -1;
if (!qemuIsSharedHostdev(hostdev))
@ -63,5 +62,5 @@ index ce7869e6be..2a84972fd9 100644
qemuDriverLock(driver);
--
2.25.0
2.34.1

53
SOURCES/libvirt-RHEL-qemu-Alter-qemuSetUnprivSGIO-hostdev-shareable-logic.patch

@ -1,53 +0,0 @@
From e79d54ff8e760ac1a200a37fb05cc9aa758c48d3 Mon Sep 17 00:00:00 2001
Message-Id: <e79d54ff8e760ac1a200a37fb05cc9aa758c48d3@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Mon, 17 Dec 2018 20:42:33 -0500
Subject: [PATCH] RHEL: qemu: Alter qemuSetUnprivSGIO hostdev shareable logic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://bugzilla.redhat.com/show_bug.cgi?id=1656362 (RHEL8)
https://bugzilla.redhat.com/show_bug.cgi?id=1656360 (RHEL7)
RHEL-only
Fix the logic to handle the case where if the <shareable/> element
was removed from the domain <hostdev.../>, then we have to reset the
SGIO value back to 0. Without this patch the check for not shareable
and return 0 would bypass resetting the value back to 0.
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index faabc4d49f..590052b035 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1844,9 +1844,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
hostdev = dev->data.hostdev;
- if (!qemuIsSharedHostdev(hostdev))
- return 0;
-
if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
return -1;
@@ -1863,7 +1860,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
val = 1;
} else {
- if (hostdev->source.subsys.u.scsi.sgio ==
+ /* Only settable if <shareable/> was present for hostdev */
+ if (qemuIsSharedHostdev(hostdev) &&
+ hostdev->source.subsys.u.scsi.sgio ==
VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
val = 1;
}
--
2.25.0

60
SOURCES/libvirt-RHEL-qemu-Alter-val-usage-in-qemuSetUnprivSGIO.patch

@ -1,60 +0,0 @@
From fa46b5b4d5bb732462d0d5484cc010aa652d821b Mon Sep 17 00:00:00 2001
Message-Id: <fa46b5b4d5bb732462d0d5484cc010aa652d821b@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Mon, 17 Dec 2018 20:42:32 -0500
Subject: [PATCH] RHEL: qemu: Alter @val usage in qemuSetUnprivSGIO
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://bugzilla.redhat.com/show_bug.cgi?id=1656362 (RHEL8)
https://bugzilla.redhat.com/show_bug.cgi?id=1656360 (RHEL7)
RHEL-only
Rather than initializing to -1 and then setting to the result
of a boolean check (either 0 or 1), let's just initialize @val
to 0 and then only change to 1 if conditions are "right".
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 2a84972fd9..faabc4d49f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1828,7 +1828,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
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.
@@ -1859,11 +1859,14 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
return -1;
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
- if (dev->type == VIR_DOMAIN_DEVICE_DISK)
- val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
- else
- val = (hostdev->source.subsys.u.scsi.sgio ==
- VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
+ disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
+ val = 1;
+ } else {
+ if (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.25.0

45
SOURCES/libvirt-RHEL-qemu-Fix-crash-trying-to-use-iSCSI-hostdev.patch

@ -1,45 +0,0 @@
From 163740bff28c6f1a82663bc652f2cd5df39e4276 Mon Sep 17 00:00:00 2001
Message-Id: <163740bff28c6f1a82663bc652f2cd5df39e4276@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Fri, 25 Jan 2019 12:19:12 -0500
Subject: [PATCH] RHEL: qemu: Fix crash trying to use iSCSI hostdev
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://bugzilla.redhat.com/show_bug.cgi?id=1669424
https://bugzilla.redhat.com/show_bug.cgi?id=1669966
RHEL-only
Commit 861a1a4d2 moved the qemuIsSharedHostdev filter in the
HOSTDEV half of the logic to allow calling qemuGetHostdevPath;
however, that neglected to check whether the SCSI hostdev was
using the iSCSI protocol which has a different overlayed struct
format (u.iscsi vs. u.host) resulting in attempted access of
u.host when calling virSCSIDeviceGetDevName.
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 0674292fab..3d2f0e7bbb 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1844,6 +1844,10 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
hostdev = dev->data.hostdev;
+ if (hostdev->source.subsys.u.scsi.protocol ==
+ VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
+ return 0;
+
if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
return -1;
--
2.25.0

59
SOURCES/libvirt-RHEL-qemu-Fix-logic-error-in-qemuSetUnprivSGIO.patch

@ -1,59 +0,0 @@
From f6a05ac3cb33c473de8ed49b53d22910fc0140df Mon Sep 17 00:00:00 2001
Message-Id: <f6a05ac3cb33c473de8ed49b53d22910fc0140df@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Wed, 16 Jan 2019 15:54:31 -0500
Subject: [PATCH] RHEL: qemu: Fix logic error in qemuSetUnprivSGIO
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://bugzilla.redhat.com/show_bug.cgi?id=1666605
RHEL-only
Commit c0f26a13c6 had a logic error with using both DISK and
sgio which resulted in a DISK that didn't have sgio set falling
into the else clause and trying to deref a NULL @hostdev resulting
in a libvirtd crash:
Thread 1 (Thread 0x7ffbc6353700 (LWP 12642)):
0 0x00007ffb958e7d7a in qemuSetUnprivSGIO
1 0x00007ffb958d9d92 in qemuDomainAttachDeviceDiskLive
2 0x00007ffb9594fce8 in qemuDomainAttachDeviceFlags
3 0x00007ffbde399d71 in virDomainAttachDevice
4 0x0000563b73ded4b2 in remoteDispatchDomainAttachDeviceHelper
for hotplug of XML:
<disk device="lun" type="block">
<source dev="/dev/sdb"/>
<driver name="qemu" type="raw"/>
<target bus="scsi" dev="sdb"/>
</disk>
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 590052b035..0674292fab 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1856,9 +1856,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
return -1;
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
- if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
- disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
- val = 1;
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
+ if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
+ val = 1;
} else {
/* Only settable if <shareable/> was present for hostdev */
if (qemuIsSharedHostdev(hostdev) &&
--
2.25.0

42
SOURCES/libvirt-RHEL-qemuCheckUnprivSGIO-use-sysfs_path-to-get-unpriv_sgio.patch

@ -1,42 +0,0 @@
From ef5a82d50464478a302cb59804d03e4a3dada83e Mon Sep 17 00:00:00 2001
Message-Id: <ef5a82d50464478a302cb59804d03e4a3dada83e@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 6 Mar 2020 15:52:26 +0100
Subject: [PATCH] RHEL: qemuCheckUnprivSGIO: use @sysfs_path to get unpriv_sgio
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Downstream commit 65f4ff0e2c9a968b7ec65c8d751d4055cc212628
RHEL: qemuSetUnprivSGIO: Actually use calculated
@sysfs_path to set unpriv_sgio
removed the device_path -> sysfs_path conversion from
both virGetDeviceUnprivSGIO and virSetDeviceUnprivSGIO,
but only adjusted one of the callers.
https://bugzilla.redhat.com/show_bug.cgi?id=1808400
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Message-Id: <20200306145226.1610708-7-abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index b61d7e59fa..6a22d78ac6 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1430,7 +1430,7 @@ qemuCheckUnprivSGIO(virHashTablePtr sharedDevices,
if (!(virHashLookup(sharedDevices, key)))
return 0;
- if (virGetDeviceUnprivSGIO(device_path, &val) < 0)
+ if (virGetDeviceUnprivSGIO(sysfs_path, &val) < 0)
return -1;
/* Error message on failure needs to be handled in caller
--
2.25.1

170
SOURCES/libvirt-RHEL-qemuSetUnprivSGIO-Actually-use-calculated-sysfs_path-to-set-unpriv_sgio.patch

@ -1,170 +0,0 @@
From 717423e7a452b0715e95b492b15dc08983677d12 Mon Sep 17 00:00:00 2001
Message-Id: <717423e7a452b0715e95b492b15dc08983677d12@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 6 Mar 2020 15:52:25 +0100
Subject: [PATCH] RHEL: qemuSetUnprivSGIO: Actually use calculated @sysfs_path
to set unpriv_sgio
In previous commits I've attempted to make qemuSetUnprivSGIO()
construct a generic enough path for SCSI devices to set
unpriv_sgio. However, virSetDeviceUnprivSGIO() does not care
about that - it constructs the path on it's own again. This is
suboptimal in either case - we already have the path constructed.
https://bugzilla.redhat.com/show_bug.cgi?id=1808390
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Message-Id: <20200306145226.1610708-6-abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_conf.c | 8 +++-----
src/util/virutil.c | 24 ++++++------------------
src/util/virutil.h | 2 --
3 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 6d6feb97cd..b61d7e59fa 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1430,7 +1430,7 @@ qemuCheckUnprivSGIO(virHashTablePtr sharedDevices,
if (!(virHashLookup(sharedDevices, key)))
return 0;
- if (virGetDeviceUnprivSGIO(device_path, NULL, &val) < 0)
+ if (virGetDeviceUnprivSGIO(device_path, &val) < 0)
return -1;
/* Error message on failure needs to be handled in caller
@@ -1789,7 +1789,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
virDomainDiskDefPtr disk = NULL;
virDomainHostdevDefPtr hostdev = NULL;
g_autofree char *sysfs_path = NULL;
- const char *path = NULL;
int val = 0;
/* "sgio" is only valid for block disk; cdrom
@@ -1797,13 +1796,12 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
*/
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
disk = dev->data.disk;
+ const char *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;
@@ -1843,7 +1841,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr 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/virutil.c b/src/util/virutil.c
index f142951acf..4198473fce 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1421,18 +1421,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;
@@ -1440,38 +1435,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')))
@@ -1479,13 +1468,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 1a6ae1787a..a2530e21b5 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -124,10 +124,8 @@ int virGetDeviceID(const char *path,
int *maj,
int *min);
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.25.1

71
SOURCES/libvirt-RHEL-virscsi-Check-device-type-before-getting-it-s-dev-node-name.patch

@ -1,5 +1,5 @@
From f66beef45382be2aed6d021a409e90f8114c8671 Mon Sep 17 00:00:00 2001
Message-Id: <f66beef45382be2aed6d021a409e90f8114c8671@dist-git>
From 9c5daeb8c99ca12a66387de448f585742887fd75 Mon Sep 17 00:00:00 2001
Message-Id: <9c5daeb8c99ca12a66387de448f585742887fd75@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>