import CS libvirt-10.0.0-4.el9

This commit is contained in:
eabdullin 2024-03-28 10:54:12 +00:00
parent 274bcf4b7f
commit 7e8a0b31d0
98 changed files with 9586 additions and 50059 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
SOURCES/libvirt-10.0.0.tar.xz

1
.libvirt.metadata Normal file
View File

@ -0,0 +1 @@
7a2e402bfb1ad295544de6cd527c4c04e85c5096 SOURCES/libvirt-10.0.0.tar.xz

Binary file not shown.

View File

@ -0,0 +1,679 @@
From 9a31f486329e36bbe6f6156eb89d4d455fc0a7d8 Mon Sep 17 00:00:00 2001
Message-ID: <9a31f486329e36bbe6f6156eb89d4d455fc0a7d8.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 15:50:27 +0100
Subject: [PATCH] Don't overwrite error message from 'virXPathNodeSet'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
'virXPathNodeSet' returns -1 only when 'ctxt' or 'xpath' are NULL or
when the 'xpath' string is invalid. Both are programming errors. It
doesn't make sense for the code to overwrite the error message for
anything supposedly more relevant.
The majority of calls to 'virXPathNodeSet' already didn't do this, so
this patch fixes the rest to prevent it from spreading again.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit a9f76d6ab7278864150d9f4776750ea22d7ef508)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/conf/domain_conf.c | 78 +++++++------------------------
src/conf/network_conf.c | 80 ++++++++------------------------
src/conf/node_device_conf.c | 17 ++-----
src/conf/numa_conf.c | 15 +++---
src/cpu/cpu_ppc64.c | 5 +-
src/qemu/qemu_capabilities.c | 30 +++---------
src/qemu/qemu_domain.c | 23 +++------
src/qemu/qemu_migration_cookie.c | 5 +-
src/qemu/qemu_nbdkit.c | 5 +-
src/vz/vz_sdk.c | 5 +-
10 files changed, 72 insertions(+), 191 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ac06fa39f6..52a5796ad2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17765,11 +17765,8 @@ virDomainResctrlMonDefParse(virDomainDef *def,
ctxt->node = node;
- if ((n = virXPathNodeSet("./monitor", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot extract monitor nodes"));
+ if ((n = virXPathNodeSet("./monitor", ctxt, &nodes)) < 0)
goto cleanup;
- }
for (i = 0; i < n; i++) {
domresmon = g_new0(virDomainResctrlMonDef, 1);
@@ -17897,11 +17894,8 @@ virDomainCachetuneDefParse(virDomainDef *def,
if (virBitmapIsAllClear(vcpus))
return 0;
- if ((n = virXPathNodeSet("./cache", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot extract cache nodes under cachetune"));
+ if ((n = virXPathNodeSet("./cache", ctxt, &nodes)) < 0)
return -1;
- }
if (virDomainResctrlVcpuMatch(def, vcpus, &resctrl) < 0)
return -1;
@@ -18167,11 +18161,8 @@ virDomainDefParseMemory(virDomainDef *def,
if (virXPathNode("./memoryBacking/hugepages", ctxt)) {
/* hugepages will be used */
- if ((n = virXPathNodeSet("./memoryBacking/hugepages/page", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot extract hugepages nodes"));
+ if ((n = virXPathNodeSet("./memoryBacking/hugepages/page", ctxt, &nodes)) < 0)
return -1;
- }
if (n) {
def->mem.hugepages = g_new0(virDomainHugePage, n);
@@ -18255,11 +18246,8 @@ virDomainMemorytuneDefParse(virDomainDef *def,
if (virBitmapIsAllClear(vcpus))
return 0;
- if ((n = virXPathNodeSet("./node", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot extract memory nodes under memorytune"));
+ if ((n = virXPathNodeSet("./node", ctxt, &nodes)) < 0)
return -1;
- }
if (virDomainResctrlVcpuMatch(def, vcpus, &resctrl) < 0)
return -1;
@@ -18326,11 +18314,9 @@ virDomainDefTunablesParse(virDomainDef *def,
&def->blkio.weight) < 0)
def->blkio.weight = 0;
- if ((n = virXPathNodeSet("./blkiotune/device", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot extract blkiotune nodes"));
+ if ((n = virXPathNodeSet("./blkiotune/device", ctxt, &nodes)) < 0)
return -1;
- }
+
if (n)
def->blkio.devices = g_new0(virBlkioDevice, n);
@@ -18441,11 +18427,8 @@ virDomainDefTunablesParse(virDomainDef *def,
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./cputune/emulatorpin", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot extract emulatorpin nodes"));
+ if ((n = virXPathNodeSet("./cputune/emulatorpin", ctxt, &nodes)) < 0)
return -1;
- }
if (n) {
if (n > 1) {
@@ -18460,11 +18443,8 @@ virDomainDefTunablesParse(virDomainDef *def,
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./cputune/iothreadpin", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot extract iothreadpin nodes"));
+ if ((n = virXPathNodeSet("./cputune/iothreadpin", ctxt, &nodes)) < 0)
return -1;
- }
for (i = 0; i < n; i++) {
if (virDomainIOThreadPinDefParseXML(nodes[i], def) < 0)
@@ -18472,11 +18452,8 @@ virDomainDefTunablesParse(virDomainDef *def,
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./cputune/vcpusched", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot extract vcpusched nodes"));
+ if ((n = virXPathNodeSet("./cputune/vcpusched", ctxt, &nodes)) < 0)
return -1;
- }
for (i = 0; i < n; i++) {
if (virDomainVcpuThreadSchedParse(nodes[i], def) < 0)
@@ -18484,11 +18461,8 @@ virDomainDefTunablesParse(virDomainDef *def,
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./cputune/iothreadsched", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot extract iothreadsched nodes"));
+ if ((n = virXPathNodeSet("./cputune/iothreadsched", ctxt, &nodes)) < 0)
return -1;
- }
for (i = 0; i < n; i++) {
if (virDomainIOThreadSchedParse(nodes[i], def) < 0)
@@ -18496,11 +18470,8 @@ virDomainDefTunablesParse(virDomainDef *def,
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./cputune/emulatorsched", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot extract emulatorsched nodes"));
+ if ((n = virXPathNodeSet("./cputune/emulatorsched", ctxt, &nodes)) < 0)
return -1;
- }
if (n) {
if (n > 1) {
@@ -18514,11 +18485,8 @@ virDomainDefTunablesParse(virDomainDef *def,
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./cputune/cachetune", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot extract cachetune nodes"));
+ if ((n = virXPathNodeSet("./cputune/cachetune", ctxt, &nodes)) < 0)
return -1;
- }
for (i = 0; i < n; i++) {
if (virDomainCachetuneDefParse(def, ctxt, nodes[i], flags) < 0)
@@ -18526,11 +18494,8 @@ virDomainDefTunablesParse(virDomainDef *def,
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./cputune/memorytune", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot extract memorytune nodes"));
+ if ((n = virXPathNodeSet("./cputune/memorytune", ctxt, &nodes)) < 0)
return -1;
- }
for (i = 0; i < n; i++) {
if (virDomainMemorytuneDefParse(def, ctxt, nodes[i], flags) < 0)
@@ -18834,11 +18799,8 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt,
!virDomainIOThreadIDArrayHasPin(def))
def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;
- if ((n = virXPathNodeSet("./resource", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot extract resource nodes"));
+ if ((n = virXPathNodeSet("./resource", ctxt, &nodes)) < 0)
return NULL;
- }
if (n > 1) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -18886,11 +18848,9 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt,
return NULL;
/* analysis of the resource leases */
- if ((n = virXPathNodeSet("./devices/lease", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot extract device leases"));
+ if ((n = virXPathNodeSet("./devices/lease", ctxt, &nodes)) < 0)
return NULL;
- }
+
if (n)
def->leases = g_new0(virDomainLeaseDef *, n);
for (i = 0; i < n; i++) {
@@ -19009,11 +18969,9 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt,
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./devices/console", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot extract console devices"));
+ if ((n = virXPathNodeSet("./devices/console", ctxt, &nodes)) < 0)
return NULL;
- }
+
if (n)
def->consoles = g_new0(virDomainChrDef *, n);
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 6f8a0d2d0b..52c90e53f8 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -892,13 +892,9 @@ virNetworkDNSDefParseXML(const char *networkName,
&def->forwardPlainNames) < 0)
return -1;
- nfwds = virXPathNodeSet("./forwarder", ctxt, &fwdNodes);
- if (nfwds < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <forwarder> element found in <dns> of network %1$s"),
- networkName);
+ if ((nfwds = virXPathNodeSet("./forwarder", ctxt, &fwdNodes)) < 0)
return -1;
- }
+
if (nfwds > 0) {
def->forwarders = g_new0(virNetworkDNSForwarder, nfwds);
@@ -922,13 +918,9 @@ virNetworkDNSDefParseXML(const char *networkName,
}
}
- nhosts = virXPathNodeSet("./host", ctxt, &hostNodes);
- if (nhosts < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <host> element found in <dns> of network %1$s"),
- networkName);
+ if ((nhosts = virXPathNodeSet("./host", ctxt, &hostNodes)) < 0)
return -1;
- }
+
if (nhosts > 0) {
def->hosts = g_new0(virNetworkDNSHostDef, nhosts);
@@ -941,13 +933,9 @@ virNetworkDNSDefParseXML(const char *networkName,
}
}
- nsrvs = virXPathNodeSet("./srv", ctxt, &srvNodes);
- if (nsrvs < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <srv> element found in <dns> of network %1$s"),
- networkName);
+ if ((nsrvs = virXPathNodeSet("./srv", ctxt, &srvNodes)) < 0)
return -1;
- }
+
if (nsrvs > 0) {
def->srvs = g_new0(virNetworkDNSSrvDef, nsrvs);
@@ -960,13 +948,9 @@ virNetworkDNSDefParseXML(const char *networkName,
}
}
- ntxts = virXPathNodeSet("./txt", ctxt, &txtNodes);
- if (ntxts < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <txt> element found in <dns> of network %1$s"),
- networkName);
+ if ((ntxts = virXPathNodeSet("./txt", ctxt, &txtNodes)) < 0)
return -1;
- }
+
if (ntxts > 0) {
def->txts = g_new0(virNetworkDNSTxtDef, ntxts);
@@ -1222,13 +1206,10 @@ virNetworkForwardNatDefParseXML(const char *networkName,
return -1;
/* addresses for SNAT */
- nNatAddrs = virXPathNodeSet("./address", ctxt, &natAddrNodes);
- if (nNatAddrs < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <address> element found in <forward> of network %1$s"),
- networkName);
+ if ((nNatAddrs = virXPathNodeSet("./address", ctxt, &natAddrNodes)) < 0)
return -1;
- } else if (nNatAddrs > 1) {
+
+ if (nNatAddrs > 1) {
virReportError(VIR_ERR_XML_ERROR,
_("Only one <address> element is allowed in <nat> in <forward> in network %1$s"),
networkName);
@@ -1284,13 +1265,10 @@ virNetworkForwardNatDefParseXML(const char *networkName,
}
/* ports for SNAT and MASQUERADE */
- nNatPorts = virXPathNodeSet("./port", ctxt, &natPortNodes);
- if (nNatPorts < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <port> element found in <forward> of network %1$s"),
- networkName);
+ if ((nNatPorts = virXPathNodeSet("./port", ctxt, &natPortNodes)) < 0)
return -1;
- } else if (nNatPorts > 1) {
+
+ if (nNatPorts > 1) {
virReportError(VIR_ERR_XML_ERROR,
_("Only one <port> element is allowed in <nat> in <forward> in network %1$s"),
networkName);
@@ -1358,37 +1336,19 @@ virNetworkForwardDefParseXML(const char *networkName,
}
/* bridge and hostdev modes can use a pool of physical interfaces */
- nForwardIfs = virXPathNodeSet("./interface", ctxt, &forwardIfNodes);
- if (nForwardIfs < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <interface> element found in <forward> of network %1$s"),
- networkName);
+ if ((nForwardIfs = virXPathNodeSet("./interface", ctxt, &forwardIfNodes)) < 0)
return -1;
- }
- nForwardAddrs = virXPathNodeSet("./address", ctxt, &forwardAddrNodes);
- if (nForwardAddrs < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <address> element found in <forward> of network %1$s"),
- networkName);
+ if ((nForwardAddrs = virXPathNodeSet("./address", ctxt, &forwardAddrNodes)) < 0)
return -1;
- }
- nForwardPfs = virXPathNodeSet("./pf", ctxt, &forwardPfNodes);
- if (nForwardPfs < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <pf> element found in <forward> of network %1$s"),
- networkName);
+ if ((nForwardPfs = virXPathNodeSet("./pf", ctxt, &forwardPfNodes)) < 0)
return -1;
- }
- nForwardNats = virXPathNodeSet("./nat", ctxt, &forwardNatNodes);
- if (nForwardNats < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid <nat> element found in <forward> of network %1$s"),
- networkName);
+ if ((nForwardNats = virXPathNodeSet("./nat", ctxt, &forwardNatNodes)) < 0)
return -1;
- } else if (nForwardNats > 1) {
+
+ if (nForwardNats > 1) {
virReportError(VIR_ERR_XML_ERROR,
_("Only one <nat> element is allowed in <forward> of network %1$s"),
networkName);
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 95de77abe9..dd174d3020 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -960,11 +960,9 @@ virNodeDeviceCapVPDParseCustomFields(xmlXPathContextPtr ctxt, virPCIVPDResource
g_autofree xmlNodePtr *nodes = NULL;
size_t i = 0;
- if ((nfields = virXPathNodeSet("./vendor_field[@index]", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("failed to evaluate <vendor_field> elements"));
+ if ((nfields = virXPathNodeSet("./vendor_field[@index]", ctxt, &nodes)) < 0)
return -1;
- }
+
for (i = 0; i < nfields; i++) {
g_autofree char *value = NULL;
g_autofree char *index = NULL;
@@ -989,11 +987,9 @@ virNodeDeviceCapVPDParseCustomFields(xmlXPathContextPtr ctxt, virPCIVPDResource
VIR_FREE(nodes);
if (!readOnly) {
- if ((nfields = virXPathNodeSet("./system_field[@index]", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("failed to evaluate <system_field> elements"));
+ if ((nfields = virXPathNodeSet("./system_field[@index]", ctxt, &nodes)) < 0)
return -1;
- }
+
for (i = 0; i < nfields; i++) {
g_autofree char *value = NULL;
g_autofree char *index = NULL;
@@ -1074,11 +1070,8 @@ virNodeDeviceCapVPDParseXML(xmlXPathContextPtr ctxt, virPCIVPDResource **res)
return -1;
}
- if ((nfields = virXPathNodeSet("./fields[@access]", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("no VPD <fields> elements with an access type attribute found"));
+ if ((nfields = virXPathNodeSet("./fields[@access]", ctxt, &nodes)) < 0)
return -1;
- }
for (i = 0; i < nfields; i++) {
g_autofree char *access = NULL;
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index bcd7838e00..d8120de6d2 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -135,11 +135,8 @@ virDomainNumatuneNodeParseXML(virDomainNuma *numa,
size_t i = 0;
g_autofree xmlNodePtr *nodes = NULL;
- if ((n = virXPathNodeSet("./numatune/memnode", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot extract memnode nodes"));
+ if ((n = virXPathNodeSet("./numatune/memnode", ctxt, &nodes)) < 0)
return -1;
- }
if (!n)
return 0;
@@ -700,7 +697,10 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNuma *def,
if (!virXPathNode("./distances[1]", ctxt))
return 0;
- if ((sibling = virXPathNodeSet("./distances[1]/sibling", ctxt, &nodes)) <= 0) {
+ if ((sibling = virXPathNodeSet("./distances[1]/sibling", ctxt, &nodes)) < 0)
+ goto cleanup;
+
+ if (sibling == 0) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("NUMA distances defined without siblings"));
goto cleanup;
@@ -852,7 +852,10 @@ virDomainNumaDefParseXML(virDomainNuma *def,
if (!virXPathNode("./cpu/numa[1]", ctxt))
return 0;
- if ((n = virXPathNodeSet("./cpu/numa[1]/cell", ctxt, &cell)) <= 0) {
+ if ((n = virXPathNodeSet("./cpu/numa[1]/cell", ctxt, &cell)) < 0)
+ return -1;
+
+ if (n == 0) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("NUMA topology defined without NUMA cells"));
return -1;
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index e13cdbdf6b..448a0a7d85 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -334,7 +334,10 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
}
}
- if ((n = virXPathNodeSet("./pvr", ctxt, &nodes)) <= 0) {
+ if ((n = virXPathNodeSet("./pvr", ctxt, &nodes)) < 0)
+ return -1;
+
+ if (n == 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Missing PVR information for CPU model %1$s"),
model->name);
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e13df2b27d..10090e0986 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4015,11 +4015,8 @@ virQEMUCapsLoadCPUModels(virArch arch,
int n;
xmlNodePtr node;
- if ((n = virXPathNodeSet(xpath, ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to parse qemu capabilities cpus"));
+ if ((n = virXPathNodeSet(xpath, ctxt, &nodes)) < 0)
return -1;
- }
if (n == 0)
return 0;
@@ -4057,11 +4054,8 @@ virQEMUCapsLoadCPUModels(virArch arch,
nblockers = virXPathNodeSet("./blocker", ctxt, &blockerNodes);
ctxt->node = node;
- if (nblockers < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to parse CPU blockers in QEMU capabilities"));
+ if (nblockers < 0)
return -1;
- }
if (nblockers > 0) {
size_t j;
@@ -4100,11 +4094,8 @@ virQEMUCapsLoadMachines(virQEMUCapsAccel *caps,
size_t i;
int n;
- if ((n = virXPathNodeSet(xpath, ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to parse qemu capabilities machines"));
+ if ((n = virXPathNodeSet(xpath, ctxt, &nodes)) < 0)
return -1;
- }
if (n == 0)
return 0;
@@ -4317,11 +4308,8 @@ virQEMUCapsParseSGXInfo(virQEMUCaps *qemuCaps,
ctxt->node = sgxSections;
nSgxSections = virXPathNodeSet("./section", ctxt, &sectionNodes);
- if (nSgxSections < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to parse SGX sections in QEMU capabilities cache"));
+ if (nSgxSections < 0)
return -1;
- }
sgx->nSgxSections = nSgxSections;
sgx->sgxSections = g_new0(virSGXSection, nSgxSections);
@@ -4404,11 +4392,8 @@ virQEMUCapsParseFlags(virQEMUCaps *qemuCaps, xmlXPathContextPtr ctxt)
size_t i;
int n;
- if ((n = virXPathNodeSet("./flag", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to parse qemu capabilities flags"));
+ if ((n = virXPathNodeSet("./flag", ctxt, &nodes)) < 0)
return -1;
- }
VIR_DEBUG("Got flags %d", n);
for (i = 0; i < n; i++) {
@@ -4442,11 +4427,8 @@ virQEMUCapsParseGIC(virQEMUCaps *qemuCaps, xmlXPathContextPtr ctxt)
size_t i;
int n;
- if ((n = virXPathNodeSet("./gic", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to parse qemu capabilities gic"));
+ if ((n = virXPathNodeSet("./gic", ctxt, &nodes)) < 0)
return -1;
- }
if (n > 0) {
unsigned int uintValue;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e2a1bf2c13..97520bb49c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3155,11 +3155,8 @@ qemuDomainObjPrivateXMLParseSlirpFeatures(xmlNodePtr featuresNode,
ctxt->node = featuresNode;
- if ((n = virXPathNodeSet("./feature", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to parse slirp-helper features"));
+ if ((n = virXPathNodeSet("./feature", ctxt, &nodes)) < 0)
return -1;
- }
for (i = 0; i < n; i++) {
g_autofree char *str = virXMLPropString(nodes[i], "name");
@@ -3273,11 +3270,9 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./qemuCaps/flag", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to parse qemu capabilities flags"));
+ if ((n = virXPathNodeSet("./qemuCaps/flag", ctxt, &nodes)) < 0)
return -1;
- }
+
if (n > 0) {
qemuCaps = virQEMUCapsNew();
@@ -3305,11 +3300,9 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
priv->fakeReboot = virXPathBoolean("boolean(./fakereboot)", ctxt) == 1;
- if ((n = virXPathNodeSet("./devices/device", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to parse qemu device list"));
+ if ((n = virXPathNodeSet("./devices/device", ctxt, &nodes)) < 0)
return -1;
- }
+
if (n > 0) {
/* NULL-terminated list */
priv->qemuDevices = g_new0(char *, n + 1);
@@ -3325,11 +3318,9 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./slirp/helper", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to parse slirp helper list"));
+ if ((n = virXPathNodeSet("./slirp/helper", ctxt, &nodes)) < 0)
return -1;
- }
+
for (i = 0; i < n; i++) {
g_autofree char *alias = virXMLPropString(nodes[i], "alias");
g_autofree char *pid = virXMLPropString(nodes[i], "pid");
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index 5505fdaf22..4361949cca 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -947,11 +947,8 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr ctxt)
g_autofree xmlNodePtr *interfaces = NULL;
VIR_XPATH_NODE_AUTORESTORE(ctxt)
- if ((n = virXPathNodeSet("./network/interface", ctxt, &interfaces)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("missing interface information"));
+ if ((n = virXPathNodeSet("./network/interface", ctxt, &interfaces)) < 0)
return NULL;
- }
optr->nnets = n;
optr->net = g_new0(qemuMigrationCookieNetData, optr->nnets);
diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c
index 85e61be44c..3343241aaf 100644
--- a/src/qemu/qemu_nbdkit.c
+++ b/src/qemu/qemu_nbdkit.c
@@ -400,11 +400,8 @@ qemuNbdkitCapsParseFlags(qemuNbdkitCaps *nbdkitCaps,
size_t i;
int n;
- if ((n = virXPathNodeSet("./flag", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to parse qemu capabilities flags"));
+ if ((n = virXPathNodeSet("./flag", ctxt, &nodes)) < 0)
return -1;
- }
VIR_DEBUG("Got flags %d", n);
for (i = 0; i < n; i++) {
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 6a15d60577..ce4586a3f5 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -4612,11 +4612,8 @@ prlsdkParseSnapshotTree(const char *treexml)
"ParallelsSavedStates", &ctxt, NULL, false)))
goto cleanup;
- if ((n = virXPathNodeSet("//SavedStateItem", ctxt, &nodes)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot extract snapshot nodes"));
+ if ((n = virXPathNodeSet("//SavedStateItem", ctxt, &nodes)) < 0)
goto cleanup;
- }
for (i = 0; i < n; i++) {
if (nodes[i]->parent == xmlDocGetRootElement(xml))
--
2.43.0

View File

@ -1,38 +0,0 @@
From f3e5bf77bc6f591e5799ae9de36498df5c2a1811 Mon Sep 17 00:00:00 2001
Message-ID: <f3e5bf77bc6f591e5799ae9de36498df5c2a1811.1691014499.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 1 Aug 2023 16:18:47 +0200
Subject: [PATCH] Revert "qemu_passt: Actually use @logfd"
This reverts commit 83686f1eea1a001a37a92f2c054ffb2689c43a40.
This is needed only so that the next revert is clean.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit bc9a254dc72b6904e8368c3fea3ab49b7238ff34)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2209191
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_passt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 3679bf75fc..25b22d8ad9 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -204,9 +204,9 @@ qemuPasstStart(virDomainObj *vm,
/* The logFile location is not restricted to a per-domain directory. It
* can be anywhere. Pre-create it as passt may not have enough perms to
* do so. */
- if ((logfd = qemuDomainOpenFile(cfg, vm->def, net->backend.logFile,
- O_CREAT | O_TRUNC | O_APPEND | O_RDWR,
- &needUnlink)) < 0) {
+ if (qemuDomainOpenFile(cfg, vm->def, net->backend.logFile,
+ O_CREAT | O_TRUNC | O_APPEND | O_RDWR,
+ &needUnlink) < 0) {
return -1;
}
--
2.41.0

View File

@ -1,148 +0,0 @@
From 8897c7d63f763bf9b59f7e79ec6b2f9caf84823b Mon Sep 17 00:00:00 2001
Message-ID: <8897c7d63f763bf9b59f7e79ec6b2f9caf84823b.1691014499.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 1 Aug 2023 16:20:58 +0200
Subject: [PATCH] Revert "qemu_passt: Precreate passt logfile"
This reverts commit 8511b96a319836700b4829816cdae27c3630060d.
Turns out, we need to do a bit more than just plain
qemuSecurityDomainSetPathLabel() which sets svirt_image_t. Passt
has its own SELinux policy and as a part of that they invent
passt_log_t for log files. Right now, I don't know how libvirt
could query that and even if I did, passt SELinux policy would
need to permit relabelling from svirt_t to passt_log_t, which it
doesn't [1].
Until these problems are addressed we shouldn't be pre-creating
the file as it puts users into way worse position - even
scenarios that used to work don't work. But then again - using
log file for passt is usually valuable for developers only and
not regular users.
1: https://bugzilla.redhat.com/show_bug.cgi?id=2209191#c10
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 99349ba18e726465215a71f28d2146a0a2adb65d)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2209191
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_passt.c | 40 +++++-----------------------------------
1 file changed, 5 insertions(+), 35 deletions(-)
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 25b22d8ad9..99636a3a49 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -20,8 +20,6 @@
#include <config.h>
-#include <fcntl.h>
-
#include "qemu_dbus.h"
#include "qemu_extdevice.h"
#include "qemu_security.h"
@@ -138,13 +136,9 @@ void
qemuPasstStop(virDomainObj *vm,
virDomainNetDef *net)
{
- qemuDomainObjPrivate *priv = vm->privateData;
- virQEMUDriver *driver = priv->driver;
g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
- qemuSecurityDomainRestorePathLabel(driver, vm, net->backend.logFile);
-
qemuPasstKill(pidfile, passtSocketName);
}
@@ -172,12 +166,10 @@ qemuPasstStart(virDomainObj *vm,
{
qemuDomainObjPrivate *priv = vm->privateData;
virQEMUDriver *driver = priv->driver;
- g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
g_autoptr(virCommand) cmd = NULL;
g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
char macaddr[VIR_MAC_STRING_BUFLEN];
- bool needUnlink = false;
size_t i;
cmd = virCommandNew(PASST);
@@ -199,25 +191,8 @@ qemuPasstStart(virDomainObj *vm,
if (net->sourceDev)
virCommandAddArgList(cmd, "--interface", net->sourceDev, NULL);
- if (net->backend.logFile) {
- VIR_AUTOCLOSE logfd = -1;
- /* The logFile location is not restricted to a per-domain directory. It
- * can be anywhere. Pre-create it as passt may not have enough perms to
- * do so. */
- if (qemuDomainOpenFile(cfg, vm->def, net->backend.logFile,
- O_CREAT | O_TRUNC | O_APPEND | O_RDWR,
- &needUnlink) < 0) {
- return -1;
- }
-
- if (qemuSecurityDomainSetPathLabel(driver, vm,
- net->backend.logFile, false) < 0) {
- goto error;
- }
-
- /* Worse, passt deliberately doesn't support FD passing. */
+ if (net->backend.logFile)
virCommandAddArgList(cmd, "--log-file", net->backend.logFile, NULL);
- }
/* Add IP address info */
for (i = 0; i < net->guestIP.nips; i++) {
@@ -228,7 +203,7 @@ qemuPasstStart(virDomainObj *vm,
* a single IPv4 and single IPv6 address
*/
if (!(addr = virSocketAddrFormat(&ip->address)))
- goto error;
+ return -1;
virCommandAddArgList(cmd, "--address", addr, NULL);
@@ -256,14 +231,14 @@ qemuPasstStart(virDomainObj *vm,
/* validation guarantees this will never happen */
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid portForward proto value %1$u"), pf->proto);
- goto error;
+ return -1;
}
if (VIR_SOCKET_ADDR_VALID(&pf->address)) {
g_autofree char *addr = NULL;
if (!(addr = virSocketAddrFormat(&pf->address)))
- goto error;
+ return -1;
virBufferAddStr(&buf, addr);
emitsep = true;
@@ -309,7 +284,7 @@ qemuPasstStart(virDomainObj *vm,
if (qemuExtDeviceLogCommand(driver, vm, cmd, "passt") < 0)
- goto error;
+ return -1;
if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, true, NULL) < 0)
goto error;
@@ -317,11 +292,6 @@ qemuPasstStart(virDomainObj *vm,
return 0;
error:
- if (needUnlink && unlink(net->backend.logFile) < 0) {
- VIR_WARN("Unable to unlink '%s': %s",
- net->backend.logFile, g_strerror(errno));
- }
-
qemuPasstKill(pidfile, passtSocketName);
return -1;
}
--
2.41.0

View File

@ -0,0 +1,44 @@
From 676946491ea25cacc4f6fd11f27bd9989b84767d Mon Sep 17 00:00:00 2001
Message-ID: <676946491ea25cacc4f6fd11f27bd9989b84767d.1708614745.git.jdenemar@redhat.com>
From: Laine Stump <laine@redhat.com>
Date: Fri, 16 Feb 2024 12:43:59 -0500
Subject: [PATCH] Set stubDriverName from hostdev driver model attribute during
pci device setup
commit v9.10.0-129-g8b93d78c83 (first appearing in libvirt-10.0.0) was
supposed to allow forcing a PCI hostdev to be bound to a particular
driver by adding <driver model='blah'/> to the XML for the
device. Unfortunately, a single line was missed during the final
changes to the patch prior to pushing, and the result was that the
driver model could be set to *anything* and it would be accepted but
just ignored.
This patch adds the missing line, which will set the stubDriverName
field of the virPCIDevice object from the hostdev object as the
virPCIDevice is being created. This ends up being used by
virPCIDeviceBindToStub() as the driver that it binds the device to.
Fixes: 8b93d78c8325f1fba5db98848350f3db43f5e7d5
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 41fe8524870facae02be067097ea494c475d77f0)
https://issues.redhat.com/browse/RHEL-25858 [9.4.0]
---
src/hypervisor/virhostdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index 40f8a4bc2c..185ec2ca50 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -242,6 +242,7 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
return -1;
virPCIDeviceSetManaged(actual, hostdev->managed);
+ virPCIDeviceSetStubDriverName(actual, pcisrc->driver.model);
if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO);
--
2.43.2

View File

@ -0,0 +1,144 @@
From 5359921ef11b68dab549b6b28ba11a784e6946a5 Mon Sep 17 00:00:00 2001
Message-ID: <5359921ef11b68dab549b6b28ba11a784e6946a5.1706524416.git.jdenemar@redhat.com>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 24 Jan 2024 19:23:54 +0100
Subject: [PATCH] build: Make daemons depend on generated *_protocol.[ch]
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This should fix build failures when a daemon code is compiled before the
included *_protocol.h headers are ready, such as:
FAILED: src/virtqemud.p/remote_remote_daemon_config.c.o
../src/remote/remote_daemon_config.c: In function daemonConfigNew:
../src/remote/remote_daemon_config.c:111:30: error:
REMOTE_AUTH_POLKIT undeclared (first use in this function)
111 | data->auth_unix_rw = REMOTE_AUTH_POLKIT;
| ^~~~~~~~~~~~~~~~~~
../src/remote/remote_daemon_config.c:111:30: note: each undeclared
identifier is reported only once for each function it appears in
../src/remote/remote_daemon_config.c:115:30: error:
REMOTE_AUTH_NONE undeclared (first use in this function)
115 | data->auth_unix_rw = REMOTE_AUTH_NONE;
| ^~~~~~~~~~~~~~~~
../src/remote/remote_daemon_config.c: In function
daemonConfigLoadOptions:
../src/remote/remote_daemon_config.c:252:31: error:
REMOTE_AUTH_POLKIT undeclared (first use in this function)
252 | if (data->auth_unix_rw == REMOTE_AUTH_POLKIT) {
| ^~~~~~~~~~~~~~~~~~
or
FAILED: src/virtqemud.p/remote_remote_daemon_dispatch.c.o
In file included from ../src/remote/remote_daemon.h:28,
from ../src/remote/remote_daemon_dispatch.c:26:
src/remote/lxc_protocol.h:13:5: error:
unknown type name remote_nonnull_domain
13 | remote_nonnull_domain dom;
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ../src/remote/remote_daemon.h:29,
from ../src/remote/remote_daemon_dispatch.c:26:
src/remote/qemu_protocol.h:13:5: error:
unknown type name remote_nonnull_domain
13 | remote_nonnull_domain dom;
| ^~~~~~~~~~~~~~~~~~~~~
src/remote/qemu_protocol.h:14:5: error:
unknown type name remote_nonnull_string
14 | remote_nonnull_string cmd;
| ^~~~~~~~~~~~~~~~~~~~~
...
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit dcfe548cb01d64e2bdeac456c428e578158232b9)
https://issues.redhat.com/browse/RHEL-15267
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
po/meson.build | 1 +
src/meson.build | 6 +++++-
src/remote/meson.build | 15 +++++++++++----
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/po/meson.build b/po/meson.build
index a20877ad34..592b254447 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -20,6 +20,7 @@ potfiles_dep = [
access_gen_sources,
admin_client_generated,
admin_driver_generated,
+ remote_protocol_generated,
remote_driver_generated,
remote_daemon_generated,
]
diff --git a/src/meson.build b/src/meson.build
index 6538c43628..f52d2d5994 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -616,7 +616,11 @@ foreach daemon : virt_daemons
bin = executable(
daemon['name'],
[
- daemon.get('sources', [ remote_daemon_sources, remote_daemon_generated ]),
+ daemon.get('sources', [
+ remote_protocol_generated,
+ remote_daemon_sources,
+ remote_daemon_generated
+ ]),
dtrace_gen_objects,
],
c_args: [
diff --git a/src/remote/meson.build b/src/remote/meson.build
index 16b903fcaf..43bf2d0083 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -7,8 +7,6 @@ remote_driver_generated = []
foreach name : [ 'remote', 'qemu', 'lxc' ]
client_bodies_h = '@0@_client_bodies.h'.format(name)
- protocol_c = '@0@_protocol.c'.format(name)
- protocol_h = '@0@_protocol.h'.format(name)
protocol_x = '@0@_protocol.x'.format(name)
remote_driver_generated += custom_target(
@@ -20,8 +18,16 @@ foreach name : [ 'remote', 'qemu', 'lxc' ]
],
capture: true,
)
+endforeach
- remote_driver_generated += custom_target(
+remote_protocol_generated = []
+
+foreach name : [ 'remote', 'qemu', 'lxc' ]
+ protocol_c = '@0@_protocol.c'.format(name)
+ protocol_h = '@0@_protocol.h'.format(name)
+ protocol_x = '@0@_protocol.x'.format(name)
+
+ remote_protocol_generated += custom_target(
protocol_h,
input: protocol_x,
output: protocol_h,
@@ -32,7 +38,7 @@ foreach name : [ 'remote', 'qemu', 'lxc' ]
],
)
- remote_driver_generated += custom_target(
+ remote_protocol_generated += custom_target(
protocol_c,
input: protocol_x,
output: protocol_c,
@@ -143,6 +149,7 @@ if conf.has('WITH_REMOTE')
remote_driver_lib = static_library(
'virt_remote_driver',
[
+ remote_protocol_generated,
remote_driver_sources,
remote_driver_generated,
],
--
2.43.0

View File

@ -0,0 +1,976 @@
From 413d6c8c6490caa5ec5479ab10aa493677cc45c0 Mon Sep 17 00:00:00 2001
Message-ID: <413d6c8c6490caa5ec5479ab10aa493677cc45c0.1706524416.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 5 Jan 2024 18:20:14 +0100
Subject: [PATCH] conf: Allow specifying CPU clusters
The default number of CPU clusters is 1, and values other than
that one are currently rejected by all hypervisor drivers.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit ef5c397584b1d03a81c74c27074ec4b1a05d3339)
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/bhyve/bhyve_command.c | 5 +++++
src/conf/cpu_conf.c | 16 +++++++++++++++-
src/conf/cpu_conf.h | 1 +
src/conf/domain_conf.c | 1 +
src/conf/schemas/cputypes.rng | 5 +++++
src/cpu/cpu.c | 1 +
src/libxl/libxl_capabilities.c | 1 +
src/qemu/qemu_command.c | 5 +++++
src/vmx/vmx.c | 7 +++++++
.../x86_64-host+guest,model486-result.xml | 2 +-
.../x86_64-host+guest,models-result.xml | 2 +-
tests/cputestdata/x86_64-host+guest-result.xml | 2 +-
tests/cputestdata/x86_64-host+guest.xml | 2 +-
.../x86_64-host+host-model-nofallback.xml | 2 +-
...host-Haswell-noTSX+Haswell,haswell-result.xml | 2 +-
...aswell-noTSX+Haswell-noTSX,haswell-result.xml | 2 +-
...4-host-Haswell-noTSX+Haswell-noTSX-result.xml | 2 +-
.../x86_64-host-worse+guest-result.xml | 2 +-
.../ppc64-modern-bulk-result-conf.xml | 2 +-
.../ppc64-modern-bulk-result-live.xml | 2 +-
.../ppc64-modern-individual-result-conf.xml | 2 +-
.../ppc64-modern-individual-result-live.xml | 2 +-
.../x86-modern-bulk-result-conf.xml | 2 +-
.../x86-modern-bulk-result-live.xml | 2 +-
.../x86-modern-individual-add-result-conf.xml | 2 +-
.../x86-modern-individual-add-result-live.xml | 2 +-
...e-timeout+graphics-spice-timeout-password.xml | 2 +-
.../qemuhotplug-graphics-spice-timeout.xml | 2 +-
.../fd-memory-no-numa-topology.xml | 2 +-
.../qemuxml2argvdata/fd-memory-numa-topology.xml | 2 +-
.../fd-memory-numa-topology2.xml | 2 +-
.../fd-memory-numa-topology3.xml | 2 +-
tests/qemuxml2argvdata/hugepages-nvdimm.xml | 2 +-
.../memfd-memory-default-hugepage.xml | 2 +-
tests/qemuxml2argvdata/memfd-memory-numa.xml | 2 +-
.../memory-hotplug-nvdimm-access.xml | 2 +-
.../memory-hotplug-nvdimm-align.xml | 2 +-
.../memory-hotplug-nvdimm-label.xml | 2 +-
.../memory-hotplug-nvdimm-pmem.xml | 2 +-
.../memory-hotplug-nvdimm-readonly.xml | 2 +-
tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml | 2 +-
.../memory-hotplug-virtio-mem.xml | 2 +-
.../memory-hotplug-virtio-pmem.xml | 2 +-
.../cpu-numa-disjoint.x86_64-latest.xml | 2 +-
.../cpu-numa-disordered.x86_64-latest.xml | 2 +-
.../cpu-numa-memshared.x86_64-latest.xml | 2 +-
.../cpu-numa-no-memory-element.x86_64-latest.xml | 2 +-
.../cpu-numa1.x86_64-latest.xml | 2 +-
.../cpu-numa2.x86_64-latest.xml | 2 +-
.../memory-hotplug-dimm-addr.x86_64-latest.xml | 2 +-
.../memory-hotplug-dimm.x86_64-latest.xml | 2 +-
.../memory-hotplug-multiple.x86_64-latest.xml | 2 +-
...plug-nvdimm-ppc64-abi-update.ppc64-latest.xml | 2 +-
.../memory-hotplug-nvdimm-ppc64.ppc64-latest.xml | 2 +-
.../memory-hotplug.x86_64-latest.xml | 2 +-
...mad-auto-memory-vcpu-cpuset.x86_64-latest.xml | 2 +-
...cpu-no-cpuset-and-placement.x86_64-latest.xml | 2 +-
...numad-auto-vcpu-no-numatune.x86_64-latest.xml | 2 +-
...mad-static-vcpu-no-numatune.x86_64-latest.xml | 2 +-
.../pci-expander-bus.x86_64-latest.xml | 2 +-
.../pcie-expander-bus.x86_64-latest.xml | 2 +-
.../pseries-phb-numa-node.ppc64-latest.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-10.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-8.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-9.xml | 2 +-
65 files changed, 97 insertions(+), 57 deletions(-)
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 5b388c7a8f..d05b01ae5d 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -672,6 +672,11 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver, virDomainDef *def,
_("Only 1 die per socket is supported"));
return NULL;
}
+ if (def->cpu->clusters != 1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only 1 cluster per die is supported"));
+ return NULL;
+ }
if (nvcpus != def->cpu->sockets * def->cpu->cores * def->cpu->threads) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Invalid CPU topology: total number of vCPUs must equal the product of sockets, cores, and threads"));
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 7abe489733..6e6e1b9a89 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -241,6 +241,7 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu)
copy->fallback = cpu->fallback;
copy->sockets = cpu->sockets;
copy->dies = cpu->dies;
+ copy->clusters = cpu->clusters;
copy->cores = cpu->cores;
copy->threads = cpu->threads;
copy->arch = cpu->arch;
@@ -572,6 +573,12 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
return -1;
}
+ if (virXMLPropUIntDefault(topology, "clusters", 10,
+ VIR_XML_PROP_NONZERO,
+ &def->clusters, 1) < 0) {
+ return -1;
+ }
+
if (virXMLPropUInt(topology, "cores", 10,
VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
&def->cores) < 0) {
@@ -827,10 +834,11 @@ virCPUDefFormatBuf(virBuffer *buf,
virBufferAddLit(buf, "/>\n");
}
- if (def->sockets && def->dies && def->cores && def->threads) {
+ if (def->sockets && def->dies && def->clusters && def->cores && def->threads) {
virBufferAddLit(buf, "<topology");
virBufferAsprintf(buf, " sockets='%u'", def->sockets);
virBufferAsprintf(buf, " dies='%u'", def->dies);
+ virBufferAsprintf(buf, " clusters='%u'", def->clusters);
virBufferAsprintf(buf, " cores='%u'", def->cores);
virBufferAsprintf(buf, " threads='%u'", def->threads);
virBufferAddLit(buf, "/>\n");
@@ -1106,6 +1114,12 @@ virCPUDefIsEqual(virCPUDef *src,
return false;
}
+ if (src->clusters != dst->clusters) {
+ MISMATCH(_("Target CPU clusters %1$d does not match source %2$d"),
+ dst->clusters, src->clusters);
+ return false;
+ }
+
if (src->cores != dst->cores) {
MISMATCH(_("Target CPU cores %1$d does not match source %2$d"),
dst->cores, src->cores);
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index 3e4c53675c..2694022fed 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -148,6 +148,7 @@ struct _virCPUDef {
unsigned int microcodeVersion;
unsigned int sockets;
unsigned int dies;
+ unsigned int clusters;
unsigned int cores;
unsigned int threads;
unsigned int sigFamily;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5d55d2acda..6211d2a51b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2316,6 +2316,7 @@ virDomainDefGetVcpusTopology(const virDomainDef *def,
/* multiplication of 32bit numbers fits into a 64bit variable */
if ((tmp *= def->cpu->dies) > UINT_MAX ||
+ (tmp *= def->cpu->clusters) > UINT_MAX ||
(tmp *= def->cpu->cores) > UINT_MAX ||
(tmp *= def->cpu->threads) > UINT_MAX) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng
index db1aa57158..3a8910e09f 100644
--- a/src/conf/schemas/cputypes.rng
+++ b/src/conf/schemas/cputypes.rng
@@ -92,6 +92,11 @@
<ref name="positiveInteger"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="clusters">
+ <ref name="positiveInteger"/>
+ </attribute>
+ </optional>
<attribute name="cores">
<ref name="positiveInteger"/>
</attribute>
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index bc43aa4e93..4f048d0dad 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -435,6 +435,7 @@ virCPUGetHost(virArch arch,
if (nodeInfo) {
cpu->sockets = nodeInfo->sockets;
cpu->dies = 1;
+ cpu->clusters = 1;
cpu->cores = nodeInfo->cores;
cpu->threads = nodeInfo->threads;
}
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index dfb602ca2f..522256777d 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -152,6 +152,7 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_info)
cpu->cores = phy_info->cores_per_socket;
cpu->threads = phy_info->threads_per_core;
cpu->dies = 1;
+ cpu->clusters = 1;
cpu->sockets = phy_info->nr_cpus / (cpu->cores * cpu->threads);
if (!(data = libxlCapsNodeData(cpu, phy_info->hw_cap)) ||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 653817173b..71daa85e55 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7226,6 +7226,11 @@ qemuBuildSmpCommandLine(virCommand *cmd,
_("Only 1 die per socket is supported"));
return -1;
}
+ if (def->cpu->clusters != 1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only 1 cluster per die is supported"));
+ return -1;
+ }
virBufferAsprintf(&buf, ",sockets=%u", def->cpu->sockets);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_DIES))
virBufferAsprintf(&buf, ",dies=%u", def->cpu->dies);
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 26b89776e1..4ac2320251 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1583,6 +1583,7 @@ virVMXParseConfig(virVMXContext *ctx,
goto cleanup;
}
cpu->dies = 1;
+ cpu->clusters = 1;
cpu->cores = coresPerSocket;
cpu->threads = 1;
@@ -3377,6 +3378,12 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef
goto cleanup;
}
+ if (def->cpu->clusters != 1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only 1 cluster per die is supported"));
+ goto cleanup;
+ }
+
calculated_vcpus = def->cpu->sockets * def->cpu->cores;
if (calculated_vcpus != maxvcpus) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/tests/cputestdata/x86_64-host+guest,model486-result.xml b/tests/cputestdata/x86_64-host+guest,model486-result.xml
index ea8e2d3a48..b533f22b88 100644
--- a/tests/cputestdata/x86_64-host+guest,model486-result.xml
+++ b/tests/cputestdata/x86_64-host+guest,model486-result.xml
@@ -1,6 +1,6 @@
<cpu mode='custom' match='exact'>
<model fallback='allow'>486</model>
- <topology sockets='2' dies='1' cores='4' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
<feature policy='require' name='de'/>
<feature policy='require' name='tsc'/>
<feature policy='require' name='msr'/>
diff --git a/tests/cputestdata/x86_64-host+guest,models-result.xml b/tests/cputestdata/x86_64-host+guest,models-result.xml
index 42664a48b4..e975d9bc18 100644
--- a/tests/cputestdata/x86_64-host+guest,models-result.xml
+++ b/tests/cputestdata/x86_64-host+guest,models-result.xml
@@ -1,6 +1,6 @@
<cpu mode='custom' match='exact'>
<model fallback='allow'>qemu64</model>
- <topology sockets='2' dies='1' cores='4' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
<feature policy='force' name='pbe'/>
<feature policy='force' name='monitor'/>
<feature policy='require' name='ssse3'/>
diff --git a/tests/cputestdata/x86_64-host+guest-result.xml b/tests/cputestdata/x86_64-host+guest-result.xml
index 28e3152cbf..cf41b3f872 100644
--- a/tests/cputestdata/x86_64-host+guest-result.xml
+++ b/tests/cputestdata/x86_64-host+guest-result.xml
@@ -1,6 +1,6 @@
<cpu mode='custom' match='exact'>
<model fallback='allow'>Penryn</model>
- <topology sockets='2' dies='1' cores='4' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
<feature policy='require' name='dca'/>
<feature policy='require' name='xtpr'/>
<feature policy='disable' name='sse4.2'/>
diff --git a/tests/cputestdata/x86_64-host+guest.xml b/tests/cputestdata/x86_64-host+guest.xml
index 28e3152cbf..cf41b3f872 100644
--- a/tests/cputestdata/x86_64-host+guest.xml
+++ b/tests/cputestdata/x86_64-host+guest.xml
@@ -1,6 +1,6 @@
<cpu mode='custom' match='exact'>
<model fallback='allow'>Penryn</model>
- <topology sockets='2' dies='1' cores='4' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
<feature policy='require' name='dca'/>
<feature policy='require' name='xtpr'/>
<feature policy='disable' name='sse4.2'/>
diff --git a/tests/cputestdata/x86_64-host+host-model-nofallback.xml b/tests/cputestdata/x86_64-host+host-model-nofallback.xml
index 16d6e1daf2..881eea7bd0 100644
--- a/tests/cputestdata/x86_64-host+host-model-nofallback.xml
+++ b/tests/cputestdata/x86_64-host+host-model-nofallback.xml
@@ -1,7 +1,7 @@
<cpu mode='custom' match='exact'>
<model fallback='forbid'>Penryn</model>
<vendor>Intel</vendor>
- <topology sockets='1' dies='1' cores='2' threads='1'/>
+ <topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/>
<feature policy='require' name='dca'/>
<feature policy='require' name='xtpr'/>
<feature policy='require' name='tm2'/>
diff --git a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml
index 8eda6684a0..67994c62cc 100644
--- a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml
+++ b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml
@@ -1,6 +1,6 @@
<cpu mode='custom' match='exact'>
<model fallback='allow'>Haswell</model>
- <topology sockets='1' dies='1' cores='2' threads='2'/>
+ <topology sockets='1' dies='1' clusters='1' cores='2' threads='2'/>
<feature policy='disable' name='rtm'/>
<feature policy='disable' name='hle'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml
index cb02449d60..4804c0b818 100644
--- a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml
+++ b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml
@@ -1,6 +1,6 @@
<cpu mode='custom' match='exact'>
<model fallback='allow'>Haswell</model>
- <topology sockets='1' dies='1' cores='2' threads='2'/>
+ <topology sockets='1' dies='1' clusters='1' cores='2' threads='2'/>
<feature policy='disable' name='hle'/>
<feature policy='disable' name='rtm'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml
index 7ee926aba8..c21b331248 100644
--- a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml
+++ b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml
@@ -1,4 +1,4 @@
<cpu mode='custom' match='exact'>
<model fallback='allow'>Haswell-noTSX</model>
- <topology sockets='1' dies='1' cores='2' threads='2'/>
+ <topology sockets='1' dies='1' clusters='1' cores='2' threads='2'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-host-worse+guest-result.xml b/tests/cputestdata/x86_64-host-worse+guest-result.xml
index 9d54c66a8f..712c3ad341 100644
--- a/tests/cputestdata/x86_64-host-worse+guest-result.xml
+++ b/tests/cputestdata/x86_64-host-worse+guest-result.xml
@@ -1,6 +1,6 @@
<cpu mode='custom' match='exact'>
<model fallback='allow'>Penryn</model>
- <topology sockets='2' dies='1' cores='4' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
<feature policy='disable' name='dca'/>
<feature policy='disable' name='xtpr'/>
<feature policy='disable' name='sse4.2'/>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml
index ad11b2f8a6..1a0d28257e 100644
--- a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml
@@ -44,7 +44,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>POWER9</model>
- <topology sockets='1' dies='1' cores='4' threads='8'/>
+ <topology sockets='1' dies='1' clusters='1' cores='4' threads='8'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml
index 2a3b4a495f..b127883b36 100644
--- a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml
@@ -44,7 +44,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>POWER9</model>
- <topology sockets='1' dies='1' cores='4' threads='8'/>
+ <topology sockets='1' dies='1' clusters='1' cores='4' threads='8'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
index 34aec9b965..29f1a5ac45 100644
--- a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
@@ -44,7 +44,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>POWER9</model>
- <topology sockets='1' dies='1' cores='4' threads='8'/>
+ <topology sockets='1' dies='1' clusters='1' cores='4' threads='8'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
index 5ce2cfd0b0..76a85ac9f0 100644
--- a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
@@ -44,7 +44,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>POWER9</model>
- <topology sockets='1' dies='1' cores='4' threads='8'/>
+ <topology sockets='1' dies='1' clusters='1' cores='4' threads='8'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml
index 8d52ffedb4..bec46987ff 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml
+++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml
@@ -20,7 +20,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='4' dies='1' cores='2' threads='1'/>
+ <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml
index f416397e33..be9769c686 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml
+++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml
@@ -20,7 +20,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='4' dies='1' cores='2' threads='1'/>
+ <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
index 0bd2af8e43..539f607818 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
+++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
@@ -20,7 +20,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='4' dies='1' cores='2' threads='1'/>
+ <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml
index b31e6ebe55..acbdd3cfd5 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml
+++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml
@@ -20,7 +20,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='4' dies='1' cores='2' threads='1'/>
+ <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml
index 03964ad01c..ee53339338 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml
@@ -18,7 +18,7 @@
<cpu mode='custom' match='exact' check='partial'>
<model fallback='allow'>core2duo</model>
<vendor>Intel</vendor>
- <topology sockets='1' dies='1' cores='2' threads='1'/>
+ <topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/>
<feature policy='require' name='lahf_lm'/>
<feature policy='require' name='xtpr'/>
<feature policy='require' name='cx16'/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml
index e6b0cc833a..eb9b902fc5 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml
@@ -18,7 +18,7 @@
<cpu mode='custom' match='exact' check='partial'>
<model fallback='allow'>core2duo</model>
<vendor>Intel</vendor>
- <topology sockets='1' dies='1' cores='2' threads='1'/>
+ <topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/>
<feature policy='require' name='lahf_lm'/>
<feature policy='require' name='xtpr'/>
<feature policy='require' name='cx16'/>
diff --git a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml
index 2090bb8288..92f418fb88 100644
--- a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml
+++ b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml
@@ -15,7 +15,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='8' dies='1' cores='1' threads='1'/>
+ <topology sockets='8' dies='1' clusters='1' cores='1' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology.xml
index 2f94690656..543509d832 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology.xml
@@ -15,7 +15,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='1' dies='1' cores='8' threads='1'/>
+ <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
<numa>
<cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
index 3a4e9b478e..d3b98da3c6 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
@@ -15,7 +15,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='1' dies='1' cores='20' threads='1'/>
+ <topology sockets='1' dies='1' clusters='1' cores='20' threads='1'/>
<numa>
<cell id='0' cpus='0-7,16-19' memory='14680064' unit='KiB'/>
<cell id='1' cpus='8-15' memory='14680064' unit='KiB' memAccess='shared'/>
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
index 0f7f74283b..459d1b9d1d 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
@@ -15,7 +15,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='1' dies='1' cores='32' threads='1'/>
+ <topology sockets='1' dies='1' clusters='1' cores='32' threads='1'/>
<numa>
<cell id='0' cpus='0-1,6-31' memory='14680064' unit='KiB'/>
<cell id='1' cpus='2-3' memory='14680064' unit='KiB' memAccess='shared'/>
diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.xml b/tests/qemuxml2argvdata/hugepages-nvdimm.xml
index 1a1500895b..b786b0d3dd 100644
--- a/tests/qemuxml2argvdata/hugepages-nvdimm.xml
+++ b/tests/qemuxml2argvdata/hugepages-nvdimm.xml
@@ -17,7 +17,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml b/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml
index 238d4c6b52..a70bd53134 100644
--- a/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml
+++ b/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml
@@ -19,7 +19,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='1' dies='1' cores='8' threads='1'/>
+ <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
<numa>
<cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2argvdata/memfd-memory-numa.xml
index 1ac87e3aef..0c5d7ba4ef 100644
--- a/tests/qemuxml2argvdata/memfd-memory-numa.xml
+++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml
@@ -22,7 +22,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='1' dies='1' cores='8' threads='1'/>
+ <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
<numa>
<cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml
index bee0346aca..84baf82bf5 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml
@@ -15,7 +15,7 @@
</idmap>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
index decf87db63..664418e805 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
@@ -15,7 +15,7 @@
</idmap>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml
index 8a0dab3908..f998f7f276 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml
@@ -15,7 +15,7 @@
</idmap>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
index a712adfe1e..d66481fd35 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
@@ -15,7 +15,7 @@
</idmap>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml
index 57629ccb8c..56d6b7b712 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml
@@ -15,7 +15,7 @@
</idmap>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml
index 865ddcf0ea..ff6e3b7b0f 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml
@@ -15,7 +15,7 @@
</idmap>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml
index c578209d8a..52fa6b14e9 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml
@@ -11,7 +11,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='2095104' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml
index a8b22dd3c5..2786a739ad 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml
@@ -11,7 +11,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='2095104' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa-disjoint.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa-disjoint.x86_64-latest.xml
index fa2ec31463..4f33094949 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa-disjoint.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa-disjoint.x86_64-latest.xml
@@ -10,7 +10,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='4' threads='2'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
<numa>
<cell id='0' cpus='0-3,8-11' memory='109550' unit='KiB'/>
<cell id='1' cpus='4-7,12-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa-disordered.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa-disordered.x86_64-latest.xml
index 1b4d0bfa67..75dcb8c9e2 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa-disordered.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa-disordered.x86_64-latest.xml
@@ -10,7 +10,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='4' threads='2'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
<numa>
<cell id='0' cpus='0-5' memory='109550' unit='KiB'/>
<cell id='1' cpus='11-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa-memshared.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa-memshared.x86_64-latest.xml
index 47ed9efd69..c45e295921 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa-memshared.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa-memshared.x86_64-latest.xml
@@ -10,7 +10,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='4' threads='2'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
<numa>
<cell id='0' cpus='0-7' memory='109550' unit='KiB' memAccess='shared'/>
<cell id='1' cpus='8-15' memory='109550' unit='KiB' memAccess='private'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.x86_64-latest.xml
index 57bbacdff0..663d137ff5 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.x86_64-latest.xml
@@ -10,7 +10,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='4' threads='2'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
<numa>
<cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
<cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa1.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa1.x86_64-latest.xml
index 57bbacdff0..663d137ff5 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa1.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa1.x86_64-latest.xml
@@ -10,7 +10,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='4' threads='2'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
<numa>
<cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
<cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa2.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa2.x86_64-latest.xml
index 57bbacdff0..663d137ff5 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa2.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa2.x86_64-latest.xml
@@ -10,7 +10,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='4' threads='2'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
<numa>
<cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
<cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml
index 0a32d5491a..38b41e6719 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml
@@ -11,7 +11,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-dimm.x86_64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-dimm.x86_64-latest.xml
index 7c1b7b2c5d..7f0dc85c0e 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-dimm.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-dimm.x86_64-latest.xml
@@ -15,7 +15,7 @@
</idmap>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-multiple.x86_64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-multiple.x86_64-latest.xml
index 42b0f7b880..b3306fb569 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-multiple.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-multiple.x86_64-latest.xml
@@ -11,7 +11,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='2095104' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml
index ae157c4849..4cc0c674df 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml
@@ -11,7 +11,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>POWER9</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml
index 3c1cbc731d..a5c26e3c5b 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml
@@ -11,7 +11,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>POWER9</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug.x86_64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug.x86_64-latest.xml
index 083102e8d6..697819387f 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug.x86_64-latest.xml
@@ -11,7 +11,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
<numa>
<cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
</numa>
diff --git a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.xml b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.xml
index 2d04bc23c2..6068a76464 100644
--- a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.xml
@@ -13,7 +13,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.xml b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.xml
index 80f7284126..6c558526e9 100644
--- a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.xml
@@ -13,7 +13,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.x86_64-latest.xml b/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.x86_64-latest.xml
index 724209f6e3..6e1fecb488 100644
--- a/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.x86_64-latest.xml
@@ -13,7 +13,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.x86_64-latest.xml b/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.x86_64-latest.xml
index 2a4ee0d496..c42d7066f9 100644
--- a/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.x86_64-latest.xml
@@ -10,7 +10,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='1' threads='1'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2xmloutdata/pci-expander-bus.x86_64-latest.xml b/tests/qemuxml2xmloutdata/pci-expander-bus.x86_64-latest.xml
index b63c8c145a..2a6c329a40 100644
--- a/tests/qemuxml2xmloutdata/pci-expander-bus.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/pci-expander-bus.x86_64-latest.xml
@@ -10,7 +10,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='4' threads='2'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
<numa>
<cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
<cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/pcie-expander-bus.x86_64-latest.xml b/tests/qemuxml2xmloutdata/pcie-expander-bus.x86_64-latest.xml
index a441be8ebe..99612740b2 100644
--- a/tests/qemuxml2xmloutdata/pcie-expander-bus.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/pcie-expander-bus.x86_64-latest.xml
@@ -10,7 +10,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
- <topology sockets='2' dies='1' cores='4' threads='2'/>
+ <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
<numa>
<cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
<cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/pseries-phb-numa-node.ppc64-latest.xml b/tests/qemuxml2xmloutdata/pseries-phb-numa-node.ppc64-latest.xml
index 59015846fb..0a044f50b0 100644
--- a/tests/qemuxml2xmloutdata/pseries-phb-numa-node.ppc64-latest.xml
+++ b/tests/qemuxml2xmloutdata/pseries-phb-numa-node.ppc64-latest.xml
@@ -14,7 +14,7 @@
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>POWER9</model>
- <topology sockets='2' dies='1' cores='1' threads='4'/>
+ <topology sockets='2' dies='1' clusters='1' cores='1' threads='4'/>
<numa>
<cell id='0' cpus='0-3' memory='1048576' unit='KiB'/>
<cell id='1' cpus='4-7' memory='1048576' unit='KiB'/>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-10.xml b/tests/vmx2xmldata/esx-in-the-wild-10.xml
index 47ed637920..78129682bd 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-10.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-10.xml
@@ -12,7 +12,7 @@
<type arch='x86_64'>hvm</type>
</os>
<cpu>
- <topology sockets='1' dies='1' cores='2' threads='1'/>
+ <topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-8.xml b/tests/vmx2xmldata/esx-in-the-wild-8.xml
index 0eea610709..47d22ced2a 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-8.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-8.xml
@@ -11,7 +11,7 @@
<type arch='x86_64'>hvm</type>
</os>
<cpu>
- <topology sockets='4' dies='1' cores='2' threads='1'/>
+ <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-9.xml b/tests/vmx2xmldata/esx-in-the-wild-9.xml
index 66eca400dd..ee6be2527f 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-9.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-9.xml
@@ -12,7 +12,7 @@
<type arch='x86_64'>hvm</type>
</os>
<cpu>
- <topology sockets='4' dies='1' cores='4' threads='1'/>
+ <topology sockets='4' dies='1' clusters='1' cores='4' threads='1'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
--
2.43.0

View File

@ -1,392 +0,0 @@
From 7708f08af4581f11d9bc3c3cdf858e55ebdb5a6c Mon Sep 17 00:00:00 2001
Message-ID: <7708f08af4581f11d9bc3c3cdf858e55ebdb5a6c.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 16 May 2023 19:50:50 +0200
Subject: [PATCH] conf: Don't default to raw format for loader/NVRAM
Due to the way the information is stored by the XML parser, we've
had this quirk where specifying any information about the loader
or NVRAM would implicitly set its format to raw. That is,
<nvram>/path/to/guest_VARS.fd</nvram>
would effectively be interpreted as
<nvram format='raw'>/path/to/guest_VARS.fd</nvram>
forcing the use of raw format firmware even when qcow2 format
would normally be preferred based on the ordering of firmware
descriptors. This behavior can be worked around in a number of
ways, but it's fairly unintuitive.
In order to remove this quirk, move the selection of the default
firmware format from the parser down to the individual drivers.
Most drivers only support raw firmware images, so they can
unconditionally set the format early and be done with it; the
QEMU driver, however, supports multiple formats and so in that
case we want this default to be applied as late as possible,
when we have already ruled out the possibility of using qcow2
formatted firmware images.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 10a8997cbb402f7edb9f970af70feee2fc256a1c)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/bhyve/bhyve_firmware.c | 3 ++
src/conf/domain_conf.c | 21 ++++++----
src/libxl/libxl_conf.c | 15 +++++---
src/libxl/xen_xl.c | 2 +
src/libxl/xen_xm.c | 1 +
src/qemu/qemu_firmware.c | 27 +++++++++++--
...uto-efi-format-mismatch.x86_64-latest.args | 38 +++++++++++++++++++
...auto-efi-format-mismatch.x86_64-latest.err | 1 -
.../firmware-auto-efi-format-mismatch.xml | 2 +-
...oader-secure-abi-update.x86_64-latest.args | 8 ++--
tests/qemuxml2argvtest.c | 2 +-
...loader-secure-abi-update.x86_64-latest.xml | 4 +-
12 files changed, 98 insertions(+), 26 deletions(-)
create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.args
delete mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.err
diff --git a/src/bhyve/bhyve_firmware.c b/src/bhyve/bhyve_firmware.c
index 57ab9c7a82..8aaf05dc62 100644
--- a/src/bhyve/bhyve_firmware.c
+++ b/src/bhyve/bhyve_firmware.c
@@ -80,6 +80,9 @@ bhyveFirmwareFillDomain(bhyveConn *driver,
if (!def->os.loader)
def->os.loader = virDomainLoaderDefNew();
+ if (!def->os.loader->format)
+ def->os.loader->format = VIR_STORAGE_FILE_RAW;
+
if (def->os.loader->format != VIR_STORAGE_FILE_RAW) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported loader format '%1$s'"),
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5ac5c0b771..8fa0a6dc73 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3728,7 +3728,6 @@ virDomainLoaderDefNew(void)
virDomainLoaderDef *def = NULL;
def = g_new0(virDomainLoaderDef, 1);
- def->format = VIR_STORAGE_FILE_RAW;
return def;
}
@@ -16771,10 +16770,11 @@ virDomainLoaderDefParseXMLNvram(virDomainLoaderDef *loader,
if (virXMLPropEnumDefault(nvramNode, "format",
virStorageFileFormatTypeFromString, VIR_XML_PROP_NONE,
- &format, VIR_STORAGE_FILE_RAW) < 0) {
+ &format, VIR_STORAGE_FILE_NONE) < 0) {
return -1;
}
- if (format != VIR_STORAGE_FILE_RAW &&
+ if (format &&
+ format != VIR_STORAGE_FILE_RAW &&
format != VIR_STORAGE_FILE_QCOW2) {
virReportError(VIR_ERR_XML_ERROR,
_("Unsupported nvram format '%1$s'"),
@@ -16860,10 +16860,11 @@ virDomainLoaderDefParseXMLLoader(virDomainLoaderDef *loader,
if (virXMLPropEnumDefault(loaderNode, "format",
virStorageFileFormatTypeFromString, VIR_XML_PROP_NONE,
- &format, VIR_STORAGE_FILE_RAW) < 0) {
+ &format, VIR_STORAGE_FILE_NONE) < 0) {
return -1;
}
- if (format != VIR_STORAGE_FILE_RAW &&
+ if (format &&
+ format != VIR_STORAGE_FILE_RAW &&
format != VIR_STORAGE_FILE_QCOW2) {
virReportError(VIR_ERR_XML_ERROR,
_("Unsupported loader format '%1$s'"),
@@ -16894,7 +16895,9 @@ virDomainLoaderDefParseXML(virDomainLoaderDef *loader,
loaderNode) < 0)
return -1;
- if (loader->nvram && loader->format != loader->nvram->format) {
+ if (loader->nvram &&
+ loader->format && loader->nvram->format &&
+ loader->format != loader->nvram->format) {
virReportError(VIR_ERR_XML_ERROR,
_("Format mismatch: loader.format='%1$s' nvram.format='%2$s'"),
virStorageFileFormatTypeToString(loader->format),
@@ -26224,7 +26227,8 @@ virDomainLoaderDefFormatNvram(virBuffer *buf,
return -1;
}
- if (src->format != VIR_STORAGE_FILE_RAW) {
+ if (src->format &&
+ src->format != VIR_STORAGE_FILE_RAW) {
virBufferEscapeString(&attrBuf, " format='%s'",
virStorageFileFormatTypeToString(src->format));
}
@@ -26262,7 +26266,8 @@ virDomainLoaderDefFormat(virBuffer *buf,
virTristateBoolTypeToString(loader->stateless));
}
- if (loader->format != VIR_STORAGE_FILE_RAW) {
+ if (loader->format &&
+ loader->format != VIR_STORAGE_FILE_RAW) {
virBufferEscapeString(&loaderAttrBuf, " format='%s'",
virStorageFileFormatTypeToString(loader->format));
}
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index a1c76935b6..14ad320023 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -654,11 +654,16 @@ libxlMakeDomBuildInfo(virDomainDef *def,
b_info->u.hvm.system_firmware = g_strdup(def->os.loader->path);
}
- if (def->os.loader && def->os.loader->format != VIR_STORAGE_FILE_RAW) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported loader format '%1$s'"),
- virStorageFileFormatTypeToString(def->os.loader->format));
- return -1;
+ if (def->os.loader) {
+ if (!def->os.loader->format)
+ def->os.loader->format = VIR_STORAGE_FILE_RAW;
+
+ if (def->os.loader->format != VIR_STORAGE_FILE_RAW) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported loader format '%1$s'"),
+ virStorageFileFormatTypeToString(def->os.loader->format));
+ return -1;
+ }
}
if (def->emulator) {
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 1cc42fa59f..ab1941454d 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -115,6 +115,7 @@ xenParseXLOS(virConf *conf, virDomainDef *def, virCaps *caps)
if (bios && STREQ(bios, "ovmf")) {
def->os.loader = virDomainLoaderDefNew();
+ def->os.loader->format = VIR_STORAGE_FILE_RAW;
def->os.loader->type = VIR_DOMAIN_LOADER_TYPE_PFLASH;
def->os.loader->readonly = VIR_TRISTATE_BOOL_YES;
if (bios_path)
@@ -126,6 +127,7 @@ xenParseXLOS(virConf *conf, virDomainDef *def, virCaps *caps)
if (caps->guests[i]->ostype == VIR_DOMAIN_OSTYPE_HVM &&
caps->guests[i]->arch.id == def->os.arch) {
def->os.loader = virDomainLoaderDefNew();
+ def->os.loader->format = VIR_STORAGE_FILE_RAW;
def->os.loader->path = g_strdup(caps->guests[i]->arch.defaultInfo.loader);
}
}
diff --git a/src/libxl/xen_xm.c b/src/libxl/xen_xm.c
index 0031d6cbc6..5705a5ec0c 100644
--- a/src/libxl/xen_xm.c
+++ b/src/libxl/xen_xm.c
@@ -43,6 +43,7 @@ xenParseXMOS(virConf *conf, virDomainDef *def)
g_autofree char *boot = NULL;
def->os.loader = virDomainLoaderDefNew();
+ def->os.loader->format = VIR_STORAGE_FILE_RAW;
if (xenConfigCopyString(conf, "kernel", &def->os.loader->path) < 0)
return -1;
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index ebaf32cf71..3dcd139a47 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1082,6 +1082,11 @@ qemuFirmwareEnsureNVRAM(virDomainDef *def,
if (loader->stateless == VIR_TRISTATE_BOOL_YES)
return;
+ /* If the NVRAM format hasn't been set yet, inherit the same as
+ * the loader */
+ if (loader->nvram && !loader->nvram->format)
+ loader->nvram->format = loader->format;
+
/* If the source already exists and is fully specified, including
* the path, leave it alone */
if (loader->nvram && loader->nvram->path)
@@ -1328,7 +1333,7 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
flash->executable.format);
return false;
}
- if (loader &&
+ if (loader && loader->format &&
STRNEQ(flash->executable.format, virStorageFileFormatTypeToString(loader->format))) {
VIR_DEBUG("Discarding loader with mismatching flash format '%s' != '%s'",
flash->executable.format,
@@ -1342,7 +1347,7 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
flash->nvram_template.format);
return false;
}
- if (loader && loader->nvram &&
+ if (loader && loader->nvram && loader->nvram->format &&
STRNEQ(flash->nvram_template.format, virStorageFileFormatTypeToString(loader->nvram->format))) {
VIR_DEBUG("Discarding loader with mismatching nvram template format '%s' != '%s'",
flash->nvram_template.format,
@@ -1630,7 +1635,8 @@ qemuFirmwareFillDomainLegacy(virQEMUDriver *driver,
return 1;
}
- if (loader->format != VIR_STORAGE_FILE_RAW) {
+ if (loader->format &&
+ loader->format != VIR_STORAGE_FILE_RAW) {
VIR_DEBUG("Ignoring legacy entries for loader with flash format '%s'",
virStorageFileFormatTypeToString(loader->format));
return 1;
@@ -1793,6 +1799,7 @@ qemuFirmwareFillDomain(virQEMUDriver *driver,
return -1;
if (loader &&
+ loader->format &&
loader->format != VIR_STORAGE_FILE_RAW &&
loader->format != VIR_STORAGE_FILE_QCOW2) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -1801,6 +1808,7 @@ qemuFirmwareFillDomain(virQEMUDriver *driver,
return -1;
}
if (nvram &&
+ nvram->format &&
nvram->format != VIR_STORAGE_FILE_RAW &&
nvram->format != VIR_STORAGE_FILE_QCOW2) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -1831,8 +1839,19 @@ qemuFirmwareFillDomain(virQEMUDriver *driver,
* CODE:NVRAM pairs that might have been provided at build
* time */
if (!autoSelection) {
- if (qemuFirmwareFillDomainLegacy(driver, def) < 0)
+ if ((ret = qemuFirmwareFillDomainLegacy(driver, def)) < 0)
return -1;
+
+ /* If we've gotten this far without finding a match, it
+ * means that we're dealing with a set of completely
+ * custom paths. In that case, unless the user has
+ * specified otherwise, we have to assume that they're in
+ * raw format */
+ if (ret == 1) {
+ if (loader && !loader->format) {
+ loader->format = VIR_STORAGE_FILE_RAW;
+ }
+ }
} else {
virReportError(VIR_ERR_OPERATION_FAILED,
_("Unable to find any firmware to satisfy '%1$s'"),
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.args
new file mode 100644
index 0000000000..e8d7d580f7
--- /dev/null
+++ b/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.args
@@ -0,0 +1,38 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-guest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=guest,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
+-blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \
+-blockdev '{"driver":"file","filename":"/path/to/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \
+-machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \
+-accel kvm \
+-cpu qemu64 \
+-global driver=cfi.pflash01,property=secure,value=on \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-global ICH9-LPC.noreboot=off \
+-watchdog-action reset \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.err b/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.err
deleted file mode 100644
index abfdfc4357..0000000000
--- a/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.err
+++ /dev/null
@@ -1 +0,0 @@
-XML error: Format mismatch: loader.format='qcow2' nvram.format='raw'
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml b/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml
index 6613d9e9a9..75fa44fd20 100644
--- a/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml
+++ b/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml
@@ -6,7 +6,7 @@
<os firmware='efi'>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
<loader format='qcow2'/>
- <nvram>/path/to/guest_VARS.fd</nvram>
+ <nvram>/path/to/guest_VARS.qcow2</nvram>
</os>
<features>
<acpi/>
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-loader-secure-abi-update.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-auto-efi-loader-secure-abi-update.x86_64-latest.args
index 48f357cbf9..790fb619e8 100644
--- a/tests/qemuxml2argvdata/firmware-auto-efi-loader-secure-abi-update.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/firmware-auto-efi-loader-secure-abi-update.x86_64-latest.args
@@ -10,10 +10,10 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-name guest=guest,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
--blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
--blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
+-blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \
-machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \
-accel kvm \
-cpu qemu64 \
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 370b26a023..9439a5a1e6 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1117,7 +1117,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-nvram-qcow2-network-nbd");
DO_TEST_CAPS_ARCH_LATEST("firmware-auto-efi-format-loader-raw", "aarch64");
DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("firmware-auto-efi-format-loader-raw-abi-update", "aarch64");
- DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-auto-efi-format-mismatch");
+ DO_TEST_CAPS_LATEST("firmware-auto-efi-format-mismatch");
DO_TEST_NOCAPS("clock-utc");
DO_TEST_NOCAPS("clock-localtime");
diff --git a/tests/qemuxml2xmloutdata/firmware-auto-efi-loader-secure-abi-update.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-auto-efi-loader-secure-abi-update.x86_64-latest.xml
index 332d931ba1..f4ff7a0fc2 100644
--- a/tests/qemuxml2xmloutdata/firmware-auto-efi-loader-secure-abi-update.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/firmware-auto-efi-loader-secure-abi-update.x86_64-latest.xml
@@ -10,8 +10,8 @@
<feature enabled='yes' name='enrolled-keys'/>
<feature enabled='yes' name='secure-boot'/>
</firmware>
- <loader readonly='yes' secure='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd</loader>
- <nvram template='/usr/share/edk2/ovmf/OVMF_VARS.secboot.fd'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
+ <loader readonly='yes' secure='yes' type='pflash' format='qcow2'>/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2</loader>
+ <nvram template='/usr/share/edk2/ovmf/OVMF_VARS_4M.secboot.qcow2' format='qcow2'>/var/lib/libvirt/qemu/nvram/guest_VARS.qcow2</nvram>
<boot dev='hd'/>
</os>
<features>
--
2.42.0

View File

@ -0,0 +1,152 @@
From de94232ffb9eef84bb72631979f59bbadfc3cb9e Mon Sep 17 00:00:00 2001
Message-ID: <de94232ffb9eef84bb72631979f59bbadfc3cb9e.1707394626.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 4 Jan 2024 10:03:36 +0100
Subject: [PATCH] conf: Introduce dynamicMemslots attribute for virtio-mem
Introduced in v8.2.0-rc0~74^2~2, QEMU now allows setting
.dynamic-memslots attribute for virtio-mem-pci devices. When
turned on, it allows memory exposed to guest to be split into
multiple memslots and thus smaller memory footprint (see the
original commit for detailed explanation).
Therefore, introduce new <target/> attribute which will control
that QEMU knob.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 53258205854e649bc82310542373df004a4734ab)
Resolves: https://issues.redhat.com/browse/RHEL-15316
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomain.rst | 13 +++++++++++++
src/conf/domain_conf.c | 18 +++++++++++++++++-
src/conf/domain_conf.h | 1 +
src/conf/schemas/domaincommon.rng | 5 +++++
.../memory-hotplug-virtio-mem.xml | 2 +-
5 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 298ad46a45..34b2564909 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -8437,6 +8437,19 @@ Example: usage of the memory devices
The ``node`` subelement configures the guest NUMA node to attach the memory
to. The element shall be used only if the guest has NUMA nodes configured.
+ For ``virtio-mem`` optional attribute ``dynamicMemslots`` can be specified
+ (accepted values "yes"/"no") which allows hypervisor to spread memory into
+ multiple memory slots (allocate them dynamically based on the amount of
+ memory exposed to the guest), resulting in smaller memory footprint. But be
+ aware this may affect vhost-user devices. When enabled, older vhost-user
+ device implementations (such as virtiofs) may refuse to initialize resulting
+ in failed domain startup or device hotplug. When only modern vhost-user
+ based devices will be used or when no vhost-user devices are expected to be
+ used it's beneficial to enable this feature. The current default is
+ hypervisor dependant (for QEMU is "no"). If the default changes and you are
+ having difficulties with vhost-user devices, try toggling this to "no".
+ :since:`Since 10.1.0 and QEMU 8.2.0`
+
The following optional elements may be used:
``label``
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6211d2a51b..ac06fa39f6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13543,6 +13543,10 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node,
&def->target.virtio_mem.requestedsize, false, false) < 0)
return -1;
+ if (virXMLPropTristateBool(node, "dynamicMemslots", VIR_XML_PROP_NONE,
+ &def->target.virtio_mem.dynamicMemslots) < 0)
+ return -1;
+
addrNode = virXPathNode("./address", ctxt);
addr = &def->target.virtio_mem.address;
break;
@@ -21217,6 +21221,12 @@ virDomainMemoryDefCheckABIStability(virDomainMemoryDef *src,
src->target.virtio_mem.address);
return false;
}
+
+ if (src->target.virtio_mem.dynamicMemslots != dst->target.virtio_mem.dynamicMemslots) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Target memory device 'dynamicMemslots' property doesn't match source memory device"));
+ return false;
+ }
break;
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
@@ -25432,6 +25442,7 @@ virDomainMemoryTargetDefFormat(virBuffer *buf,
unsigned int flags)
{
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&childBuf, "<size unit='KiB'>%llu</size>\n", def->size);
if (def->targetNode >= 0)
@@ -25471,6 +25482,11 @@ virDomainMemoryTargetDefFormat(virBuffer *buf,
if (def->target.virtio_mem.address)
virBufferAsprintf(&childBuf, "<address base='0x%llx'/>\n",
def->target.virtio_mem.address);
+
+ if (def->target.virtio_mem.dynamicMemslots) {
+ virBufferAsprintf(&attrBuf, " dynamicMemslots='%s'",
+ virTristateBoolTypeToString(def->target.virtio_mem.dynamicMemslots));
+ }
break;
case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
@@ -25480,7 +25496,7 @@ virDomainMemoryTargetDefFormat(virBuffer *buf,
break;
}
- virXMLFormatElement(buf, "target", NULL, &childBuf);
+ virXMLFormatElement(buf, "target", &attrBuf, &childBuf);
}
static int
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index d176bda5f8..bd283d42df 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2676,6 +2676,7 @@ struct _virDomainMemoryDef {
unsigned long long currentsize; /* kibibytes, valid for an active
domain only and parsed */
unsigned long long address; /* address where memory is mapped */
+ virTristateBool dynamicMemslots;
} virtio_mem;
struct {
} sgx_epc;
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index a34427c330..df44cd9857 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -7268,6 +7268,11 @@
<define name="memorydev-target">
<element name="target">
+ <optional>
+ <attribute name="dynamicMemslots">
+ <ref name="virYesNo"/>
+ </attribute>
+ </optional>
<interleave>
<element name="size">
<ref name="scaledInteger"/>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml
index 52fa6b14e9..20282a131b 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml
@@ -60,7 +60,7 @@
<nodemask>1-3</nodemask>
<pagesize unit='KiB'>2048</pagesize>
</source>
- <target>
+ <target dynamicMemslots='yes'>
<size unit='KiB'>2097152</size>
<node>0</node>
<block unit='KiB'>2048</block>
--
2.43.0

View File

@ -0,0 +1,684 @@
From 130768f856aef1a4fa09a4654fd5ddcaad985795 Mon Sep 17 00:00:00 2001
Message-ID: <130768f856aef1a4fa09a4654fd5ddcaad985795.1706524416.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 5 Jan 2024 16:03:54 +0100
Subject: [PATCH] conf: Report CPU clusters in capabilities XML
For machines that don't expose useful information through sysfs,
the dummy ID 0 is used.
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 5fc56aefb67a085a2f0fd3d2a157c7c029d2ef60)
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/conf/capabilities.c | 5 +-
src/conf/capabilities.h | 1 +
src/conf/schemas/capability.rng | 3 ++
src/libvirt_linux.syms | 1 +
src/util/virhostcpu.c | 22 +++++++++
src/util/virhostcpu.h | 1 +
tests/capabilityschemadata/caps-qemu-kvm.xml | 32 ++++++-------
.../vircaps-aarch64-basic-clusters.xml | 16 +++----
.../vircaps2xmldata/vircaps-aarch64-basic.xml | 32 ++++++-------
.../vircaps-x86_64-basic-dies.xml | 24 +++++-----
.../vircaps2xmldata/vircaps-x86_64-basic.xml | 32 ++++++-------
.../vircaps2xmldata/vircaps-x86_64-caches.xml | 16 +++----
tests/vircaps2xmldata/vircaps-x86_64-hmat.xml | 48 +++++++++----------
.../vircaps-x86_64-resctrl-cdp.xml | 24 +++++-----
.../vircaps-x86_64-resctrl-cmt.xml | 24 +++++-----
.../vircaps-x86_64-resctrl-fake-feature.xml | 24 +++++-----
.../vircaps-x86_64-resctrl-skx-twocaches.xml | 2 +-
.../vircaps-x86_64-resctrl-skx.xml | 2 +-
.../vircaps-x86_64-resctrl.xml | 24 +++++-----
19 files changed, 182 insertions(+), 151 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 32badee7b3..02298e40a3 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -811,9 +811,10 @@ virCapsHostNUMACellCPUFormat(virBuffer *buf,
return -1;
virBufferAsprintf(&childBuf,
- " socket_id='%d' die_id='%d' core_id='%d' siblings='%s'",
+ " socket_id='%d' die_id='%d' cluster_id='%d' core_id='%d' siblings='%s'",
cpus[j].socket_id,
cpus[j].die_id,
+ cpus[j].cluster_id,
cpus[j].core_id,
siblings);
}
@@ -1453,6 +1454,7 @@ virCapabilitiesFillCPUInfo(int cpu_id G_GNUC_UNUSED,
if (virHostCPUGetSocket(cpu_id, &cpu->socket_id) < 0 ||
virHostCPUGetDie(cpu_id, &cpu->die_id) < 0 ||
+ virHostCPUGetCluster(cpu_id, &cpu->cluster_id) < 0 ||
virHostCPUGetCore(cpu_id, &cpu->core_id) < 0)
return -1;
@@ -1712,6 +1714,7 @@ virCapabilitiesHostNUMAInitFake(virCapsHostNUMA *caps)
if (tmp) {
cpus[cid].id = id;
cpus[cid].die_id = 0;
+ cpus[cid].cluster_id = 0;
cpus[cid].socket_id = s;
cpus[cid].core_id = c;
cpus[cid].siblings = virBitmapNewCopy(siblings);
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index 9eaf6e2807..52e395de14 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -89,6 +89,7 @@ struct _virCapsHostNUMACellCPU {
unsigned int id;
unsigned int socket_id;
unsigned int die_id;
+ unsigned int cluster_id;
unsigned int core_id;
virBitmap *siblings;
};
diff --git a/src/conf/schemas/capability.rng b/src/conf/schemas/capability.rng
index b1968df258..a1606941e7 100644
--- a/src/conf/schemas/capability.rng
+++ b/src/conf/schemas/capability.rng
@@ -201,6 +201,9 @@
<attribute name="die_id">
<ref name="unsignedInt"/>
</attribute>
+ <attribute name="cluster_id">
+ <ref name="unsignedInt"/>
+ </attribute>
<attribute name="core_id">
<ref name="unsignedInt"/>
</attribute>
diff --git a/src/libvirt_linux.syms b/src/libvirt_linux.syms
index 55649ae39c..004cbfee97 100644
--- a/src/libvirt_linux.syms
+++ b/src/libvirt_linux.syms
@@ -3,6 +3,7 @@
#
# util/virhostcpu.h
+virHostCPUGetCluster;
virHostCPUGetCore;
virHostCPUGetDie;
virHostCPUGetInfoPopulateLinux;
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 4027547e1e..a3781ca870 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -232,6 +232,28 @@ virHostCPUGetDie(unsigned int cpu, unsigned int *die)
return 0;
}
+int
+virHostCPUGetCluster(unsigned int cpu, unsigned int *cluster)
+{
+ int cluster_id;
+ int ret = virFileReadValueInt(&cluster_id,
+ "%s/cpu/cpu%u/topology/cluster_id",
+ SYSFS_SYSTEM_PATH, cpu);
+
+ if (ret == -1)
+ return -1;
+
+ /* If the file doesn't exists (old kernel) or the value contained
+ * in it is -1 (architecture without CPU clusters), report 0 to
+ * indicate the lack of information */
+ if (ret == -2 || cluster_id < 0)
+ cluster_id = 0;
+
+ *cluster = cluster_id;
+
+ return 0;
+}
+
int
virHostCPUGetCore(unsigned int cpu, unsigned int *core)
{
diff --git a/src/util/virhostcpu.h b/src/util/virhostcpu.h
index 5f0d43e069..d7e09bff22 100644
--- a/src/util/virhostcpu.h
+++ b/src/util/virhostcpu.h
@@ -68,6 +68,7 @@ int virHostCPUStatsAssign(virNodeCPUStatsPtr param,
#ifdef __linux__
int virHostCPUGetSocket(unsigned int cpu, unsigned int *socket);
int virHostCPUGetDie(unsigned int cpu, unsigned int *die);
+int virHostCPUGetCluster(unsigned int cpu, unsigned int *cluster);
int virHostCPUGetCore(unsigned int cpu, unsigned int *core);
virBitmap *virHostCPUGetSiblingsList(unsigned int cpu);
diff --git a/tests/capabilityschemadata/caps-qemu-kvm.xml b/tests/capabilityschemadata/caps-qemu-kvm.xml
index acdbb362cc..317fa0885f 100644
--- a/tests/capabilityschemadata/caps-qemu-kvm.xml
+++ b/tests/capabilityschemadata/caps-qemu-kvm.xml
@@ -64,14 +64,14 @@
<sibling id='1' value='21'/>
</distances>
<cpus num='8'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
- <cpu id='2' socket_id='0' die_id='0' core_id='1' siblings='2'/>
- <cpu id='4' socket_id='0' die_id='0' core_id='2' siblings='4'/>
- <cpu id='6' socket_id='0' die_id='0' core_id='3' siblings='6'/>
- <cpu id='8' socket_id='0' die_id='0' core_id='4' siblings='8'/>
- <cpu id='10' socket_id='0' die_id='0' core_id='5' siblings='10'/>
- <cpu id='12' socket_id='0' die_id='0' core_id='6' siblings='12'/>
- <cpu id='14' socket_id='0' die_id='0' core_id='7' siblings='14'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
+ <cpu id='2' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='2'/>
+ <cpu id='4' socket_id='0' die_id='0' cluster_id='0' core_id='2' siblings='4'/>
+ <cpu id='6' socket_id='0' die_id='0' cluster_id='0' core_id='3' siblings='6'/>
+ <cpu id='8' socket_id='0' die_id='0' cluster_id='0' core_id='4' siblings='8'/>
+ <cpu id='10' socket_id='0' die_id='0' cluster_id='0' core_id='5' siblings='10'/>
+ <cpu id='12' socket_id='0' die_id='0' cluster_id='0' core_id='6' siblings='12'/>
+ <cpu id='14' socket_id='0' die_id='0' cluster_id='0' core_id='7' siblings='14'/>
</cpus>
</cell>
<cell id='1'>
@@ -84,14 +84,14 @@
<sibling id='1' value='10'/>
</distances>
<cpus num='8'>
- <cpu id='1' socket_id='1' die_id='0' core_id='0' siblings='1'/>
- <cpu id='3' socket_id='1' die_id='0' core_id='1' siblings='3'/>
- <cpu id='5' socket_id='1' die_id='0' core_id='2' siblings='5'/>
- <cpu id='7' socket_id='1' die_id='0' core_id='3' siblings='7'/>
- <cpu id='9' socket_id='1' die_id='0' core_id='4' siblings='9'/>
- <cpu id='11' socket_id='1' die_id='0' core_id='5' siblings='11'/>
- <cpu id='13' socket_id='1' die_id='0' core_id='6' siblings='13'/>
- <cpu id='15' socket_id='1' die_id='0' core_id='7' siblings='15'/>
+ <cpu id='1' socket_id='1' die_id='0' cluster_id='0' core_id='0' siblings='1'/>
+ <cpu id='3' socket_id='1' die_id='0' cluster_id='0' core_id='1' siblings='3'/>
+ <cpu id='5' socket_id='1' die_id='0' cluster_id='0' core_id='2' siblings='5'/>
+ <cpu id='7' socket_id='1' die_id='0' cluster_id='0' core_id='3' siblings='7'/>
+ <cpu id='9' socket_id='1' die_id='0' cluster_id='0' core_id='4' siblings='9'/>
+ <cpu id='11' socket_id='1' die_id='0' cluster_id='0' core_id='5' siblings='11'/>
+ <cpu id='13' socket_id='1' die_id='0' cluster_id='0' core_id='6' siblings='13'/>
+ <cpu id='15' socket_id='1' die_id='0' cluster_id='0' core_id='7' siblings='15'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml b/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml
index fe61fc42cc..b37c8e7a20 100644
--- a/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml
+++ b/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml
@@ -14,10 +14,10 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='4'>
- <cpu id='0' socket_id='36' die_id='0' core_id='0' siblings='0-1'/>
- <cpu id='1' socket_id='36' die_id='0' core_id='0' siblings='0-1'/>
- <cpu id='2' socket_id='36' die_id='0' core_id='1' siblings='2-3'/>
- <cpu id='3' socket_id='36' die_id='0' core_id='1' siblings='2-3'/>
+ <cpu id='0' socket_id='36' die_id='0' cluster_id='0' core_id='0' siblings='0-1'/>
+ <cpu id='1' socket_id='36' die_id='0' cluster_id='0' core_id='0' siblings='0-1'/>
+ <cpu id='2' socket_id='36' die_id='0' cluster_id='1' core_id='1' siblings='2-3'/>
+ <cpu id='3' socket_id='36' die_id='0' cluster_id='1' core_id='1' siblings='2-3'/>
</cpus>
</cell>
<cell id='1'>
@@ -26,10 +26,10 @@
<pages unit='KiB' size='2048'>6144</pages>
<pages unit='KiB' size='1048576'>8192</pages>
<cpus num='4'>
- <cpu id='4' socket_id='3180' die_id='0' core_id='256' siblings='4-5'/>
- <cpu id='5' socket_id='3180' die_id='0' core_id='256' siblings='4-5'/>
- <cpu id='6' socket_id='3180' die_id='0' core_id='257' siblings='6-7'/>
- <cpu id='7' socket_id='3180' die_id='0' core_id='257' siblings='6-7'/>
+ <cpu id='4' socket_id='3180' die_id='0' cluster_id='256' core_id='256' siblings='4-5'/>
+ <cpu id='5' socket_id='3180' die_id='0' cluster_id='256' core_id='256' siblings='4-5'/>
+ <cpu id='6' socket_id='3180' die_id='0' cluster_id='257' core_id='257' siblings='6-7'/>
+ <cpu id='7' socket_id='3180' die_id='0' cluster_id='257' core_id='257' siblings='6-7'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-aarch64-basic.xml b/tests/vircaps2xmldata/vircaps-aarch64-basic.xml
index 0a04052c40..5533ae0586 100644
--- a/tests/vircaps2xmldata/vircaps-aarch64-basic.xml
+++ b/tests/vircaps2xmldata/vircaps-aarch64-basic.xml
@@ -16,10 +16,10 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='4'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
- <cpu id='1' socket_id='0' die_id='0' core_id='1' siblings='1'/>
- <cpu id='2' socket_id='0' die_id='0' core_id='2' siblings='2'/>
- <cpu id='3' socket_id='0' die_id='0' core_id='3' siblings='3'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
+ <cpu id='1' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='1'/>
+ <cpu id='2' socket_id='0' die_id='0' cluster_id='0' core_id='2' siblings='2'/>
+ <cpu id='3' socket_id='0' die_id='0' cluster_id='0' core_id='3' siblings='3'/>
</cpus>
</cell>
<cell id='1'>
@@ -28,10 +28,10 @@
<pages unit='KiB' size='2048'>6144</pages>
<pages unit='KiB' size='1048576'>8192</pages>
<cpus num='4'>
- <cpu id='4' socket_id='1' die_id='0' core_id='4' siblings='4'/>
- <cpu id='5' socket_id='1' die_id='0' core_id='5' siblings='5'/>
- <cpu id='6' socket_id='1' die_id='0' core_id='6' siblings='6'/>
- <cpu id='7' socket_id='1' die_id='0' core_id='7' siblings='7'/>
+ <cpu id='4' socket_id='1' die_id='0' cluster_id='0' core_id='4' siblings='4'/>
+ <cpu id='5' socket_id='1' die_id='0' cluster_id='0' core_id='5' siblings='5'/>
+ <cpu id='6' socket_id='1' die_id='0' cluster_id='0' core_id='6' siblings='6'/>
+ <cpu id='7' socket_id='1' die_id='0' cluster_id='0' core_id='7' siblings='7'/>
</cpus>
</cell>
<cell id='2'>
@@ -40,10 +40,10 @@
<pages unit='KiB' size='2048'>8192</pages>
<pages unit='KiB' size='1048576'>10240</pages>
<cpus num='4'>
- <cpu id='8' socket_id='2' die_id='0' core_id='8' siblings='8'/>
- <cpu id='9' socket_id='2' die_id='0' core_id='9' siblings='9'/>
- <cpu id='10' socket_id='2' die_id='0' core_id='10' siblings='10'/>
- <cpu id='11' socket_id='2' die_id='0' core_id='11' siblings='11'/>
+ <cpu id='8' socket_id='2' die_id='0' cluster_id='0' core_id='8' siblings='8'/>
+ <cpu id='9' socket_id='2' die_id='0' cluster_id='0' core_id='9' siblings='9'/>
+ <cpu id='10' socket_id='2' die_id='0' cluster_id='0' core_id='10' siblings='10'/>
+ <cpu id='11' socket_id='2' die_id='0' cluster_id='0' core_id='11' siblings='11'/>
</cpus>
</cell>
<cell id='3'>
@@ -52,10 +52,10 @@
<pages unit='KiB' size='2048'>10240</pages>
<pages unit='KiB' size='1048576'>12288</pages>
<cpus num='4'>
- <cpu id='12' socket_id='3' die_id='0' core_id='12' siblings='12'/>
- <cpu id='13' socket_id='3' die_id='0' core_id='13' siblings='13'/>
- <cpu id='14' socket_id='3' die_id='0' core_id='14' siblings='14'/>
- <cpu id='15' socket_id='3' die_id='0' core_id='15' siblings='15'/>
+ <cpu id='12' socket_id='3' die_id='0' cluster_id='0' core_id='12' siblings='12'/>
+ <cpu id='13' socket_id='3' die_id='0' cluster_id='0' core_id='13' siblings='13'/>
+ <cpu id='14' socket_id='3' die_id='0' cluster_id='0' core_id='14' siblings='14'/>
+ <cpu id='15' socket_id='3' die_id='0' cluster_id='0' core_id='15' siblings='15'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-basic-dies.xml b/tests/vircaps2xmldata/vircaps-x86_64-basic-dies.xml
index 8a3ca2d13c..c86dc4defc 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-basic-dies.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-basic-dies.xml
@@ -14,18 +14,18 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='12'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
- <cpu id='1' socket_id='0' die_id='0' core_id='1' siblings='1'/>
- <cpu id='2' socket_id='0' die_id='1' core_id='0' siblings='2'/>
- <cpu id='3' socket_id='0' die_id='1' core_id='1' siblings='3'/>
- <cpu id='4' socket_id='0' die_id='2' core_id='0' siblings='4'/>
- <cpu id='5' socket_id='0' die_id='2' core_id='1' siblings='5'/>
- <cpu id='6' socket_id='1' die_id='0' core_id='0' siblings='6'/>
- <cpu id='7' socket_id='1' die_id='0' core_id='1' siblings='7'/>
- <cpu id='8' socket_id='1' die_id='1' core_id='0' siblings='8'/>
- <cpu id='9' socket_id='1' die_id='1' core_id='1' siblings='9'/>
- <cpu id='10' socket_id='1' die_id='2' core_id='0' siblings='10'/>
- <cpu id='11' socket_id='1' die_id='2' core_id='1' siblings='11'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
+ <cpu id='1' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='1'/>
+ <cpu id='2' socket_id='0' die_id='1' cluster_id='0' core_id='0' siblings='2'/>
+ <cpu id='3' socket_id='0' die_id='1' cluster_id='0' core_id='1' siblings='3'/>
+ <cpu id='4' socket_id='0' die_id='2' cluster_id='0' core_id='0' siblings='4'/>
+ <cpu id='5' socket_id='0' die_id='2' cluster_id='0' core_id='1' siblings='5'/>
+ <cpu id='6' socket_id='1' die_id='0' cluster_id='0' core_id='0' siblings='6'/>
+ <cpu id='7' socket_id='1' die_id='0' cluster_id='0' core_id='1' siblings='7'/>
+ <cpu id='8' socket_id='1' die_id='1' cluster_id='0' core_id='0' siblings='8'/>
+ <cpu id='9' socket_id='1' die_id='1' cluster_id='0' core_id='1' siblings='9'/>
+ <cpu id='10' socket_id='1' die_id='2' cluster_id='0' core_id='0' siblings='10'/>
+ <cpu id='11' socket_id='1' die_id='2' cluster_id='0' core_id='1' siblings='11'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-basic.xml b/tests/vircaps2xmldata/vircaps-x86_64-basic.xml
index 4da09f889c..9ae155d571 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-basic.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-basic.xml
@@ -14,10 +14,10 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='4'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
- <cpu id='1' socket_id='0' die_id='0' core_id='1' siblings='1'/>
- <cpu id='2' socket_id='0' die_id='0' core_id='2' siblings='2'/>
- <cpu id='3' socket_id='0' die_id='0' core_id='3' siblings='3'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
+ <cpu id='1' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='1'/>
+ <cpu id='2' socket_id='0' die_id='0' cluster_id='0' core_id='2' siblings='2'/>
+ <cpu id='3' socket_id='0' die_id='0' cluster_id='0' core_id='3' siblings='3'/>
</cpus>
</cell>
<cell id='1'>
@@ -26,10 +26,10 @@
<pages unit='KiB' size='2048'>6144</pages>
<pages unit='KiB' size='1048576'>8192</pages>
<cpus num='4'>
- <cpu id='4' socket_id='1' die_id='0' core_id='4' siblings='4'/>
- <cpu id='5' socket_id='1' die_id='0' core_id='5' siblings='5'/>
- <cpu id='6' socket_id='1' die_id='0' core_id='6' siblings='6'/>
- <cpu id='7' socket_id='1' die_id='0' core_id='7' siblings='7'/>
+ <cpu id='4' socket_id='1' die_id='0' cluster_id='0' core_id='4' siblings='4'/>
+ <cpu id='5' socket_id='1' die_id='0' cluster_id='0' core_id='5' siblings='5'/>
+ <cpu id='6' socket_id='1' die_id='0' cluster_id='0' core_id='6' siblings='6'/>
+ <cpu id='7' socket_id='1' die_id='0' cluster_id='0' core_id='7' siblings='7'/>
</cpus>
</cell>
<cell id='2'>
@@ -38,10 +38,10 @@
<pages unit='KiB' size='2048'>8192</pages>
<pages unit='KiB' size='1048576'>10240</pages>
<cpus num='4'>
- <cpu id='8' socket_id='2' die_id='0' core_id='8' siblings='8'/>
- <cpu id='9' socket_id='2' die_id='0' core_id='9' siblings='9'/>
- <cpu id='10' socket_id='2' die_id='0' core_id='10' siblings='10'/>
- <cpu id='11' socket_id='2' die_id='0' core_id='11' siblings='11'/>
+ <cpu id='8' socket_id='2' die_id='0' cluster_id='0' core_id='8' siblings='8'/>
+ <cpu id='9' socket_id='2' die_id='0' cluster_id='0' core_id='9' siblings='9'/>
+ <cpu id='10' socket_id='2' die_id='0' cluster_id='0' core_id='10' siblings='10'/>
+ <cpu id='11' socket_id='2' die_id='0' cluster_id='0' core_id='11' siblings='11'/>
</cpus>
</cell>
<cell id='3'>
@@ -50,10 +50,10 @@
<pages unit='KiB' size='2048'>10240</pages>
<pages unit='KiB' size='1048576'>12288</pages>
<cpus num='4'>
- <cpu id='12' socket_id='3' die_id='0' core_id='12' siblings='12'/>
- <cpu id='13' socket_id='3' die_id='0' core_id='13' siblings='13'/>
- <cpu id='14' socket_id='3' die_id='0' core_id='14' siblings='14'/>
- <cpu id='15' socket_id='3' die_id='0' core_id='15' siblings='15'/>
+ <cpu id='12' socket_id='3' die_id='0' cluster_id='0' core_id='12' siblings='12'/>
+ <cpu id='13' socket_id='3' die_id='0' cluster_id='0' core_id='13' siblings='13'/>
+ <cpu id='14' socket_id='3' die_id='0' cluster_id='0' core_id='14' siblings='14'/>
+ <cpu id='15' socket_id='3' die_id='0' cluster_id='0' core_id='15' siblings='15'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-caches.xml b/tests/vircaps2xmldata/vircaps-x86_64-caches.xml
index 28f00c0a90..05b33147b7 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-caches.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-caches.xml
@@ -17,14 +17,14 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='8'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0,4'/>
- <cpu id='1' socket_id='0' die_id='0' core_id='1' siblings='1,5'/>
- <cpu id='2' socket_id='0' die_id='0' core_id='2' siblings='2,6'/>
- <cpu id='3' socket_id='0' die_id='0' core_id='3' siblings='3,7'/>
- <cpu id='4' socket_id='0' die_id='0' core_id='0' siblings='0,4'/>
- <cpu id='5' socket_id='0' die_id='0' core_id='1' siblings='1,5'/>
- <cpu id='6' socket_id='0' die_id='0' core_id='2' siblings='2,6'/>
- <cpu id='7' socket_id='0' die_id='0' core_id='3' siblings='3,7'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0,4'/>
+ <cpu id='1' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='1,5'/>
+ <cpu id='2' socket_id='0' die_id='0' cluster_id='0' core_id='2' siblings='2,6'/>
+ <cpu id='3' socket_id='0' die_id='0' cluster_id='0' core_id='3' siblings='3,7'/>
+ <cpu id='4' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0,4'/>
+ <cpu id='5' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='1,5'/>
+ <cpu id='6' socket_id='0' die_id='0' cluster_id='0' core_id='2' siblings='2,6'/>
+ <cpu id='7' socket_id='0' die_id='0' cluster_id='0' core_id='3' siblings='3,7'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-hmat.xml b/tests/vircaps2xmldata/vircaps-x86_64-hmat.xml
index 6fe5751666..2b97354bf3 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-hmat.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-hmat.xml
@@ -25,30 +25,30 @@
<line value='16' unit='B'/>
</cache>
<cpus num='24'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
- <cpu id='1' socket_id='1' die_id='0' core_id='0' siblings='1'/>
- <cpu id='2' socket_id='2' die_id='0' core_id='0' siblings='2'/>
- <cpu id='3' socket_id='3' die_id='0' core_id='0' siblings='3'/>
- <cpu id='4' socket_id='4' die_id='0' core_id='0' siblings='4'/>
- <cpu id='5' socket_id='5' die_id='0' core_id='0' siblings='5'/>
- <cpu id='6' socket_id='6' die_id='0' core_id='0' siblings='6'/>
- <cpu id='7' socket_id='7' die_id='0' core_id='0' siblings='7'/>
- <cpu id='8' socket_id='8' die_id='0' core_id='0' siblings='8'/>
- <cpu id='9' socket_id='9' die_id='0' core_id='0' siblings='9'/>
- <cpu id='10' socket_id='10' die_id='0' core_id='0' siblings='10'/>
- <cpu id='11' socket_id='11' die_id='0' core_id='0' siblings='11'/>
- <cpu id='12' socket_id='12' die_id='0' core_id='0' siblings='12'/>
- <cpu id='13' socket_id='13' die_id='0' core_id='0' siblings='13'/>
- <cpu id='14' socket_id='14' die_id='0' core_id='0' siblings='14'/>
- <cpu id='15' socket_id='15' die_id='0' core_id='0' siblings='15'/>
- <cpu id='16' socket_id='16' die_id='0' core_id='0' siblings='16'/>
- <cpu id='17' socket_id='17' die_id='0' core_id='0' siblings='17'/>
- <cpu id='18' socket_id='18' die_id='0' core_id='0' siblings='18'/>
- <cpu id='19' socket_id='19' die_id='0' core_id='0' siblings='19'/>
- <cpu id='20' socket_id='20' die_id='0' core_id='0' siblings='20'/>
- <cpu id='21' socket_id='21' die_id='0' core_id='0' siblings='21'/>
- <cpu id='22' socket_id='22' die_id='0' core_id='0' siblings='22'/>
- <cpu id='23' socket_id='23' die_id='0' core_id='0' siblings='23'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
+ <cpu id='1' socket_id='1' die_id='0' cluster_id='0' core_id='0' siblings='1'/>
+ <cpu id='2' socket_id='2' die_id='0' cluster_id='0' core_id='0' siblings='2'/>
+ <cpu id='3' socket_id='3' die_id='0' cluster_id='0' core_id='0' siblings='3'/>
+ <cpu id='4' socket_id='4' die_id='0' cluster_id='0' core_id='0' siblings='4'/>
+ <cpu id='5' socket_id='5' die_id='0' cluster_id='0' core_id='0' siblings='5'/>
+ <cpu id='6' socket_id='6' die_id='0' cluster_id='0' core_id='0' siblings='6'/>
+ <cpu id='7' socket_id='7' die_id='0' cluster_id='0' core_id='0' siblings='7'/>
+ <cpu id='8' socket_id='8' die_id='0' cluster_id='0' core_id='0' siblings='8'/>
+ <cpu id='9' socket_id='9' die_id='0' cluster_id='0' core_id='0' siblings='9'/>
+ <cpu id='10' socket_id='10' die_id='0' cluster_id='0' core_id='0' siblings='10'/>
+ <cpu id='11' socket_id='11' die_id='0' cluster_id='0' core_id='0' siblings='11'/>
+ <cpu id='12' socket_id='12' die_id='0' cluster_id='0' core_id='0' siblings='12'/>
+ <cpu id='13' socket_id='13' die_id='0' cluster_id='0' core_id='0' siblings='13'/>
+ <cpu id='14' socket_id='14' die_id='0' cluster_id='0' core_id='0' siblings='14'/>
+ <cpu id='15' socket_id='15' die_id='0' cluster_id='0' core_id='0' siblings='15'/>
+ <cpu id='16' socket_id='16' die_id='0' cluster_id='0' core_id='0' siblings='16'/>
+ <cpu id='17' socket_id='17' die_id='0' cluster_id='0' core_id='0' siblings='17'/>
+ <cpu id='18' socket_id='18' die_id='0' cluster_id='0' core_id='0' siblings='18'/>
+ <cpu id='19' socket_id='19' die_id='0' cluster_id='0' core_id='0' siblings='19'/>
+ <cpu id='20' socket_id='20' die_id='0' cluster_id='0' core_id='0' siblings='20'/>
+ <cpu id='21' socket_id='21' die_id='0' cluster_id='0' core_id='0' siblings='21'/>
+ <cpu id='22' socket_id='22' die_id='0' cluster_id='0' core_id='0' siblings='22'/>
+ <cpu id='23' socket_id='23' die_id='0' cluster_id='0' core_id='0' siblings='23'/>
</cpus>
</cell>
<cell id='1'>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml
index ee26fe9464..167b217d8e 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml
@@ -17,12 +17,12 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='6'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
- <cpu id='1' socket_id='0' die_id='0' core_id='1' siblings='1'/>
- <cpu id='2' socket_id='0' die_id='0' core_id='2' siblings='2'/>
- <cpu id='3' socket_id='0' die_id='0' core_id='3' siblings='3'/>
- <cpu id='4' socket_id='0' die_id='0' core_id='4' siblings='4'/>
- <cpu id='5' socket_id='0' die_id='0' core_id='5' siblings='5'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
+ <cpu id='1' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='1'/>
+ <cpu id='2' socket_id='0' die_id='0' cluster_id='0' core_id='2' siblings='2'/>
+ <cpu id='3' socket_id='0' die_id='0' cluster_id='0' core_id='3' siblings='3'/>
+ <cpu id='4' socket_id='0' die_id='0' cluster_id='0' core_id='4' siblings='4'/>
+ <cpu id='5' socket_id='0' die_id='0' cluster_id='0' core_id='5' siblings='5'/>
</cpus>
</cell>
<cell id='1'>
@@ -31,12 +31,12 @@
<pages unit='KiB' size='2048'>6144</pages>
<pages unit='KiB' size='1048576'>8192</pages>
<cpus num='6'>
- <cpu id='6' socket_id='1' die_id='0' core_id='0' siblings='6'/>
- <cpu id='7' socket_id='1' die_id='0' core_id='1' siblings='7'/>
- <cpu id='8' socket_id='1' die_id='0' core_id='2' siblings='8'/>
- <cpu id='9' socket_id='1' die_id='0' core_id='3' siblings='9'/>
- <cpu id='10' socket_id='1' die_id='0' core_id='4' siblings='10'/>
- <cpu id='11' socket_id='1' die_id='0' core_id='5' siblings='11'/>
+ <cpu id='6' socket_id='1' die_id='0' cluster_id='0' core_id='0' siblings='6'/>
+ <cpu id='7' socket_id='1' die_id='0' cluster_id='0' core_id='1' siblings='7'/>
+ <cpu id='8' socket_id='1' die_id='0' cluster_id='0' core_id='2' siblings='8'/>
+ <cpu id='9' socket_id='1' die_id='0' cluster_id='0' core_id='3' siblings='9'/>
+ <cpu id='10' socket_id='1' die_id='0' cluster_id='0' core_id='4' siblings='10'/>
+ <cpu id='11' socket_id='1' die_id='0' cluster_id='0' core_id='5' siblings='11'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cmt.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cmt.xml
index acdd97ec58..311bb58e6a 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cmt.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cmt.xml
@@ -17,12 +17,12 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='6'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
- <cpu id='1' socket_id='0' die_id='0' core_id='1' siblings='1'/>
- <cpu id='2' socket_id='0' die_id='0' core_id='2' siblings='2'/>
- <cpu id='3' socket_id='0' die_id='0' core_id='3' siblings='3'/>
- <cpu id='4' socket_id='0' die_id='0' core_id='4' siblings='4'/>
- <cpu id='5' socket_id='0' die_id='0' core_id='5' siblings='5'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
+ <cpu id='1' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='1'/>
+ <cpu id='2' socket_id='0' die_id='0' cluster_id='0' core_id='2' siblings='2'/>
+ <cpu id='3' socket_id='0' die_id='0' cluster_id='0' core_id='3' siblings='3'/>
+ <cpu id='4' socket_id='0' die_id='0' cluster_id='0' core_id='4' siblings='4'/>
+ <cpu id='5' socket_id='0' die_id='0' cluster_id='0' core_id='5' siblings='5'/>
</cpus>
</cell>
<cell id='1'>
@@ -31,12 +31,12 @@
<pages unit='KiB' size='2048'>6144</pages>
<pages unit='KiB' size='1048576'>8192</pages>
<cpus num='6'>
- <cpu id='6' socket_id='1' die_id='0' core_id='0' siblings='6'/>
- <cpu id='7' socket_id='1' die_id='0' core_id='1' siblings='7'/>
- <cpu id='8' socket_id='1' die_id='0' core_id='2' siblings='8'/>
- <cpu id='9' socket_id='1' die_id='0' core_id='3' siblings='9'/>
- <cpu id='10' socket_id='1' die_id='0' core_id='4' siblings='10'/>
- <cpu id='11' socket_id='1' die_id='0' core_id='5' siblings='11'/>
+ <cpu id='6' socket_id='1' die_id='0' cluster_id='0' core_id='0' siblings='6'/>
+ <cpu id='7' socket_id='1' die_id='0' cluster_id='0' core_id='1' siblings='7'/>
+ <cpu id='8' socket_id='1' die_id='0' cluster_id='0' core_id='2' siblings='8'/>
+ <cpu id='9' socket_id='1' die_id='0' cluster_id='0' core_id='3' siblings='9'/>
+ <cpu id='10' socket_id='1' die_id='0' cluster_id='0' core_id='4' siblings='10'/>
+ <cpu id='11' socket_id='1' die_id='0' cluster_id='0' core_id='5' siblings='11'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-fake-feature.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-fake-feature.xml
index 1327d85c98..d85407f0b1 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-fake-feature.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-fake-feature.xml
@@ -17,12 +17,12 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='6'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
- <cpu id='1' socket_id='0' die_id='0' core_id='1' siblings='1'/>
- <cpu id='2' socket_id='0' die_id='0' core_id='2' siblings='2'/>
- <cpu id='3' socket_id='0' die_id='0' core_id='3' siblings='3'/>
- <cpu id='4' socket_id='0' die_id='0' core_id='4' siblings='4'/>
- <cpu id='5' socket_id='0' die_id='0' core_id='5' siblings='5'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
+ <cpu id='1' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='1'/>
+ <cpu id='2' socket_id='0' die_id='0' cluster_id='0' core_id='2' siblings='2'/>
+ <cpu id='3' socket_id='0' die_id='0' cluster_id='0' core_id='3' siblings='3'/>
+ <cpu id='4' socket_id='0' die_id='0' cluster_id='0' core_id='4' siblings='4'/>
+ <cpu id='5' socket_id='0' die_id='0' cluster_id='0' core_id='5' siblings='5'/>
</cpus>
</cell>
<cell id='1'>
@@ -31,12 +31,12 @@
<pages unit='KiB' size='2048'>6144</pages>
<pages unit='KiB' size='1048576'>8192</pages>
<cpus num='6'>
- <cpu id='6' socket_id='1' die_id='0' core_id='0' siblings='6'/>
- <cpu id='7' socket_id='1' die_id='0' core_id='1' siblings='7'/>
- <cpu id='8' socket_id='1' die_id='0' core_id='2' siblings='8'/>
- <cpu id='9' socket_id='1' die_id='0' core_id='3' siblings='9'/>
- <cpu id='10' socket_id='1' die_id='0' core_id='4' siblings='10'/>
- <cpu id='11' socket_id='1' die_id='0' core_id='5' siblings='11'/>
+ <cpu id='6' socket_id='1' die_id='0' cluster_id='0' core_id='0' siblings='6'/>
+ <cpu id='7' socket_id='1' die_id='0' cluster_id='0' core_id='1' siblings='7'/>
+ <cpu id='8' socket_id='1' die_id='0' cluster_id='0' core_id='2' siblings='8'/>
+ <cpu id='9' socket_id='1' die_id='0' cluster_id='0' core_id='3' siblings='9'/>
+ <cpu id='10' socket_id='1' die_id='0' cluster_id='0' core_id='4' siblings='10'/>
+ <cpu id='11' socket_id='1' die_id='0' cluster_id='0' core_id='5' siblings='11'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx-twocaches.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx-twocaches.xml
index 6769bd0591..eb53eb2142 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx-twocaches.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx-twocaches.xml
@@ -17,7 +17,7 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='1'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml
index bc52480905..38ea0bdc27 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml
@@ -17,7 +17,7 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='1'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
</cpus>
</cell>
</cells>
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml
index b638bbd1c9..fd854ee91e 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml
@@ -17,12 +17,12 @@
<pages unit='KiB' size='2048'>4096</pages>
<pages unit='KiB' size='1048576'>6144</pages>
<cpus num='6'>
- <cpu id='0' socket_id='0' die_id='0' core_id='0' siblings='0'/>
- <cpu id='1' socket_id='0' die_id='0' core_id='1' siblings='1'/>
- <cpu id='2' socket_id='0' die_id='0' core_id='2' siblings='2'/>
- <cpu id='3' socket_id='0' die_id='0' core_id='3' siblings='3'/>
- <cpu id='4' socket_id='0' die_id='0' core_id='4' siblings='4'/>
- <cpu id='5' socket_id='0' die_id='0' core_id='5' siblings='5'/>
+ <cpu id='0' socket_id='0' die_id='0' cluster_id='0' core_id='0' siblings='0'/>
+ <cpu id='1' socket_id='0' die_id='0' cluster_id='0' core_id='1' siblings='1'/>
+ <cpu id='2' socket_id='0' die_id='0' cluster_id='0' core_id='2' siblings='2'/>
+ <cpu id='3' socket_id='0' die_id='0' cluster_id='0' core_id='3' siblings='3'/>
+ <cpu id='4' socket_id='0' die_id='0' cluster_id='0' core_id='4' siblings='4'/>
+ <cpu id='5' socket_id='0' die_id='0' cluster_id='0' core_id='5' siblings='5'/>
</cpus>
</cell>
<cell id='1'>
@@ -31,12 +31,12 @@
<pages unit='KiB' size='2048'>6144</pages>
<pages unit='KiB' size='1048576'>8192</pages>
<cpus num='6'>
- <cpu id='6' socket_id='1' die_id='0' core_id='0' siblings='6'/>
- <cpu id='7' socket_id='1' die_id='0' core_id='1' siblings='7'/>
- <cpu id='8' socket_id='1' die_id='0' core_id='2' siblings='8'/>
- <cpu id='9' socket_id='1' die_id='0' core_id='3' siblings='9'/>
- <cpu id='10' socket_id='1' die_id='0' core_id='4' siblings='10'/>
- <cpu id='11' socket_id='1' die_id='0' core_id='5' siblings='11'/>
+ <cpu id='6' socket_id='1' die_id='0' cluster_id='0' core_id='0' siblings='6'/>
+ <cpu id='7' socket_id='1' die_id='0' cluster_id='0' core_id='1' siblings='7'/>
+ <cpu id='8' socket_id='1' die_id='0' cluster_id='0' core_id='2' siblings='8'/>
+ <cpu id='9' socket_id='1' die_id='0' cluster_id='0' core_id='3' siblings='9'/>
+ <cpu id='10' socket_id='1' die_id='0' cluster_id='0' core_id='4' siblings='10'/>
+ <cpu id='11' socket_id='1' die_id='0' cluster_id='0' core_id='5' siblings='11'/>
</cpus>
</cell>
</cells>
--
2.43.0

View File

@ -0,0 +1,138 @@
From 8d84e4af4cbb93d73f4d9967f517552257f025f5 Mon Sep 17 00:00:00 2001
Message-ID: <8d84e4af4cbb93d73f4d9967f517552257f025f5.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 18:26:29 +0100
Subject: [PATCH] conf: node_device: Refactor
'virNodeDeviceCapVPDParseCustomFields' to fix error reporting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The errors raised in virNodeDeviceCapVPDParseCustomFields were actually
ignored by continuing the parse rather than raised.
Rather than just replace 'continue' by 'return -1' this patch refactors
the whole parser to simplify it as well as report reasonable errors.
Parsing of individual fields is done without XPath and is extracted into
a common helper.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit ea8d864d9ecf3ee72910ccc1497244f1ef74e948)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/conf/node_device_conf.c | 81 ++++++++++++++++++-------------------
1 file changed, 40 insertions(+), 41 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index d7e1a23034..0f2c341967 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -953,63 +953,62 @@ virNodeDevCapMdevTypesParseXML(xmlXPathContextPtr ctxt,
return ret;
}
+
static int
-virNodeDeviceCapVPDParseCustomFields(xmlXPathContextPtr ctxt, virPCIVPDResource *res, bool readOnly)
+virNodeDeviceCapVPDParseCustomFieldOne(xmlNodePtr node,
+ virPCIVPDResource *res,
+ bool read_only,
+ const char keyword_prefix)
+{
+ g_autofree char *value = NULL;
+ g_autofree char *index = NULL;
+ g_autofree char *keyword = NULL;
+
+ if (!(index = virXMLPropStringRequired(node, "index")))
+ return -1;
+
+ if (strlen(index) != 1) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("'%1$s' 'index' value '%2$s' malformed"),
+ node->name, index);
+ return -1;
+ }
+
+ keyword = g_strdup_printf("%c%c", keyword_prefix, index[0]);
+
+ if (!(value = virXMLNodeContentString(node)))
+ return -1;
+
+ virPCIVPDResourceUpdateKeyword(res, read_only, keyword, value);
+ return 0;
+}
+
+
+static int
+virNodeDeviceCapVPDParseCustomFields(xmlXPathContextPtr ctxt,
+ virPCIVPDResource *res,
+ bool readOnly)
{
int nfields = -1;
g_autofree xmlNodePtr *nodes = NULL;
size_t i = 0;
- if ((nfields = virXPathNodeSet("./vendor_field[@index]", ctxt, &nodes)) < 0)
+ if ((nfields = virXPathNodeSet("./vendor_field", ctxt, &nodes)) < 0)
return -1;
for (i = 0; i < nfields; i++) {
- g_autofree char *value = NULL;
- g_autofree char *index = NULL;
- VIR_XPATH_NODE_AUTORESTORE(ctxt)
- g_autofree char *keyword = NULL;
-
- ctxt->node = nodes[i];
- if (!(index = virXPathString("string(./@index[1])", ctxt)) ||
- strlen(index) > 1) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("<vendor_field> evaluation has failed"));
- continue;
- }
- if (!(value = virXPathString("string(./text())", ctxt))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("<vendor_field> value evaluation has failed"));
- continue;
- }
- keyword = g_strdup_printf("V%c", index[0]);
- virPCIVPDResourceUpdateKeyword(res, readOnly, keyword, value);
+ if (virNodeDeviceCapVPDParseCustomFieldOne(nodes[i], res, readOnly, 'V') < 0)
+ return -1;
}
VIR_FREE(nodes);
if (!readOnly) {
- if ((nfields = virXPathNodeSet("./system_field[@index]", ctxt, &nodes)) < 0)
+ if ((nfields = virXPathNodeSet("./system_field", ctxt, &nodes)) < 0)
return -1;
for (i = 0; i < nfields; i++) {
- g_autofree char *value = NULL;
- g_autofree char *index = NULL;
- g_autofree char *keyword = NULL;
- VIR_XPATH_NODE_AUTORESTORE(ctxt);
-
- ctxt->node = nodes[i];
- if (!(index = virXPathString("string(./@index[1])", ctxt)) ||
- strlen(index) > 1) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("<system_field> evaluation has failed"));
- continue;
- }
- if (!(value = virXPathString("string(./text())", ctxt))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("<system_field> value evaluation has failed"));
- continue;
- }
- keyword = g_strdup_printf("Y%c", index[0]);
- virPCIVPDResourceUpdateKeyword(res, readOnly, keyword, value);
+ if (virNodeDeviceCapVPDParseCustomFieldOne(nodes[i], res, readOnly, 'Y') < 0)
+ return -1;
}
}
--
2.43.0

View File

@ -0,0 +1,47 @@
From 15145b5ecb2e9186e42bbb295e1d44f93ff25cfb Mon Sep 17 00:00:00 2001
Message-ID: <15145b5ecb2e9186e42bbb295e1d44f93ff25cfb.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 16:27:35 +0100
Subject: [PATCH] conf: virNodeDeviceCapVPDParse*: Remove pointless NULL checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function are never called with NULL argument so the checks can be
removed.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit fb69acf5c255f6baedefe2a2535325af8088ced5)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/conf/node_device_conf.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index dd174d3020..d7e1a23034 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1023,9 +1023,6 @@ virNodeDeviceCapVPDParseReadOnlyFields(xmlXPathContextPtr ctxt, virPCIVPDResourc
"serial_number", "part_number", NULL};
size_t i = 0;
- if (res == NULL)
- return -1;
-
res->ro = virPCIVPDResourceRONew();
while (keywords[i]) {
@@ -1061,9 +1058,6 @@ virNodeDeviceCapVPDParseXML(xmlXPathContextPtr ctxt, virPCIVPDResource **res)
size_t i = 0;
g_autoptr(virPCIVPDResource) newres = g_new0(virPCIVPDResource, 1);
- if (res == NULL)
- return -1;
-
if (!(newres->name = virXPathString("string(./name)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Could not read a device name from the <name> element"));
--
2.43.0

View File

@ -0,0 +1,123 @@
From 8d48d5fe02c0afcf5bbe68e0a182ee11f9a108dc Mon Sep 17 00:00:00 2001
Message-ID: <8d48d5fe02c0afcf5bbe68e0a182ee11f9a108dc.1708614745.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 19 Feb 2024 15:37:16 +0100
Subject: [PATCH] domain_validate: Account for NVDIMM label size properly when
checking for memory conflicts
As of v9.8.0-rc1~7 we check whether two <memory/> devices don't
overlap (since we allow setting where a <memory/> device should
be mapped to). We do this pretty straightforward, by comparing
start and end address of each <memory/> device combination.
But since only the start address is given (an exposed in the
XML), the end address is computed trivially as:
start + mem->size * 1024
And for majority of memory device types this works. Except for
NVDIMMs. For them the <memory/> device consists of two separate
regions: 1) actual memory device, and 2) label.
Label is where NVDIMM stores some additional information like
namespaces partition and so on. But it's not mapped into the
guest the same way as actual memory device. In fact, mem->size is
a sum of both actual memory device and label sizes. And to make
things a bit worse, both sizes are subject to alignment (either
the alignsize value specified in XML, or system page size if not
specified in XML).
Therefore, to get the size of actual memory device we need to
take mem->size and substract label size rounded up to alignment.
If we don't do this we report there's an overlap between two
NVDIMMs even when in reality there's none.
Fixes: 3fd64fb0e236fc80ffa2cc977c0d471f11fc39bf
Fixes: 91f9a9fb4fc0d34ed8d7a869de3d9f87687c3618
Resolves: https://issues.redhat.com/browse/RHEL-4452?focusedId=23805174#comment-23805174
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 4545f313c23e7000451d1cec793ebc8da1a2c25f)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_validate.c | 51 ++++++++++++++++++++++++++++++++++++--
1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 46479f10f2..faa7659f07 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2225,6 +2225,53 @@ virDomainHostdevDefValidate(const virDomainHostdevDef *hostdev)
}
+/**
+ * virDomainMemoryGetMappedSize:
+ * @mem: memory device definition
+ *
+ * For given memory device definition (@mem) calculate size mapped into
+ * the guest. This is usually mem->size, except for NVDIMM where its
+ * label is mapped elsewhere.
+ *
+ * Returns: Number of bytes a memory device takes when mapped into a
+ * guest.
+ */
+static unsigned long long
+virDomainMemoryGetMappedSize(const virDomainMemoryDef *mem)
+{
+ unsigned long long ret = mem->size;
+
+ if (mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM) {
+ unsigned long long alignsize = mem->source.nvdimm.alignsize;
+ unsigned long long labelsize = 0;
+
+ /* For NVDIMM the situation is a bit more complicated. Firstly,
+ * its <label/> is not mapped as a part of memory device, so we
+ * must subtract label size from NVDIMM size. Secondly,
+ * remaining memory is then aligned again (rounded down). But
+ * for our purposes we might just round label size up and
+ * achieve the same (numeric) result. */
+
+ if (alignsize == 0) {
+ long pagesize = virGetSystemPageSizeKB();
+
+ /* If no alignment is specified in the XML, fallback to
+ * system page size alignment. */
+ if (pagesize > 0)
+ alignsize = pagesize;
+ }
+
+ if (alignsize > 0) {
+ labelsize = VIR_ROUND_UP(mem->target.nvdimm.labelsize, alignsize);
+
+ ret -= labelsize;
+ }
+ }
+
+ return ret * 1024;
+}
+
+
static int
virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
const virDomainDef *def)
@@ -2259,7 +2306,7 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
}
/* thisStart and thisEnd are in bytes, mem->size in kibibytes */
- thisEnd = thisStart + mem->size * 1024;
+ thisEnd = thisStart + virDomainMemoryGetMappedSize(mem);
for (i = 0; i < def->nmems; i++) {
const virDomainMemoryDef *other = def->mems[i];
@@ -2316,7 +2363,7 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
if (thisStart == 0 || otherStart == 0)
continue;
- otherEnd = otherStart + other->size * 1024;
+ otherEnd = otherStart + virDomainMemoryGetMappedSize(other);
if ((thisStart <= otherStart && thisEnd > otherStart) ||
(otherStart <= thisStart && otherEnd > thisStart)) {
--
2.43.2

View File

@ -0,0 +1,53 @@
From d3593c911c3e02cf5c9c876cddf2fc8ba2eede06 Mon Sep 17 00:00:00 2001
Message-ID: <d3593c911c3e02cf5c9c876cddf2fc8ba2eede06.1706524416.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 19 Jan 2024 08:22:13 +0100
Subject: [PATCH] domain_validate: Check for domain address conflicts fully
Current implementation of virDomainMemoryDefCheckConflict() does
only a one way comparison, i.e. if there's a memory device within
def->mems[] which address falls in [mem->address, mem->address +
mem->size] range (mem is basically an iterator within
def->mems[]). And for static XML this works just fine. Problem is
with hot/cold plugging of a memory device. Then mem points to
freshly parsed memory device and these half checks are
insufficient. Not only we must check whether an existing memory
device doesn't clash with freshly parsed memory device, but also
whether freshly parsed memory device does not fall into range of
already existing memory device.
Resolves: https://issues.redhat.com/browse/RHEL-4452
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 91f9a9fb4fc0d34ed8d7a869de3d9f87687c3618)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_validate.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index d485ec4fb1..46479f10f2 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2264,6 +2264,7 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
for (i = 0; i < def->nmems; i++) {
const virDomainMemoryDef *other = def->mems[i];
unsigned long long otherStart = 0;
+ unsigned long long otherEnd = 0;
if (other == mem)
continue;
@@ -2315,7 +2316,10 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
if (thisStart == 0 || otherStart == 0)
continue;
- if (thisStart <= otherStart && thisEnd > otherStart) {
+ otherEnd = otherStart + other->size * 1024;
+
+ if ((thisStart <= otherStart && thisEnd > otherStart) ||
+ (otherStart <= thisStart && otherEnd > thisStart)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("memory device address [0x%1$llx:0x%2$llx] overlaps with other memory device (0x%3$llx)"),
thisStart, thisEnd, otherStart);
--
2.43.0

View File

@ -1,79 +0,0 @@
From f158b6573ac39bdd1ba36c3900e65afffe57f3ca Mon Sep 17 00:00:00 2001
Message-ID: <f158b6573ac39bdd1ba36c3900e65afffe57f3ca.1689974710.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 19 Jul 2023 15:22:22 +0200
Subject: [PATCH] node_device: Don't leak error message buffer from
virMdevctlListDefined|Active
nodeDeviceUpdateMediatedDevices invokes virMdevctlListDefined and
virMdevctlListActive both of which were passed the same 'errmsg' buffer.
Since virCommandSetErrorBuffer() always allocates the error buffer one
of them was leaked.
Fix it by populating the 'errmsg' buffer only on failure of
virMdevctlListActive|Defined which invoke the command.
Add a comment to nodeDeviceGetMdevctlListCommand reminding how
virCommandSetErrorBuffer() works.
Fixes: 44a0f2f0c8f
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
(cherry picked from commit 7ca777cc09242cb3a30b12d5e0e396c6aaf1a5e7)
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
src/node_device/node_device_driver.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 5dc45ddbb4..2ef9197adc 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -1044,6 +1044,15 @@ virMdevctlSetAutostart(virNodeDeviceDef *def, bool autostart, char **errmsg)
}
+/**
+ * nodeDeviceGetMdevctlListCommand:
+ * @defined: list mdevctl entries with persistent config
+ * @output: filled with the output of mdevctl once invoked
+ * @errmsg: always allocated, optionally filled with error from 'mdevctl'
+ *
+ * Prepares a virCommand structure to invoke 'mdevctl' caller is responsible to
+ * free the buffers which are filled by the virCommand infrastructure.
+ */
virCommand*
nodeDeviceGetMdevctlListCommand(bool defined,
char **output,
@@ -1624,9 +1633,11 @@ virMdevctlListDefined(virNodeDeviceDef ***devs, char **errmsg)
{
int status;
g_autofree char *output = NULL;
- g_autoptr(virCommand) cmd = nodeDeviceGetMdevctlListCommand(true, &output, errmsg);
+ g_autofree char *errbuf = NULL;
+ g_autoptr(virCommand) cmd = nodeDeviceGetMdevctlListCommand(true, &output, &errbuf);
if (virCommandRun(cmd, &status) < 0 || status != 0) {
+ *errmsg = g_steal_pointer(&errbuf);
return -1;
}
@@ -1642,9 +1653,11 @@ virMdevctlListActive(virNodeDeviceDef ***devs, char **errmsg)
{
int status;
g_autofree char *output = NULL;
- g_autoptr(virCommand) cmd = nodeDeviceGetMdevctlListCommand(false, &output, errmsg);
+ g_autofree char *errbuf = NULL;
+ g_autoptr(virCommand) cmd = nodeDeviceGetMdevctlListCommand(false, &output, &errbuf);
if (virCommandRun(cmd, &status) < 0 || status != 0) {
+ *errmsg = g_steal_pointer(&errbuf);
return -1;
}
--
2.41.0

View File

@ -1,105 +0,0 @@
From 05230da856d2f016c21f49a406780fbe15f74c32 Mon Sep 17 00:00:00 2001
Message-ID: <05230da856d2f016c21f49a406780fbe15f74c32.1689602377.git.jdenemar@redhat.com>
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Wed, 5 Jul 2023 15:35:59 -0500
Subject: [PATCH] nodedev: refactor mdevctl thread functions
Factor out a new scheduleMdevctlUpdate() function so that we can re-use
it from other places. Now that other events can make it necessary to
re-query mdevctl for mdev updates, this function will be useful for
coalescing multiple updates in quick succession into a single mdevctl
query.
Also rename a couple functions. The names weren't very descriptive of
their behavior. For example, the old scheduleMdevctlHandler() function
didn't actually schedule anything, it just started a thread. So rename
it to free up the 'schedule' name for the above refactored function.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
(cherry picked from commit 9b7fadc5dc33b85b597c95d944dc23c02c29c29f)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
src/node_device/node_device_udev.c | 36 ++++++++++++++++++++----------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index fce4212728..86ef4af728 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -2075,7 +2075,7 @@ udevPCITranslateInit(bool privileged G_GNUC_UNUSED)
static void
-mdevctlHandlerThread(void *opaque G_GNUC_UNUSED)
+mdevctlUpdateThreadFunc(void *opaque G_GNUC_UNUSED)
{
udevEventData *priv = driver->privateData;
VIR_LOCK_GUARD lock = virLockGuardLock(&priv->mdevctlLock);
@@ -2086,7 +2086,7 @@ mdevctlHandlerThread(void *opaque G_GNUC_UNUSED)
static void
-scheduleMdevctlHandler(int timer G_GNUC_UNUSED, void *opaque)
+launchMdevctlUpdateThread(int timer G_GNUC_UNUSED, void *opaque)
{
udevEventData *priv = opaque;
virThread thread;
@@ -2096,7 +2096,7 @@ scheduleMdevctlHandler(int timer G_GNUC_UNUSED, void *opaque)
priv->mdevctlTimeout = -1;
}
- if (virThreadCreateFull(&thread, false, mdevctlHandlerThread,
+ if (virThreadCreateFull(&thread, false, mdevctlUpdateThreadFunc,
"mdevctl-thread", false, NULL) < 0) {
virReportSystemError(errno, "%s",
_("failed to create mdevctl thread"));
@@ -2192,6 +2192,26 @@ mdevctlEnableMonitor(udevEventData *priv)
}
+/* Schedules an mdevctl update for 100ms in the future, canceling any existing
+ * timeout that may have been set. In this way, multiple update requests in
+ * quick succession can be collapsed into a single update. if @force is true,
+ * an update thread will be spawned immediately. */
+static void
+scheduleMdevctlUpdate(udevEventData *data,
+ bool force)
+{
+ if (!force) {
+ if (data->mdevctlTimeout > 0)
+ virEventRemoveTimeout(data->mdevctlTimeout);
+ data->mdevctlTimeout = virEventAddTimeout(100, launchMdevctlUpdateThread,
+ data, NULL);
+ return;
+ }
+
+ launchMdevctlUpdateThread(-1, data);
+}
+
+
static void
mdevctlEventHandleCallback(GFileMonitor *monitor G_GNUC_UNUSED,
GFile *file,
@@ -2222,15 +2242,7 @@ mdevctlEventHandleCallback(GFileMonitor *monitor G_GNUC_UNUSED,
* configuration change, try to coalesce these changes by waiting for the
* CHANGES_DONE_HINT event. As a fallback, add a timeout to trigger the
* signal if that event never comes */
- if (event_type != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT) {
- if (priv->mdevctlTimeout > 0)
- virEventRemoveTimeout(priv->mdevctlTimeout);
- priv->mdevctlTimeout = virEventAddTimeout(100, scheduleMdevctlHandler,
- priv, NULL);
- return;
- }
-
- scheduleMdevctlHandler(-1, priv);
+ scheduleMdevctlUpdate(priv, (event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT));
}
--
2.41.0

View File

@ -1,104 +0,0 @@
From c2150285aff9b308b969d5fc6f32f75db620dfe3 Mon Sep 17 00:00:00 2001
Message-ID: <c2150285aff9b308b969d5fc6f32f75db620dfe3.1689974710.git.jdenemar@redhat.com>
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Tue, 18 Jul 2023 14:47:49 -0500
Subject: [PATCH] nodedev: report mdev persistence properly
Since commit 44a0f2f0, we now query mdevctl for transient (active) mdevs
in order to gather attributes for the mdev. Unfortunately, this commit
introduced a regression because nodeDeviceUpdateMediatedDevice() assumed
that all mdevs returned from mdevctl were actually persistent mdevs but
we were using it to update transient mdevs. Refactor the function so
that we can use it to update both persistent and transient mdevs.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
(cherry picked from commit fa0d5f4ebc0aa178d9dea278914f9149a4c4af54)
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
src/node_device/node_device_driver.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index a2d0600560..5dc45ddbb4 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -1339,11 +1339,12 @@ nodeDeviceDestroy(virNodeDevicePtr device)
/* takes ownership of @def and potentially frees it. @def should not be used
* after returning from this function */
static int
-nodeDeviceUpdateMediatedDevice(virNodeDeviceDef *def)
+nodeDeviceUpdateMediatedDevice(virNodeDeviceDef *def,
+ bool defined)
{
virNodeDeviceObj *obj;
virObjectEvent *event;
- bool defined = false;
+ bool was_defined = false;
g_autoptr(virNodeDeviceDef) owned = def;
g_autofree char *name = g_strdup(owned->name);
@@ -1359,13 +1360,13 @@ nodeDeviceUpdateMediatedDevice(virNodeDeviceDef *def)
bool changed;
virNodeDeviceDef *olddef = virNodeDeviceObjGetDef(obj);
- defined = virNodeDeviceObjIsPersistent(obj);
+ was_defined = virNodeDeviceObjIsPersistent(obj);
/* Active devices contain some additional information (e.g. sysfs
* path) that is not provided by mdevctl, so re-use the existing
* definition and copy over new mdev data */
changed = nodeDeviceDefCopyFromMdevctl(olddef, owned);
- if (defined && !changed) {
+ if (was_defined && !changed) {
/* if this device was already defined and the definition
* hasn't changed, there's nothing to do for this device */
virNodeDeviceObjEndAPI(&obj);
@@ -1373,11 +1374,11 @@ nodeDeviceUpdateMediatedDevice(virNodeDeviceDef *def)
}
}
- /* all devices returned by virMdevctlListDefined() are persistent */
- virNodeDeviceObjSetPersistent(obj, true);
+ if (defined)
+ virNodeDeviceObjSetPersistent(obj, true);
virNodeDeviceObjSetAutostart(obj, def->caps->data.mdev.autostart);
- if (!defined)
+ if (!was_defined && defined)
event = virNodeDeviceEventLifecycleNew(name,
VIR_NODE_DEVICE_EVENT_DEFINED,
0);
@@ -1447,7 +1448,7 @@ nodeDeviceDefineXML(virConnect *conn,
* have already received the uuid from virMdevctlDefine(), we can simply
* add the provisional device to the list and return it immediately and
* avoid this long delay. */
- if (nodeDeviceUpdateMediatedDevice(g_steal_pointer(&def)) < 0)
+ if (nodeDeviceUpdateMediatedDevice(g_steal_pointer(&def), true) < 0)
return NULL;
return virGetNodeDevice(conn, name);
@@ -1742,7 +1743,7 @@ nodeDeviceUpdateMediatedDevices(void)
removeMissingPersistentMdev, &data);
for (i = 0; i < data.ndefs; i++)
- if (nodeDeviceUpdateMediatedDevice(defs[i]) < 0)
+ if (nodeDeviceUpdateMediatedDevice(defs[i], true) < 0)
return -1;
/* Update active/transient mdev devices */
@@ -1753,7 +1754,7 @@ nodeDeviceUpdateMediatedDevices(void)
}
for (i = 0; i < act_ndefs; i++)
- if (nodeDeviceUpdateMediatedDevice(act_defs[i]) < 0)
+ if (nodeDeviceUpdateMediatedDevice(act_defs[i], false) < 0)
return -1;
return 0;
--
2.41.0

View File

@ -1,50 +0,0 @@
From d993cec578f2bbb121dcacea6728cf34da14e62e Mon Sep 17 00:00:00 2001
Message-ID: <d993cec578f2bbb121dcacea6728cf34da14e62e.1689602377.git.jdenemar@redhat.com>
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
Date: Fri, 30 Jun 2023 13:34:00 +0200
Subject: [PATCH] nodedev: transient mdev update on nodeDeviceCreateXML
Update the optional mdev attributes by running an mdevctl update on a
new created nodedev object representing an mdev.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
(cherry picked from commit 37481aa1f15ece6b187b8fa219966f77648c813d)
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
src/node_device/node_device_udev.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 4c37ec3189..fce4212728 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1757,12 +1757,20 @@ nodeStateCleanup(void)
static int
udevHandleOneDevice(struct udev_device *device)
{
+ virNodeDevCapType dev_cap_type;
const char *action = udev_device_get_action(device);
VIR_DEBUG("udev action: '%s': %s", action, udev_device_get_syspath(device));
- if (STREQ(action, "add") || STREQ(action, "change"))
- return udevAddOneDevice(device);
+ if (STREQ(action, "add") || STREQ(action, "change")) {
+ int ret = udevAddOneDevice(device);
+ if (ret == 0 &&
+ udevGetDeviceType(device, &dev_cap_type) == 0 &&
+ dev_cap_type == VIR_NODE_DEV_CAP_MDEV)
+ if (nodeDeviceUpdateMediatedDevices() < 0)
+ VIR_WARN("mdevctl failed to update mediated devices");
+ return ret;
+ }
if (STREQ(action, "remove"))
return udevRemoveOneDevice(device);
--
2.41.0

View File

@ -1,70 +0,0 @@
From 48813113774c7ff0ab1b43c1861b6495bb3ce830 Mon Sep 17 00:00:00 2001
Message-ID: <48813113774c7ff0ab1b43c1861b6495bb3ce830.1689602377.git.jdenemar@redhat.com>
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Thu, 6 Jul 2023 09:16:35 -0500
Subject: [PATCH] nodedev: update mdevs from the mdevctl thread
Rather than directly executing mdevctl from the udev event thread when
we determine that we need to re-query, schedule the mdevctl thread to
run. This also helps to coalesce multiple back-to-back updates into a
single one when there are multiple updates in a row or at startup when a
host has a very large number of mdevs.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
(cherry picked from commit 14026db9b0e25739ea30685bd643ff23aca30588)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
src/node_device/node_device_udev.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 86ef4af728..6451574c1d 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1443,6 +1443,9 @@ udevGetDeviceDetails(struct udev_device *device,
}
+static void scheduleMdevctlUpdate(udevEventData *data, bool force);
+
+
static int
udevRemoveOneDeviceSysPath(const char *path)
{
@@ -1475,8 +1478,7 @@ udevRemoveOneDeviceSysPath(const char *path)
virNodeDeviceObjEndAPI(&obj);
/* cannot check for mdev_types since they have already been removed */
- if (nodeDeviceUpdateMediatedDevices() < 0)
- VIR_WARN("mdevctl failed to update mediated devices");
+ scheduleMdevctlUpdate(driver->privateData, false);
virObjectEventStateQueue(driver->nodeDeviceEventState, event);
return 0;
@@ -1604,8 +1606,8 @@ udevAddOneDevice(struct udev_device *device)
has_mdev_types = virNodeDeviceObjHasCap(obj, VIR_NODE_DEV_CAP_MDEV_TYPES);
virNodeDeviceObjEndAPI(&obj);
- if (has_mdev_types && nodeDeviceUpdateMediatedDevices() < 0)
- VIR_WARN("mdevctl failed to update mediated devices");
+ if (has_mdev_types)
+ scheduleMdevctlUpdate(driver->privateData, false);
ret = 0;
@@ -1767,8 +1769,7 @@ udevHandleOneDevice(struct udev_device *device)
if (ret == 0 &&
udevGetDeviceType(device, &dev_cap_type) == 0 &&
dev_cap_type == VIR_NODE_DEV_CAP_MDEV)
- if (nodeDeviceUpdateMediatedDevices() < 0)
- VIR_WARN("mdevctl failed to update mediated devices");
+ scheduleMdevctlUpdate(driver->privateData, false);
return ret;
}
--
2.41.0

View File

@ -1,77 +0,0 @@
From a106b0bcb4fd652b9843257f799d9601151449b4 Mon Sep 17 00:00:00 2001
Message-ID: <a106b0bcb4fd652b9843257f799d9601151449b4.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 26 May 2023 19:59:06 +0200
Subject: [PATCH] qemu: Don't overwrite NVRAM template for legacy firmware
Just because we have found a matching entry, it doesn't mean
that we should discard the information explicitly provided in
the domain XML.
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
https://gitlab.com/libvirt/libvirt/-/issues/500
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 4a49114ff47d4a9432d211200f734886f9ce200b)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/qemu/qemu_firmware.c | 26 +++++++++++++++++--
...efi-secboot-legacy-paths.x86_64-latest.xml | 2 +-
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index b1d342563b..a9437b5b95 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1609,8 +1609,30 @@ qemuFirmwareFillDomainLegacy(virQEMUDriver *driver,
loader->type = VIR_DOMAIN_LOADER_TYPE_PFLASH;
loader->readonly = VIR_TRISTATE_BOOL_YES;
- VIR_FREE(loader->nvramTemplate);
- loader->nvramTemplate = g_strdup(cfg->firmwares[i]->nvram);
+ /* Only use the default template path if one hasn't been
+ * provided by the user.
+ *
+ * In addition to fully-custom templates, which are a valid
+ * use case, we could simply be in a situation where
+ * qemu.conf contains
+ *
+ * nvram = [
+ * "/path/to/OVMF_CODE.secboot.fd:/path/to/OVMF_VARS.fd",
+ * "/path/to/OVMF_CODE.secboot.fd:/path/to/OVMF_VARS.secboot.fd"
+ * ]
+ *
+ * and the domain has been configured as
+ *
+ * <os>
+ * <loader readonly='yes' type='pflash'>/path/to/OVMF_CODE.secboot.fd</loader>
+ * <nvram template='/path/to/OVMF/OVMF_VARS.secboot.fd'>
+ * </os>
+ *
+ * In this case, the global default is to have Secure Boot
+ * disabled, but the domain configuration explicitly enables
+ * it, and we shouldn't overrule this choice */
+ if (!loader->nvramTemplate)
+ loader->nvramTemplate = g_strdup(cfg->firmwares[i]->nvram);
qemuFirmwareEnsureNVRAM(def, cfg, VIR_STORAGE_FILE_RAW);
diff --git a/tests/qemuxml2xmloutdata/firmware-manual-efi-secboot-legacy-paths.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-manual-efi-secboot-legacy-paths.x86_64-latest.xml
index b8c2dfef66..9027123558 100644
--- a/tests/qemuxml2xmloutdata/firmware-manual-efi-secboot-legacy-paths.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/firmware-manual-efi-secboot-legacy-paths.x86_64-latest.xml
@@ -7,7 +7,7 @@
<os>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
<loader readonly='yes' secure='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.secboot.fd</loader>
- <nvram template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
+ <nvram template='/usr/share/OVMF/OVMF_VARS.secboot.fd'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
--
2.42.0

View File

@ -1,340 +0,0 @@
From 9b3f3afb21c64dc403fea734b1cb75a8bd2e4fc0 Mon Sep 17 00:00:00 2001
Message-ID: <9b3f3afb21c64dc403fea734b1cb75a8bd2e4fc0.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 30 May 2023 18:01:58 +0200
Subject: [PATCH] qemu: Filter firmware based on loader.readonly
If the user included loader.readonly=no in the domain XML, we
should not pick a firmware build that expects to work with
loader.readonly=yes.
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit e96e322725f27d59ebcbd194c8da949b64bab9d6)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/qemu/qemu_firmware.c | 12 ++++++
...-auto-efi-rw-abi-update.x86_64-latest.args | 38 -----------------
...e-auto-efi-rw-abi-update.x86_64-latest.err | 1 +
.../firmware-auto-efi-rw.x86_64-latest.args | 38 -----------------
.../firmware-auto-efi-rw.x86_64-latest.err | 1 +
...ual-efi-rw-legacy-paths.x86_64-latest.args | 6 +--
...ual-efi-rw-modern-paths.x86_64-latest.args | 6 +--
tests/qemuxml2argvtest.c | 4 +-
...e-auto-efi-rw-abi-update.x86_64-latest.xml | 41 -------------------
.../firmware-auto-efi-rw.x86_64-latest.xml | 8 +---
...nual-efi-rw-legacy-paths.x86_64-latest.xml | 3 +-
...nual-efi-rw-modern-paths.x86_64-latest.xml | 9 +---
tests/qemuxml2xmltest.c | 1 -
13 files changed, 24 insertions(+), 144 deletions(-)
delete mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-rw-abi-update.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-rw-abi-update.x86_64-latest.err
delete mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-rw.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-rw.x86_64-latest.err
delete mode 100644 tests/qemuxml2xmloutdata/firmware-auto-efi-rw-abi-update.x86_64-latest.xml
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index 2c9a03e6cf..3538654913 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1295,6 +1295,13 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
}
}
+ if (loader &&
+ loader->readonly == VIR_TRISTATE_BOOL_NO &&
+ flash->mode != QEMU_FIRMWARE_FLASH_MODE_COMBINED) {
+ VIR_DEBUG("Discarding readonly loader");
+ return false;
+ }
+
if (STRNEQ(flash->executable.format, "raw") &&
STRNEQ(flash->executable.format, "qcow2")) {
VIR_DEBUG("Discarding loader with unsupported flash format '%s'",
@@ -1593,6 +1600,11 @@ qemuFirmwareFillDomainLegacy(virQEMUDriver *driver,
return 1;
}
+ if (loader->readonly == VIR_TRISTATE_BOOL_NO) {
+ VIR_DEBUG("Ignoring legacy entries for read-write loader");
+ return 1;
+ }
+
if (loader->stateless == VIR_TRISTATE_BOOL_YES) {
VIR_DEBUG("Ignoring legacy entries for stateless loader");
return 1;
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-rw-abi-update.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-auto-efi-rw-abi-update.x86_64-latest.args
deleted file mode 100644
index 48f357cbf9..0000000000
--- a/tests/qemuxml2argvdata/firmware-auto-efi-rw-abi-update.x86_64-latest.args
+++ /dev/null
@@ -1,38 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-guest \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-/usr/bin/qemu-system-x86_64 \
--name guest=guest,debug-threads=on \
--S \
--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
--blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
--blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
--machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \
--accel kvm \
--cpu qemu64 \
--global driver=cfi.pflash01,property=secure,value=on \
--m size=1048576k \
--object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--audiodev '{"id":"audio1","driver":"none"}' \
--global ICH9-LPC.noreboot=off \
--watchdog-action reset \
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-rw-abi-update.x86_64-latest.err b/tests/qemuxml2argvdata/firmware-auto-efi-rw-abi-update.x86_64-latest.err
new file mode 100644
index 0000000000..4cfde1bd2e
--- /dev/null
+++ b/tests/qemuxml2argvdata/firmware-auto-efi-rw-abi-update.x86_64-latest.err
@@ -0,0 +1 @@
+operation failed: Unable to find any firmware to satisfy 'efi'
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-rw.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-auto-efi-rw.x86_64-latest.args
deleted file mode 100644
index 48f357cbf9..0000000000
--- a/tests/qemuxml2argvdata/firmware-auto-efi-rw.x86_64-latest.args
+++ /dev/null
@@ -1,38 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-guest \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-/usr/bin/qemu-system-x86_64 \
--name guest=guest,debug-threads=on \
--S \
--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
--blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
--blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
--machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \
--accel kvm \
--cpu qemu64 \
--global driver=cfi.pflash01,property=secure,value=on \
--m size=1048576k \
--object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--audiodev '{"id":"audio1","driver":"none"}' \
--global ICH9-LPC.noreboot=off \
--watchdog-action reset \
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-rw.x86_64-latest.err b/tests/qemuxml2argvdata/firmware-auto-efi-rw.x86_64-latest.err
new file mode 100644
index 0000000000..4cfde1bd2e
--- /dev/null
+++ b/tests/qemuxml2argvdata/firmware-auto-efi-rw.x86_64-latest.err
@@ -0,0 +1 @@
+operation failed: Unable to find any firmware to satisfy 'efi'
diff --git a/tests/qemuxml2argvdata/firmware-manual-efi-rw-legacy-paths.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-manual-efi-rw-legacy-paths.x86_64-latest.args
index ccc279e4e3..85495da6f5 100644
--- a/tests/qemuxml2argvdata/firmware-manual-efi-rw-legacy-paths.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/firmware-manual-efi-rw-legacy-paths.x86_64-latest.args
@@ -11,10 +11,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/usr/share/OVMF/OVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
--blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
--machine pc-q35-4.0,usb=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \
+-blockdev '{"node-name":"libvirt-pflash0-format","read-only":false,"driver":"raw","file":"libvirt-pflash0-storage"}' \
+-machine pc-q35-4.0,usb=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,acpi=on \
-accel tcg \
-cpu qemu64 \
-m size=1048576k \
diff --git a/tests/qemuxml2argvdata/firmware-manual-efi-rw-modern-paths.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-manual-efi-rw-modern-paths.x86_64-latest.args
index 2d45fa4792..c26daad29f 100644
--- a/tests/qemuxml2argvdata/firmware-manual-efi-rw-modern-paths.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/firmware-manual-efi-rw-modern-paths.x86_64-latest.args
@@ -11,10 +11,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
--blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
--machine pc-q35-4.0,usb=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \
+-blockdev '{"node-name":"libvirt-pflash0-format","read-only":false,"driver":"raw","file":"libvirt-pflash0-storage"}' \
+-machine pc-q35-4.0,usb=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,acpi=on \
-accel tcg \
-cpu qemu64 \
-m size=1048576k \
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b2d9e00350..370b26a023 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1089,8 +1089,8 @@ mymain(void)
DO_TEST_CAPS_LATEST("firmware-auto-efi");
DO_TEST_CAPS_LATEST_ABI_UPDATE("firmware-auto-efi-abi-update");
DO_TEST_CAPS_LATEST("firmware-auto-efi-stateless");
- DO_TEST_CAPS_LATEST("firmware-auto-efi-rw");
- DO_TEST_CAPS_LATEST_ABI_UPDATE("firmware-auto-efi-rw-abi-update");
+ DO_TEST_CAPS_LATEST_FAILURE("firmware-auto-efi-rw");
+ DO_TEST_CAPS_LATEST_ABI_UPDATE_PARSE_ERROR("firmware-auto-efi-rw-abi-update");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-secure");
DO_TEST_CAPS_LATEST_ABI_UPDATE("firmware-auto-efi-loader-secure-abi-update");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-insecure");
diff --git a/tests/qemuxml2xmloutdata/firmware-auto-efi-rw-abi-update.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-auto-efi-rw-abi-update.x86_64-latest.xml
deleted file mode 100644
index 332d931ba1..0000000000
--- a/tests/qemuxml2xmloutdata/firmware-auto-efi-rw-abi-update.x86_64-latest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<domain type='kvm'>
- <name>guest</name>
- <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os firmware='efi'>
- <type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
- <firmware>
- <feature enabled='yes' name='enrolled-keys'/>
- <feature enabled='yes' name='secure-boot'/>
- </firmware>
- <loader readonly='yes' secure='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd</loader>
- <nvram template='/usr/share/edk2/ovmf/OVMF_VARS.secboot.fd'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
- <boot dev='hd'/>
- </os>
- <features>
- <acpi/>
- <smm state='on'/>
- </features>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>qemu64</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <controller type='usb' index='0' model='none'/>
- <controller type='sata' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
- </controller>
- <controller type='pci' index='0' model='pcie-root'/>
- <input type='mouse' bus='ps2'/>
- <input type='keyboard' bus='ps2'/>
- <audio id='1' type='none'/>
- <watchdog model='itco' action='reset'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/firmware-auto-efi-rw.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-auto-efi-rw.x86_64-latest.xml
index 332d931ba1..c2d0c33a0b 100644
--- a/tests/qemuxml2xmloutdata/firmware-auto-efi-rw.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/firmware-auto-efi-rw.x86_64-latest.xml
@@ -6,17 +6,11 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
- <firmware>
- <feature enabled='yes' name='enrolled-keys'/>
- <feature enabled='yes' name='secure-boot'/>
- </firmware>
- <loader readonly='yes' secure='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd</loader>
- <nvram template='/usr/share/edk2/ovmf/OVMF_VARS.secboot.fd'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
+ <loader readonly='no'/>
<boot dev='hd'/>
</os>
<features>
<acpi/>
- <smm state='on'/>
</features>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
diff --git a/tests/qemuxml2xmloutdata/firmware-manual-efi-rw-legacy-paths.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-manual-efi-rw-legacy-paths.x86_64-latest.xml
index cfd7a6824f..c5baedc42c 100644
--- a/tests/qemuxml2xmloutdata/firmware-manual-efi-rw-legacy-paths.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/firmware-manual-efi-rw-legacy-paths.x86_64-latest.xml
@@ -6,8 +6,7 @@
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
- <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
- <nvram template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
+ <loader readonly='no' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
<boot dev='hd'/>
</os>
<features>
diff --git a/tests/qemuxml2xmloutdata/firmware-manual-efi-rw-modern-paths.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-manual-efi-rw-modern-paths.x86_64-latest.xml
index 468ca022ef..0d755a4306 100644
--- a/tests/qemuxml2xmloutdata/firmware-manual-efi-rw-modern-paths.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/firmware-manual-efi-rw-modern-paths.x86_64-latest.xml
@@ -4,14 +4,9 @@
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
- <os firmware='efi'>
+ <os>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
- <firmware>
- <feature enabled='no' name='enrolled-keys'/>
- <feature enabled='no' name='secure-boot'/>
- </firmware>
- <loader readonly='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
- <nvram template='/usr/share/edk2/ovmf/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
+ <loader readonly='no' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
<boot dev='hd'/>
</os>
<features>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index d3d4e4e585..3f2ef10df7 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -901,7 +901,6 @@ mymain(void)
DO_TEST_CAPS_LATEST_ABI_UPDATE("firmware-auto-efi-abi-update");
DO_TEST_CAPS_LATEST("firmware-auto-efi-stateless");
DO_TEST_CAPS_LATEST("firmware-auto-efi-rw");
- DO_TEST_CAPS_LATEST_ABI_UPDATE("firmware-auto-efi-rw-abi-update");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-secure");
DO_TEST_CAPS_LATEST_ABI_UPDATE("firmware-auto-efi-loader-secure-abi-update");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-insecure");
--
2.42.0

View File

@ -1,46 +0,0 @@
From f57a07068f7cc7ccdbf9814f9c69cbef1d2c9d6c Mon Sep 17 00:00:00 2001
Message-ID: <f57a07068f7cc7ccdbf9814f9c69cbef1d2c9d6c.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 26 May 2023 17:47:42 +0200
Subject: [PATCH] qemu: Fix lookup against stateless/combined pflash
Just like the more common split builds, these are of type
QEMU_FIRMWARE_DEVICE_FLASH; however, they have no associated
NVRAM template, so we can't access the corresponding structure
member unconditionally or we'll trigger a crash.
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit ac76386edad3be2bbd6202a30063b9205011f5c5)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/qemu/qemu_firmware.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index 5f030ebce4..b1d342563b 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -971,9 +971,12 @@ qemuFirmwareMatchesPaths(const qemuFirmware *fw,
if (loader && loader->path &&
STRNEQ(loader->path, flash->executable.filename))
return false;
- if (loader && loader->nvramTemplate &&
- STRNEQ(loader->nvramTemplate, flash->nvram_template.filename))
- return false;
+ if (loader && loader->nvramTemplate) {
+ if (flash->mode != QEMU_FIRMWARE_FLASH_MODE_SPLIT)
+ return false;
+ if (STRNEQ(loader->nvramTemplate, flash->nvram_template.filename))
+ return false;
+ }
break;
case QEMU_FIRMWARE_DEVICE_MEMORY:
if (loader && loader->path &&
--
2.42.0

View File

@ -1,48 +0,0 @@
From 1fefaa42f98530ed449ea9aa4863c4c1bc5327b5 Mon Sep 17 00:00:00 2001
Message-ID: <1fefaa42f98530ed449ea9aa4863c4c1bc5327b5.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Wed, 2 Aug 2023 17:18:32 +0200
Subject: [PATCH] qemu: Fix return value for qemuFirmwareFillDomainLegacy()
The documentation states that, just like the Modern() variant,
this function should return 1 if a match wasn't found. It
currently doesn't do that, and returns 0 instead.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit d917883b30f1d33f1df78394152e67b402b9c72e)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/qemu/qemu_firmware.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index cf9a45dc39..5f030ebce4 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1575,17 +1575,17 @@ qemuFirmwareFillDomainLegacy(virQEMUDriver *driver,
size_t i;
if (!loader)
- return 0;
+ return 1;
if (loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH) {
VIR_DEBUG("Ignoring legacy entries for '%s' loader",
virDomainLoaderTypeToString(loader->type));
- return 0;
+ return 1;
}
if (loader->stateless == VIR_TRISTATE_BOOL_YES) {
VIR_DEBUG("Ignoring legacy entries for stateless loader");
- return 0;
+ return 1;
}
if (loader->format != VIR_STORAGE_FILE_RAW) {
--
2.42.0

View File

@ -1,321 +0,0 @@
From e71463f711cef030989717f401d0399ec6870705 Mon Sep 17 00:00:00 2001
Message-ID: <e71463f711cef030989717f401d0399ec6870705.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 26 May 2023 14:40:02 +0200
Subject: [PATCH] qemu: Generate NVRAM path in more cases
Right now, we only generate it after finding a matching entry
either among firmware descriptors or in the legacy firmware
list.
Even if the domain is configured to use a custom firmware build
that we know nothing about, however, we should still automatically
generate the NVRAM path instead of requiring the user to provide
it manually.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit ccbb987707e282af8d7f8c0db47e70fdebab959f)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/qemu/qemu_firmware.c | 52 +++++++++++--------
...loader-path-nonstandard.x86_64-latest.args | 37 +++++++++++++
...-loader-path-nonstandard.x86_64-latest.err | 1 -
...am-template-nonstandard.x86_64-latest.args | 37 +++++++++++++
...ram-template-nonstandard.x86_64-latest.err | 1 -
tests/qemuxml2argvtest.c | 4 +-
...-loader-path-nonstandard.x86_64-latest.xml | 2 +-
...ram-template-nonstandard.x86_64-latest.xml | 2 +-
8 files changed, 109 insertions(+), 27 deletions(-)
create mode 100644 tests/qemuxml2argvdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.args
delete mode 100644 tests/qemuxml2argvdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.err
create mode 100644 tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.args
delete mode 100644 tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.err
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index a9437b5b95..2c9a03e6cf 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1053,7 +1053,7 @@ qemuFirmwareOSInterfaceTypeFromOsDefLoaderType(virDomainLoader type)
/**
* qemuFirmwareEnsureNVRAM:
* @def: domain definition
- * @cfg: QEMU driver configuration
+ * @driver: QEMU driver
*
* Make sure that a source for the NVRAM file exists, possibly by
* creating it. This might involve automatically generating the
@@ -1061,15 +1061,24 @@ qemuFirmwareOSInterfaceTypeFromOsDefLoaderType(virDomainLoader type)
*/
static void
qemuFirmwareEnsureNVRAM(virDomainDef *def,
- const virQEMUDriverConfig *cfg,
- virStorageFileFormat format)
+ virQEMUDriver *driver)
{
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virDomainLoaderDef *loader = def->os.loader;
const char *ext = NULL;
if (!loader)
return;
+ if (loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH)
+ return;
+
+ if (loader->readonly != VIR_TRISTATE_BOOL_YES)
+ return;
+
+ if (loader->stateless == VIR_TRISTATE_BOOL_YES)
+ return;
+
/* If the source already exists and is fully specified, including
* the path, leave it alone */
if (loader->nvram && loader->nvram->path)
@@ -1080,11 +1089,11 @@ qemuFirmwareEnsureNVRAM(virDomainDef *def,
loader->nvram = virStorageSourceNew();
loader->nvram->type = VIR_STORAGE_TYPE_FILE;
- loader->nvram->format = format;
+ loader->nvram->format = loader->format;
- if (format == VIR_STORAGE_FILE_RAW)
+ if (loader->nvram->format == VIR_STORAGE_FILE_RAW)
ext = ".fd";
- if (format == VIR_STORAGE_FILE_QCOW2)
+ if (loader->nvram->format == VIR_STORAGE_FILE_QCOW2)
ext = ".qcow2";
loader->nvram->path = g_strdup_printf("%s/%s_VARS%s",
@@ -1347,8 +1356,7 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
static int
-qemuFirmwareEnableFeaturesModern(virQEMUDriverConfig *cfg,
- virDomainDef *def,
+qemuFirmwareEnableFeaturesModern(virDomainDef *def,
const qemuFirmware *fw)
{
const qemuFirmwareMappingFlash *flash = &fw->mapping.data.flash;
@@ -1377,16 +1385,15 @@ qemuFirmwareEnableFeaturesModern(virQEMUDriverConfig *cfg,
loader->path = g_strdup(flash->executable.filename);
if (flash->mode == QEMU_FIRMWARE_FLASH_MODE_SPLIT) {
- if ((format = virStorageFileFormatTypeFromString(flash->nvram_template.format)) < 0)
- return -1;
-
- qemuFirmwareEnsureNVRAM(def, cfg, format);
-
- /* If the NVRAM is not a local path then we can't create or
- * reset it, so in that case filling in the nvramTemplate
- * field would be misleading */
+ /* Only fill in nvramTemplate if the NVRAM location is already
+ * known to be a local path or hasn't been provided, in which
+ * case a local path will be generated by libvirt later.
+ *
+ * We can't create or reset non-local NVRAM files, so filling
+ * in nvramTemplate for those would be misleading */
VIR_FREE(loader->nvramTemplate);
- if (loader->nvram && virStorageSourceIsLocalStorage(loader->nvram)) {
+ if (!loader->nvram ||
+ (loader->nvram && virStorageSourceIsLocalStorage(loader->nvram))) {
loader->nvramTemplate = g_strdup(flash->nvram_template.filename);
}
}
@@ -1608,6 +1615,7 @@ qemuFirmwareFillDomainLegacy(virQEMUDriver *driver,
loader->type = VIR_DOMAIN_LOADER_TYPE_PFLASH;
loader->readonly = VIR_TRISTATE_BOOL_YES;
+ loader->format = VIR_STORAGE_FILE_RAW;
/* Only use the default template path if one hasn't been
* provided by the user.
@@ -1634,8 +1642,6 @@ qemuFirmwareFillDomainLegacy(virQEMUDriver *driver,
if (!loader->nvramTemplate)
loader->nvramTemplate = g_strdup(cfg->firmwares[i]->nvram);
- qemuFirmwareEnsureNVRAM(def, cfg, VIR_STORAGE_FILE_RAW);
-
VIR_DEBUG("decided on firmware '%s' template '%s'",
loader->path, NULLSTR(loader->nvramTemplate));
@@ -1664,7 +1670,6 @@ static int
qemuFirmwareFillDomainModern(virQEMUDriver *driver,
virDomainDef *def)
{
- g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_auto(GStrv) paths = NULL;
qemuFirmware **firmwares = NULL;
ssize_t nfirmwares = 0;
@@ -1695,7 +1700,7 @@ qemuFirmwareFillDomainModern(virQEMUDriver *driver,
* likely that admin/FW manufacturer messed up. */
qemuFirmwareSanityCheck(theone, paths[i]);
- if (qemuFirmwareEnableFeaturesModern(cfg, def, theone) < 0)
+ if (qemuFirmwareEnableFeaturesModern(def, theone) < 0)
goto cleanup;
ret = 0;
@@ -1802,6 +1807,11 @@ qemuFirmwareFillDomain(virQEMUDriver *driver,
}
}
+ /* Always ensure that the NVRAM path is present, even if we
+ * haven't found a match: the configuration might simply be
+ * referring to a custom firmware build */
+ qemuFirmwareEnsureNVRAM(def, driver);
+
return 0;
}
diff --git a/tests/qemuxml2argvdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.args
new file mode 100644
index 0000000000..4e989344b3
--- /dev/null
+++ b/tests/qemuxml2argvdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.args
@@ -0,0 +1,37 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-guest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=guest,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
+-blockdev '{"driver":"file","filename":"/path/to/OVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
+-machine pc-q35-4.0,usb=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \
+-accel tcg \
+-cpu qemu64 \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-global ICH9-LPC.noreboot=off \
+-watchdog-action reset \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.err b/tests/qemuxml2argvdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.err
deleted file mode 100644
index 6a1618a1aa..0000000000
--- a/tests/qemuxml2argvdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.err
+++ /dev/null
@@ -1 +0,0 @@
-internal error: argument key 'filename' must not have null value
diff --git a/tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.args
new file mode 100644
index 0000000000..1dc1993285
--- /dev/null
+++ b/tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.args
@@ -0,0 +1,37 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-guest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=guest,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
+-blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
+-machine pc-q35-4.0,usb=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \
+-accel kvm \
+-cpu qemu64 \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-global ICH9-LPC.noreboot=off \
+-watchdog-action reset \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.err b/tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.err
deleted file mode 100644
index 6a1618a1aa..0000000000
--- a/tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.err
+++ /dev/null
@@ -1 +0,0 @@
-internal error: argument key 'filename' must not have null value
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 95842140f3..b2d9e00350 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1053,13 +1053,13 @@ mymain(void)
DO_TEST_CAPS_LATEST("firmware-manual-efi-rw-implicit");
DO_TEST_CAPS_LATEST("firmware-manual-efi-loader-secure");
DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-manual-efi-loader-no-path");
- DO_TEST_CAPS_LATEST_FAILURE("firmware-manual-efi-loader-path-nonstandard");
+ DO_TEST_CAPS_LATEST("firmware-manual-efi-loader-path-nonstandard");
DO_TEST_CAPS_LATEST("firmware-manual-efi-secboot");
DO_TEST_CAPS_LATEST("firmware-manual-efi-no-enrolled-keys");
DO_TEST_CAPS_LATEST("firmware-manual-efi-no-secboot");
DO_TEST_CAPS_LATEST("firmware-manual-efi-stateless");
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-template");
- DO_TEST_CAPS_LATEST_FAILURE("firmware-manual-efi-nvram-template-nonstandard");
+ DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-template-nonstandard");
DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-manual-efi-nvram-template-stateless");
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-network-iscsi");
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-network-nbd");
diff --git a/tests/qemuxml2xmloutdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.xml
index 5940bfd0ea..039c485706 100644
--- a/tests/qemuxml2xmloutdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/firmware-manual-efi-loader-path-nonstandard.x86_64-latest.xml
@@ -7,7 +7,7 @@
<os>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
<loader readonly='yes' type='pflash'>/path/to/OVMF_CODE.fd</loader>
- <nvram template='/path/to/OVMF_VARS.fd'/>
+ <nvram template='/path/to/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
diff --git a/tests/qemuxml2xmloutdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.xml
index 816e285621..5433650516 100644
--- a/tests/qemuxml2xmloutdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/firmware-manual-efi-nvram-template-nonstandard.x86_64-latest.xml
@@ -7,7 +7,7 @@
<os>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
- <nvram template='/path/to/OVMF_VARS.fd'/>
+ <nvram template='/path/to/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
--
2.42.0

View File

@ -0,0 +1,208 @@
From 8fbc827a89ef1163b64d39a2ff9b1c067ea82b63 Mon Sep 17 00:00:00 2001
Message-ID: <8fbc827a89ef1163b64d39a2ff9b1c067ea82b63.1706524416.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 5 Jan 2024 18:42:13 +0100
Subject: [PATCH] qemu: Introduce QEMU_CAPS_SMP_CLUSTERS
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit beb27dc61ed4bfe60ca32ec2cbbc937215f9e139)
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml | 1 +
tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml | 1 +
tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml | 1 +
tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml | 1 +
14 files changed, 15 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 3d35333f09..a4d42b40ed 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -699,6 +699,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
"run-with.async-teardown", /* QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN */
"virtio-blk-vhost-vdpa", /* QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA */
"virtio-blk.iothread-mapping", /* QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING */
+ "smp-clusters", /* QEMU_CAPS_SMP_CLUSTERS */
);
@@ -1552,6 +1553,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
{ "query-display-options/ret-type/+sdl", QEMU_CAPS_SDL },
{ "query-display-options/ret-type/+egl-headless", QEMU_CAPS_EGL_HEADLESS },
{ "query-hotpluggable-cpus/ret-type/props/die-id", QEMU_CAPS_SMP_DIES },
+ { "query-hotpluggable-cpus/ret-type/props/cluster-id", QEMU_CAPS_SMP_CLUSTERS },
{ "query-named-block-nodes/arg-type/flat", QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT },
{ "screendump/arg-type/device", QEMU_CAPS_SCREENDUMP_DEVICE },
{ "set-numa-node/arg-type/+hmat-lb", QEMU_CAPS_NUMA_HMAT },
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 279e9a8273..a353750670 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -678,6 +678,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN, /* asynchronous teardown -run-with async-teardown=on|off */
QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA, /* virtio-blk-vhost-vdpa block driver */
QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING, /* virtio-blk supports per-virtqueue iothread mapping */
+ QEMU_CAPS_SMP_CLUSTERS, /* -smp clusters= */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml b/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml
index 4315241d1d..536524cf18 100644
--- a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml
@@ -154,6 +154,7 @@
<flag name='virtio-crypto'/>
<flag name='pvpanic-pci'/>
<flag name='virtio-gpu.blob'/>
+ <flag name='smp-clusters'/>
<version>7001000</version>
<microcodeVersion>42900244</microcodeVersion>
<package>v7.1.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml
index bd84750dc5..58e1111982 100644
--- a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml
@@ -188,6 +188,7 @@
<flag name='virtio-crypto'/>
<flag name='pvpanic-pci'/>
<flag name='virtio-gpu.blob'/>
+ <flag name='smp-clusters'/>
<version>7001000</version>
<microcodeVersion>43100244</microcodeVersion>
<package>v7.1.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml b/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml
index a1fc441412..127b8ee4c2 100644
--- a/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml
+++ b/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml
@@ -149,6 +149,7 @@
<flag name='virtio-crypto'/>
<flag name='pvpanic-pci'/>
<flag name='virtio-gpu.blob'/>
+ <flag name='smp-clusters'/>
<version>7002000</version>
<microcodeVersion>0</microcodeVersion>
<package>qemu-7.2.0-6.fc37</package>
diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml
index 06a01a2c4c..a30ec3c164 100644
--- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml
+++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml
@@ -192,6 +192,7 @@
<flag name='cryptodev-backend-lkcf'/>
<flag name='pvpanic-pci'/>
<flag name='virtio-gpu.blob'/>
+ <flag name='smp-clusters'/>
<version>7002000</version>
<microcodeVersion>43100245</microcodeVersion>
<package>v7.2.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml
index 8ac1529c30..24ac7b8f6e 100644
--- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml
@@ -192,6 +192,7 @@
<flag name='cryptodev-backend-lkcf'/>
<flag name='pvpanic-pci'/>
<flag name='virtio-gpu.blob'/>
+ <flag name='smp-clusters'/>
<version>7002000</version>
<microcodeVersion>43100245</microcodeVersion>
<package>v7.2.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml b/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml
index 31300d3d31..3f2acb5018 100644
--- a/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml
@@ -138,6 +138,7 @@
<flag name='virtio-crypto'/>
<flag name='pvpanic-pci'/>
<flag name='virtio-gpu.blob'/>
+ <flag name='smp-clusters'/>
<version>7002050</version>
<microcodeVersion>0</microcodeVersion>
<package>v7.2.0-333-g222059a0fc</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml
index c2fa8eb028..85869f6b5d 100644
--- a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml
@@ -196,6 +196,7 @@
<flag name='virtio-gpu.blob'/>
<flag name='rbd-encryption-layering'/>
<flag name='rbd-encryption-luks-any'/>
+ <flag name='smp-clusters'/>
<version>8000000</version>
<microcodeVersion>43100244</microcodeVersion>
<package>v8.0.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml b/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml
index 427ee9d5c7..19422f08fa 100644
--- a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml
@@ -112,6 +112,7 @@
<flag name='rbd-encryption-layering'/>
<flag name='rbd-encryption-luks-any'/>
<flag name='run-with.async-teardown'/>
+ <flag name='smp-clusters'/>
<version>8000050</version>
<microcodeVersion>39100245</microcodeVersion>
<package>v8.0.0-1270-g1c12355b</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml
index d266dd0f31..0caee53550 100644
--- a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml
@@ -198,6 +198,7 @@
<flag name='qcow2-discard-no-unref'/>
<flag name='run-with.async-teardown'/>
<flag name='virtio-blk-vhost-vdpa'/>
+ <flag name='smp-clusters'/>
<version>8001000</version>
<microcodeVersion>43100245</microcodeVersion>
<package>v8.1.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml b/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml
index 40d490c1c0..54fd349365 100644
--- a/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml
@@ -162,6 +162,7 @@
<flag name='rbd-encryption-luks-any'/>
<flag name='qcow2-discard-no-unref'/>
<flag name='run-with.async-teardown'/>
+ <flag name='smp-clusters'/>
<version>8002000</version>
<microcodeVersion>61700246</microcodeVersion>
<package>v8.2.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml
index ee52952702..8a6527810a 100644
--- a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml
@@ -199,6 +199,7 @@
<flag name='qcow2-discard-no-unref'/>
<flag name='run-with.async-teardown'/>
<flag name='virtio-blk-vhost-vdpa'/>
+ <flag name='smp-clusters'/>
<version>8002000</version>
<microcodeVersion>43100246</microcodeVersion>
<package>v8.2.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml
index 65d86f7016..b4c3b1bae3 100644
--- a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml
@@ -200,6 +200,7 @@
<flag name='run-with.async-teardown'/>
<flag name='virtio-blk-vhost-vdpa'/>
<flag name='virtio-blk.iothread-mapping'/>
+ <flag name='smp-clusters'/>
<version>8002050</version>
<microcodeVersion>43100245</microcodeVersion>
<package>v8.2.0-196-g7425b6277f</package>
--
2.43.0

View File

@ -0,0 +1,117 @@
From 66312c8fea7d122acfd833e495e6b81642baff33 Mon Sep 17 00:00:00 2001
Message-ID: <66312c8fea7d122acfd833e495e6b81642baff33.1706524416.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 5 Jan 2024 18:51:29 +0100
Subject: [PATCH] qemu: Make monitor aware of CPU clusters
This makes it so libvirt can obtain accurate information about
guest CPUs from QEMU, and should make it possible to correctly
perform operations such as CPU hotplug.
Of course this is mostly moot at the moment: only aarch64 can use
CPU clusters, and CPU hotplug is not yet implemented on that
architecture.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 763381df53d5a67804f828cb8db661f694d35296)
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/qemu/qemu_domain.c | 3 ++-
src/qemu/qemu_monitor.c | 2 ++
src/qemu/qemu_monitor.h | 2 ++
src/qemu/qemu_monitor_json.c | 5 +++++
4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 3a00fb689e..e2a1bf2c13 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9900,11 +9900,12 @@ qemuDomainRefreshVcpuInfo(virDomainObj *vm,
if (validTIDs)
VIR_DEBUG("vCPU[%zu] PID %llu is valid "
- "(node=%d socket=%d die=%d core=%d thread=%d)",
+ "(node=%d socket=%d die=%d cluster=%d core=%d thread=%d)",
i, (unsigned long long)info[i].tid,
info[i].node_id,
info[i].socket_id,
info[i].die_id,
+ info[i].cluster_id,
info[i].core_id,
info[i].thread_id);
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index dfad4ee1ea..a1773d86d4 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1501,6 +1501,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfo *cpus,
cpus[i].qemu_id = -1;
cpus[i].socket_id = -1;
cpus[i].die_id = -1;
+ cpus[i].cluster_id = -1;
cpus[i].core_id = -1;
cpus[i].thread_id = -1;
cpus[i].node_id = -1;
@@ -1658,6 +1659,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
!vcpus[mainvcpu].online;
vcpus[mainvcpu].socket_id = hotplugvcpus[i].socket_id;
vcpus[mainvcpu].die_id = hotplugvcpus[i].die_id;
+ vcpus[mainvcpu].cluster_id = hotplugvcpus[i].cluster_id;
vcpus[mainvcpu].core_id = hotplugvcpus[i].core_id;
vcpus[mainvcpu].thread_id = hotplugvcpus[i].thread_id;
vcpus[mainvcpu].node_id = hotplugvcpus[i].node_id;
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index c4af9b407d..981c609e9f 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -590,6 +590,7 @@ struct qemuMonitorQueryHotpluggableCpusEntry {
int node_id;
int socket_id;
int die_id;
+ int cluster_id;
int core_id;
int thread_id;
@@ -613,6 +614,7 @@ struct _qemuMonitorCPUInfo {
* all entries are -1 */
int socket_id;
int die_id;
+ int cluster_id;
int core_id;
int thread_id;
int node_id;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 9cb0f3d1d8..e114b6bfb1 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -7579,12 +7579,14 @@ qemuMonitorJSONProcessHotpluggableCpusReply(virJSONValue *vcpu,
entry->node_id = -1;
entry->socket_id = -1;
entry->die_id = -1;
+ entry->cluster_id = -1;
entry->core_id = -1;
entry->thread_id = -1;
ignore_value(virJSONValueObjectGetNumberInt(props, "node-id", &entry->node_id));
ignore_value(virJSONValueObjectGetNumberInt(props, "socket-id", &entry->socket_id));
ignore_value(virJSONValueObjectGetNumberInt(props, "die-id", &entry->die_id));
+ ignore_value(virJSONValueObjectGetNumberInt(props, "cluster-id", &entry->cluster_id));
ignore_value(virJSONValueObjectGetNumberInt(props, "core-id", &entry->core_id));
ignore_value(virJSONValueObjectGetNumberInt(props, "thread-id", &entry->thread_id));
@@ -7622,6 +7624,9 @@ qemuMonitorQueryHotpluggableCpusEntrySort(const void *p1,
if (a->die_id != b->die_id)
return a->die_id - b->die_id;
+ if (a->cluster_id != b->cluster_id)
+ return a->cluster_id - b->cluster_id;
+
if (a->core_id != b->core_id)
return a->core_id - b->core_id;
--
2.43.0

View File

@ -1,178 +0,0 @@
From 6dbe828752378e2215d4fd4fca65c94372ad0cf2 Mon Sep 17 00:00:00 2001
Message-ID: <6dbe828752378e2215d4fd4fca65c94372ad0cf2.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 30 May 2023 18:24:40 +0200
Subject: [PATCH] qemu: Match NVRAM template extension for new domains
Keep things consistent by using the same file extension for the
generated NVRAM path as the NVRAM template.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit b845e376a45a8e93f933a4a41068a9ce27adf755)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_firmware.c | 32 ++++++++++++++++---
src/qemu/qemu_firmware.h | 3 +-
src/qemu/qemu_process.c | 2 +-
...-loader-raw-abi-update.aarch64-latest.args | 2 +-
...t-loader-raw-abi-update.aarch64-latest.xml | 2 +-
6 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 94587638c3..3bb3e5fdfa 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4505,7 +4505,7 @@ qemuDomainDefBootPostParse(virDomainDef *def,
* to start the domain, qemuFirmwareFillDomain() will be run
* again, fail in the same way, and at that point we'll have a
* chance to inform the user of any issues */
- if (qemuFirmwareFillDomain(driver, def) < 0) {
+ if (qemuFirmwareFillDomain(driver, def, abiUpdate) < 0) {
if (abiUpdate) {
return -1;
} else {
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index 3538654913..ebaf32cf71 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -32,6 +32,7 @@
#include "virlog.h"
#include "viralloc.h"
#include "virenum.h"
+#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -1054,6 +1055,7 @@ qemuFirmwareOSInterfaceTypeFromOsDefLoaderType(virDomainLoader type)
* qemuFirmwareEnsureNVRAM:
* @def: domain definition
* @driver: QEMU driver
+ * @abiUpdate: whether a new domain is being defined
*
* Make sure that a source for the NVRAM file exists, possibly by
* creating it. This might involve automatically generating the
@@ -1061,7 +1063,8 @@ qemuFirmwareOSInterfaceTypeFromOsDefLoaderType(virDomainLoader type)
*/
static void
qemuFirmwareEnsureNVRAM(virDomainDef *def,
- virQEMUDriver *driver)
+ virQEMUDriver *driver,
+ bool abiUpdate)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virDomainLoaderDef *loader = def->os.loader;
@@ -1091,8 +1094,25 @@ qemuFirmwareEnsureNVRAM(virDomainDef *def,
loader->nvram->type = VIR_STORAGE_TYPE_FILE;
loader->nvram->format = loader->format;
- if (loader->nvram->format == VIR_STORAGE_FILE_RAW)
- ext = ".fd";
+ if (loader->nvram->format == VIR_STORAGE_FILE_RAW) {
+ /* The extension used by raw edk2 builds has historically
+ * been .fd, but more recent aarch64 builds have started
+ * using the .raw extension instead.
+ *
+ * If we're defining a new domain, we should try to match the
+ * extension for the file backing its NVRAM store with the
+ * one used by the template to keep things nice and
+ * consistent.
+ *
+ * If we're loading an existing domain, however, we need to
+ * stick with the .fd extension to ensure compatibility */
+ if (abiUpdate &&
+ loader->nvramTemplate &&
+ virStringHasSuffix(loader->nvramTemplate, ".raw"))
+ ext = ".raw";
+ else
+ ext = ".fd";
+ }
if (loader->nvram->format == VIR_STORAGE_FILE_QCOW2)
ext = ".qcow2";
@@ -1729,6 +1749,7 @@ qemuFirmwareFillDomainModern(virQEMUDriver *driver,
* qemuFirmwareFillDomain:
* @driver: QEMU driver
* @def: domain definition
+ * @abiUpdate: whether a new domain is being defined
*
* Perform firmware selection.
*
@@ -1752,7 +1773,8 @@ qemuFirmwareFillDomainModern(virQEMUDriver *driver,
*/
int
qemuFirmwareFillDomain(virQEMUDriver *driver,
- virDomainDef *def)
+ virDomainDef *def,
+ bool abiUpdate)
{
virDomainLoaderDef *loader = def->os.loader;
virStorageSource *nvram = loader ? loader->nvram : NULL;
@@ -1822,7 +1844,7 @@ qemuFirmwareFillDomain(virQEMUDriver *driver,
/* Always ensure that the NVRAM path is present, even if we
* haven't found a match: the configuration might simply be
* referring to a custom firmware build */
- qemuFirmwareEnsureNVRAM(def, driver);
+ qemuFirmwareEnsureNVRAM(def, driver, abiUpdate);
return 0;
}
diff --git a/src/qemu/qemu_firmware.h b/src/qemu/qemu_firmware.h
index 1ce0920713..39572d979d 100644
--- a/src/qemu/qemu_firmware.h
+++ b/src/qemu/qemu_firmware.h
@@ -44,7 +44,8 @@ qemuFirmwareFetchConfigs(char ***firmwares,
int
qemuFirmwareFillDomain(virQEMUDriver *driver,
- virDomainDef *def);
+ virDomainDef *def,
+ bool abiUpdate);
int
qemuFirmwareGetSupported(const char *machine,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index db06991450..32fe46dae8 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6706,7 +6706,7 @@ qemuProcessPrepareDomain(virQEMUDriver *driver,
return -1;
VIR_DEBUG("Prepare bios/uefi paths");
- if (qemuFirmwareFillDomain(driver, vm->def) < 0)
+ if (qemuFirmwareFillDomain(driver, vm->def, false) < 0)
return -1;
if (qemuDomainInitializePflashStorageSource(vm, cfg) < 0)
return -1;
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-format-loader-raw-abi-update.aarch64-latest.args b/tests/qemuxml2argvdata/firmware-auto-efi-format-loader-raw-abi-update.aarch64-latest.args
index eb5cd8d5fc..3e319a29bf 100644
--- a/tests/qemuxml2argvdata/firmware-auto-efi-format-loader-raw-abi-update.aarch64-latest.args
+++ b/tests/qemuxml2argvdata/firmware-auto-efi-format-loader-raw-abi-update.aarch64-latest.args
@@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
--blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.raw","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
-machine virt-4.0,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel tcg \
diff --git a/tests/qemuxml2xmloutdata/firmware-auto-efi-format-loader-raw-abi-update.aarch64-latest.xml b/tests/qemuxml2xmloutdata/firmware-auto-efi-format-loader-raw-abi-update.aarch64-latest.xml
index 38c680fabd..ee22b16831 100644
--- a/tests/qemuxml2xmloutdata/firmware-auto-efi-format-loader-raw-abi-update.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/firmware-auto-efi-format-loader-raw-abi-update.aarch64-latest.xml
@@ -11,7 +11,7 @@
<feature enabled='no' name='secure-boot'/>
</firmware>
<loader readonly='yes' type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw</loader>
- <nvram template='/usr/share/edk2/aarch64/vars-template-pflash.raw'>/var/lib/libvirt/qemu/nvram/guest_VARS.fd</nvram>
+ <nvram template='/usr/share/edk2/aarch64/vars-template-pflash.raw'>/var/lib/libvirt/qemu/nvram/guest_VARS.raw</nvram>
<boot dev='hd'/>
</os>
<features>
--
2.42.0

View File

@ -1,175 +0,0 @@
From 5af7ae809ed21678c265a9559c9f70b90dcd31d9 Mon Sep 17 00:00:00 2001
Message-ID: <5af7ae809ed21678c265a9559c9f70b90dcd31d9.1689974710.git.jdenemar@redhat.com>
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
Date: Fri, 14 Jul 2023 16:38:14 +0200
Subject: [PATCH] qemu: S390 does not provide physical address size
Commit be1b7d5b18 introduced parsing /proc/cpuinfo for "address size"
which is not including on S390 and therefore reports an internal error.
Lets remove the parsing on S390.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8417c1394cd4deccee07235d4f7b2c54b774b08d)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2224016
Signed-off-by: Boris Fiuczynski <bfiuczyn@redhat.com>
---
src/cpu/cpu_x86.c | 2 +-
src/qemu/qemu_capabilities.c | 2 +-
src/util/virhostcpu.c | 12 ++++++++++--
src/util/virhostcpu.h | 3 ++-
tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_5.2.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_6.0.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_8.1.0.s390x.xml | 1 -
tests/domaincapsmock.c | 8 ++++++--
9 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 8d371d5501..3c0163c4d1 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2795,7 +2795,7 @@ virCPUx86GetHost(virCPUDef *cpu,
VIR_DEBUG("Host CPU does not support invariant TSC");
}
- if (virHostCPUGetPhysAddrSize(&addrsz) == 0) {
+ if (virHostCPUGetPhysAddrSize(cpuData->arch, &addrsz) == 0) {
virCPUMaxPhysAddrDef *addr = g_new0(virCPUMaxPhysAddrDef, 1);
addr->bits = addrsz;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 338608f0a2..85ea879f0b 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3911,7 +3911,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps,
}
if (virQEMUCapsTypeIsAccelerated(type))
- virHostCPUGetPhysAddrSize(&physAddrSize);
+ virHostCPUGetPhysAddrSize(hostArch, &physAddrSize);
virQEMUCapsSetHostModel(qemuCaps, type, physAddrSize, cpu, migCPU, fullCPU);
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 19195a1470..a15731e9ea 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -1646,10 +1646,17 @@ virHostCPUGetSignature(char **signature)
}
int
-virHostCPUGetPhysAddrSize(unsigned int *size)
+virHostCPUGetPhysAddrSize(const virArch hostArch,
+ unsigned int *size)
{
g_autoptr(FILE) cpuinfo = NULL;
+ if (ARCH_IS_S390(hostArch)) {
+ /* Ensure size is set to 0 as physical address size is unknown */
+ *size = 0;
+ return 0;
+ }
+
if (!(cpuinfo = fopen(CPUINFO_PATH, "r"))) {
virReportSystemError(errno, _("Failed to open cpuinfo file '%1$s'"),
CPUINFO_PATH);
@@ -1669,7 +1676,8 @@ virHostCPUGetSignature(char **signature)
}
int
-virHostCPUGetPhysAddrSize(unsigned int *size G_GNUC_UNUSED)
+virHostCPUGetPhysAddrSize(const virArch hostArch G_GNUC_UNUSED,
+ unsigned int *size G_GNUC_UNUSED)
{
errno = ENOSYS;
return -1;
diff --git a/src/util/virhostcpu.h b/src/util/virhostcpu.h
index 5232fee36d..5f0d43e069 100644
--- a/src/util/virhostcpu.h
+++ b/src/util/virhostcpu.h
@@ -87,7 +87,8 @@ virHostCPUTscInfo *virHostCPUGetTscInfo(void);
int virHostCPUGetSignature(char **signature);
-int virHostCPUGetPhysAddrSize(unsigned int *size);
+int virHostCPUGetPhysAddrSize(const virArch hostArch,
+ unsigned int *size);
int virHostCPUGetHaltPollTime(pid_t pid,
unsigned long long *haltPollSuccess,
diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml b/tests/domaincapsdata/qemu_4.2.0.s390x.xml
index da271825f9..2566f42997 100644
--- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml
@@ -38,7 +38,6 @@
</mode>
<mode name='host-model' supported='yes'>
<model fallback='forbid'>gen15a-base</model>
- <maxphysaddr mode='passthrough' limit='64'/>
<feature policy='require' name='aen'/>
<feature policy='require' name='cmmnt'/>
<feature policy='require' name='vxpdeh'/>
diff --git a/tests/domaincapsdata/qemu_5.2.0.s390x.xml b/tests/domaincapsdata/qemu_5.2.0.s390x.xml
index 99faaad866..12f38d3638 100644
--- a/tests/domaincapsdata/qemu_5.2.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_5.2.0.s390x.xml
@@ -38,7 +38,6 @@
</mode>
<mode name='host-model' supported='yes'>
<model fallback='forbid'>gen15a-base</model>
- <maxphysaddr mode='passthrough' limit='64'/>
<feature policy='require' name='aen'/>
<feature policy='require' name='cmmnt'/>
<feature policy='require' name='vxpdeh'/>
diff --git a/tests/domaincapsdata/qemu_6.0.0.s390x.xml b/tests/domaincapsdata/qemu_6.0.0.s390x.xml
index df3708f801..703f729ae2 100644
--- a/tests/domaincapsdata/qemu_6.0.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_6.0.0.s390x.xml
@@ -38,7 +38,6 @@
</mode>
<mode name='host-model' supported='yes'>
<model fallback='forbid'>gen15a-base</model>
- <maxphysaddr mode='passthrough' limit='64'/>
<feature policy='require' name='aen'/>
<feature policy='require' name='cmmnt'/>
<feature policy='require' name='vxpdeh'/>
diff --git a/tests/domaincapsdata/qemu_8.1.0.s390x.xml b/tests/domaincapsdata/qemu_8.1.0.s390x.xml
index d70b639503..3562e96965 100644
--- a/tests/domaincapsdata/qemu_8.1.0.s390x.xml
+++ b/tests/domaincapsdata/qemu_8.1.0.s390x.xml
@@ -38,7 +38,6 @@
</mode>
<mode name='host-model' supported='yes'>
<model fallback='forbid'>gen16a-base</model>
- <maxphysaddr mode='passthrough' limit='64'/>
<feature policy='require' name='nnpa'/>
<feature policy='require' name='aen'/>
<feature policy='require' name='cmmnt'/>
diff --git a/tests/domaincapsmock.c b/tests/domaincapsmock.c
index cecb333602..6ae0c4ad45 100644
--- a/tests/domaincapsmock.c
+++ b/tests/domaincapsmock.c
@@ -37,9 +37,13 @@ virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UNUSED)
}
int
-virHostCPUGetPhysAddrSize(unsigned int *size)
+virHostCPUGetPhysAddrSize(const virArch hostArch,
+ unsigned int *size)
{
- *size = 64;
+ if (ARCH_IS_S390(hostArch))
+ *size = 0;
+ else
+ *size = 64;
return 0;
}
--
2.41.0

View File

@ -0,0 +1,646 @@
From 53727afb9517dbfe4182f669eaf8dbe8c38e143c Mon Sep 17 00:00:00 2001
Message-ID: <53727afb9517dbfe4182f669eaf8dbe8c38e143c.1706524416.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 5 Jan 2024 18:44:56 +0100
Subject: [PATCH] qemu: Use CPU clusters for guests
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 655459420adb447da4744408e62537bc6ae960dd)
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/qemu/qemu_command.c | 5 ++++-
.../qemuxml2argvdata/cpu-hotplug-startup.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-numa-disjoint.x86_64-latest.args | 2 +-
.../qemuxml2argvdata/cpu-numa-disordered.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-numa-memshared.x86_64-latest.args | 2 +-
.../cpu-numa-no-memory-element.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-numa1.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-numa2.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-topology1.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-topology2.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-topology3.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-topology4.x86_64-latest.args | 2 +-
.../fd-memory-no-numa-topology.x86_64-latest.args | 2 +-
.../fd-memory-numa-topology.x86_64-latest.args | 2 +-
.../fd-memory-numa-topology2.x86_64-latest.args | 2 +-
.../fd-memory-numa-topology3.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args | 2 +-
.../memfd-memory-default-hugepage.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args | 2 +-
.../memory-hotplug-dimm-addr.x86_64-latest.args | 2 +-
.../qemuxml2argvdata/memory-hotplug-dimm.x86_64-latest.args | 2 +-
.../memory-hotplug-multiple.x86_64-latest.args | 2 +-
.../memory-hotplug-nvdimm-access.x86_64-latest.args | 2 +-
.../memory-hotplug-nvdimm-align.x86_64-latest.args | 2 +-
.../memory-hotplug-nvdimm-label.x86_64-latest.args | 2 +-
.../memory-hotplug-nvdimm-pmem.x86_64-latest.args | 2 +-
.../memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.args | 2 +-
.../memory-hotplug-nvdimm-ppc64.ppc64-latest.args | 2 +-
.../memory-hotplug-nvdimm-readonly.x86_64-latest.args | 2 +-
.../memory-hotplug-nvdimm.x86_64-latest.args | 2 +-
.../memory-hotplug-virtio-mem.x86_64-latest.args | 2 +-
.../memory-hotplug-virtio-pmem.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/memory-hotplug.x86_64-latest.args | 2 +-
.../numad-auto-memory-vcpu-cpuset.x86_64-latest.args | 2 +-
...to-memory-vcpu-no-cpuset-and-placement.x86_64-latest.args | 2 +-
.../numad-auto-vcpu-no-numatune.x86_64-latest.args | 2 +-
.../numad-auto-vcpu-static-numatune.x86_64-latest.args | 2 +-
.../numad-static-memory-auto-vcpu.x86_64-latest.args | 2 +-
.../numad-static-vcpu-no-numatune.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/numad.x86_64-latest.args | 2 +-
.../numatune-auto-nodeset-invalid.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/pci-expander-bus.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/pcie-expander-bus.x86_64-latest.args | 2 +-
.../qemuxml2argvdata/pseries-phb-numa-node.ppc64-latest.args | 2 +-
44 files changed, 47 insertions(+), 44 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 71daa85e55..712feb7b81 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7226,7 +7226,8 @@ qemuBuildSmpCommandLine(virCommand *cmd,
_("Only 1 die per socket is supported"));
return -1;
}
- if (def->cpu->clusters != 1) {
+ if (def->cpu->clusters != 1 &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_CLUSTERS)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only 1 cluster per die is supported"));
return -1;
@@ -7234,6 +7235,8 @@ qemuBuildSmpCommandLine(virCommand *cmd,
virBufferAsprintf(&buf, ",sockets=%u", def->cpu->sockets);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_DIES))
virBufferAsprintf(&buf, ",dies=%u", def->cpu->dies);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_CLUSTERS))
+ virBufferAsprintf(&buf, ",clusters=%u", def->cpu->clusters);
virBufferAsprintf(&buf, ",cores=%u", def->cpu->cores);
virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads);
} else {
diff --git a/tests/qemuxml2argvdata/cpu-hotplug-startup.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-hotplug-startup.x86_64-latest.args
index 009c08d71a..af1b464104 100644
--- a/tests/qemuxml2argvdata/cpu-hotplug-startup.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-hotplug-startup.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
--smp 1,maxcpus=6,sockets=3,dies=1,cores=2,threads=1 \
+-smp 1,maxcpus=6,sockets=3,dies=1,clusters=1,cores=2,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/cpu-numa-disjoint.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-numa-disjoint.x86_64-latest.args
index 3b12934425..22fca082a8 100644
--- a/tests/qemuxml2argvdata/cpu-numa-disjoint.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-numa-disjoint.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k \
-overcommit mem-lock=off \
--smp 16,sockets=2,dies=1,cores=4,threads=2 \
+-smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":112197632}' \
-numa node,nodeid=0,cpus=0-3,cpus=8-11,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":112197632}' \
diff --git a/tests/qemuxml2argvdata/cpu-numa-disordered.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-numa-disordered.x86_64-latest.args
index ee6974326d..bc4a6ad5f3 100644
--- a/tests/qemuxml2argvdata/cpu-numa-disordered.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-numa-disordered.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=328704k \
-overcommit mem-lock=off \
--smp 16,sockets=2,dies=1,cores=4,threads=2 \
+-smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":112197632}' \
-numa node,nodeid=0,cpus=0-5,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":112197632}' \
diff --git a/tests/qemuxml2argvdata/cpu-numa-memshared.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-numa-memshared.x86_64-latest.args
index 0c9ec88b8b..1e486b1bbc 100644
--- a/tests/qemuxml2argvdata/cpu-numa-memshared.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-numa-memshared.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k \
-overcommit mem-lock=off \
--smp 16,sockets=2,dies=1,cores=4,threads=2 \
+-smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
-object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/ram-node0","share":true,"size":112197632}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-file","id":"ram-node1","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/ram-node1","share":false,"size":112197632}' \
diff --git a/tests/qemuxml2argvdata/cpu-numa-no-memory-element.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-numa-no-memory-element.x86_64-latest.args
index 31a61f023e..59372c4ab9 100644
--- a/tests/qemuxml2argvdata/cpu-numa-no-memory-element.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-numa-no-memory-element.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k \
-overcommit mem-lock=off \
--smp 16,sockets=2,dies=1,cores=4,threads=2 \
+-smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":112197632}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":112197632}' \
diff --git a/tests/qemuxml2argvdata/cpu-numa1.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-numa1.x86_64-latest.args
index 31a61f023e..59372c4ab9 100644
--- a/tests/qemuxml2argvdata/cpu-numa1.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-numa1.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k \
-overcommit mem-lock=off \
--smp 16,sockets=2,dies=1,cores=4,threads=2 \
+-smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":112197632}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":112197632}' \
diff --git a/tests/qemuxml2argvdata/cpu-numa2.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-numa2.x86_64-latest.args
index 31a61f023e..59372c4ab9 100644
--- a/tests/qemuxml2argvdata/cpu-numa2.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-numa2.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k \
-overcommit mem-lock=off \
--smp 16,sockets=2,dies=1,cores=4,threads=2 \
+-smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":112197632}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":112197632}' \
diff --git a/tests/qemuxml2argvdata/cpu-topology1.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-topology1.x86_64-latest.args
index 009c08d71a..af1b464104 100644
--- a/tests/qemuxml2argvdata/cpu-topology1.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-topology1.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
--smp 1,maxcpus=6,sockets=3,dies=1,cores=2,threads=1 \
+-smp 1,maxcpus=6,sockets=3,dies=1,clusters=1,cores=2,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/cpu-topology2.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-topology2.x86_64-latest.args
index 7ba175fa80..8560eb6126 100644
--- a/tests/qemuxml2argvdata/cpu-topology2.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-topology2.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
--smp 6,sockets=1,dies=1,cores=2,threads=3 \
+-smp 6,sockets=1,dies=1,clusters=1,cores=2,threads=3 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/cpu-topology3.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-topology3.x86_64-latest.args
index c11b4cd307..3878c558b8 100644
--- a/tests/qemuxml2argvdata/cpu-topology3.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-topology3.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
--smp 6,sockets=3,dies=1,cores=2,threads=1 \
+-smp 6,sockets=3,dies=1,clusters=1,cores=2,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/cpu-topology4.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-topology4.x86_64-latest.args
index d0e31ba2b5..8720038c0d 100644
--- a/tests/qemuxml2argvdata/cpu-topology4.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-topology4.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
--smp 1,maxcpus=6,sockets=1,dies=3,cores=2,threads=1 \
+-smp 1,maxcpus=6,sockets=1,dies=3,clusters=1,cores=2,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.x86_64-latest.args b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.x86_64-latest.args
index 58b3c7b544..1bd75a85a6 100644
--- a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-instance-00000092/.config \
-m size=14680064k \
-object '{"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-instance-00000092/pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"prealloc":true,"size":15032385536}' \
-overcommit mem-lock=off \
--smp 8,sockets=8,dies=1,cores=1,threads=1 \
+-smp 8,sockets=8,dies=1,clusters=1,cores=1,threads=1 \
-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology.x86_64-latest.args b/tests/qemuxml2argvdata/fd-memory-numa-topology.x86_64-latest.args
index 21f9a16540..17ef506431 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-instance-00000092/.config \
-cpu qemu64 \
-m size=14680064k \
-overcommit mem-lock=off \
--smp 8,sockets=1,dies=1,cores=8,threads=1 \
+-smp 8,sockets=1,dies=1,clusters=1,cores=8,threads=1 \
-object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node0","share":true,"prealloc":true,"size":15032385536}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology2.x86_64-latest.args b/tests/qemuxml2argvdata/fd-memory-numa-topology2.x86_64-latest.args
index 3bf16f9caf..b247231b85 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology2.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology2.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-instance-00000092/.config \
-cpu qemu64 \
-m size=29360128k \
-overcommit mem-lock=off \
--smp 20,sockets=1,dies=1,cores=20,threads=1 \
+-smp 20,sockets=1,dies=1,clusters=1,cores=20,threads=1 \
-object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node0","share":false,"prealloc":true,"size":15032385536}' \
-numa node,nodeid=0,cpus=0-7,cpus=16-19,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-file","id":"ram-node1","mem-path":"/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node1","share":true,"prealloc":true,"size":15032385536}' \
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology3.x86_64-latest.args b/tests/qemuxml2argvdata/fd-memory-numa-topology3.x86_64-latest.args
index 3153e22d56..9e94209499 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology3.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology3.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-instance-00000092/.config \
-cpu qemu64 \
-m size=44040192k \
-overcommit mem-lock=off \
--smp 32,sockets=1,dies=1,cores=32,threads=1 \
+-smp 32,sockets=1,dies=1,clusters=1,cores=32,threads=1 \
-object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node0","share":true,"prealloc":true,"size":15032385536}' \
-numa node,nodeid=0,cpus=0-1,cpus=6-31,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-file","id":"ram-node1","mem-path":"/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node1","share":true,"prealloc":true,"size":15032385536}' \
diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
index fa376accb5..f30db0ad09 100644
--- a/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=1048576k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"size":1073741824}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memfd-memory-default-hugepage.x86_64-latest.args b/tests/qemuxml2argvdata/memfd-memory-default-hugepage.x86_64-latest.args
index 55969eb2fd..f850d7be60 100644
--- a/tests/qemuxml2argvdata/memfd-memory-default-hugepage.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memfd-memory-default-hugepage.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-instance-00000092/.config \
-cpu qemu64 \
-m size=14680064k \
-overcommit mem-lock=off \
--smp 8,sockets=1,dies=1,cores=8,threads=1 \
+-smp 8,sockets=1,dies=1,clusters=1,cores=8,threads=1 \
-object '{"qom-type":"thread-context","id":"tc-ram-node0","node-affinity":[3]}' \
-object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,"hugetlbsize":2097152,"share":true,"prealloc":true,"size":15032385536,"host-nodes":[3],"policy":"preferred","prealloc-context":"tc-ram-node0"}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
index 1ef2d69fcb..dbe2b82a56 100644
--- a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-instance-00000092/.config \
-cpu qemu64 \
-m size=14680064k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 8,sockets=1,dies=1,cores=8,threads=1 \
+-smp 8,sockets=1,dies=1,clusters=1,cores=8,threads=1 \
-object '{"qom-type":"thread-context","id":"tc-ram-node0","node-affinity":[3]}' \
-object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,"hugetlbsize":2097152,"share":true,"prealloc":true,"prealloc-threads":8,"size":15032385536,"host-nodes":[3],"policy":"preferred","prealloc-context":"tc-ram-node0"}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args
index 6ae1fd1b98..c15fe191de 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-dimm.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-dimm.x86_64-latest.args
index 71817da309..a729930db2 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-dimm.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-dimm.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-multiple.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-multiple.x86_64-latest.args
index ad1dad01ac..f1f2f93a11 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-multiple.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-multiple.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=2095104k,slots=2,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":2145386496}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args
index f09ae22927..d53732b39e 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args
index 6cfe4b8263..cba467d9d3 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args
index 4041c15b2b..2ad23a0224 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args
index 3547e96c00..ac5ca187b1 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.args
index 9b57518fca..c2c1623d9f 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu POWER9 \
-m size=1048576k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.args
index 9b57518fca..c2c1623d9f 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu POWER9 \
-m size=1048576k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args
index 17bacfb2f6..8af4673841 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args
index 1321e5556e..6531caa908 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=1048576k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
index 607ce9b0e8..dbe96ae21d 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=2095104k,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":2145386496}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args
index 9bbde420a9..df7b7f80a9 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=2095104k,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":2145386496}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/memory-hotplug.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug.x86_64-latest.args
index 53f0fbc68f..d04d9d73e9 100644
--- a/tests/qemuxml2argvdata/memory-hotplug.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu qemu64 \
-m size=219136k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.args b/tests/qemuxml2argvdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.args
index d4238f3d9e..138c8255f7 100644
--- a/tests/qemuxml2argvdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0,1,2,3],"policy":"interleave"}' \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.args b/tests/qemuxml2argvdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.args
index d4238f3d9e..138c8255f7 100644
--- a/tests/qemuxml2argvdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0,1,2,3],"policy":"interleave"}' \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/numad-auto-vcpu-no-numatune.x86_64-latest.args b/tests/qemuxml2argvdata/numad-auto-vcpu-no-numatune.x86_64-latest.args
index 7022d2cc00..f13f04c9d4 100644
--- a/tests/qemuxml2argvdata/numad-auto-vcpu-no-numatune.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numad-auto-vcpu-no-numatune.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0,1,2,3],"policy":"bind"}' \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/numad-auto-vcpu-static-numatune.x86_64-latest.args b/tests/qemuxml2argvdata/numad-auto-vcpu-static-numatune.x86_64-latest.args
index 9ddfb286b5..f1c49619db 100644
--- a/tests/qemuxml2argvdata/numad-auto-vcpu-static-numatune.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numad-auto-vcpu-static-numatune.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0],"policy":"interleave"}' \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/numad-static-memory-auto-vcpu.x86_64-latest.args b/tests/qemuxml2argvdata/numad-static-memory-auto-vcpu.x86_64-latest.args
index d4238f3d9e..138c8255f7 100644
--- a/tests/qemuxml2argvdata/numad-static-memory-auto-vcpu.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numad-static-memory-auto-vcpu.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0,1,2,3],"policy":"interleave"}' \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/numad-static-vcpu-no-numatune.x86_64-latest.args b/tests/qemuxml2argvdata/numad-static-vcpu-no-numatune.x86_64-latest.args
index ffbccb8408..76ca5c4bea 100644
--- a/tests/qemuxml2argvdata/numad-static-vcpu-no-numatune.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numad-static-vcpu-no-numatune.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/numad.x86_64-latest.args b/tests/qemuxml2argvdata/numad.x86_64-latest.args
index d4238f3d9e..138c8255f7 100644
--- a/tests/qemuxml2argvdata/numad.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numad.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0,1,2,3],"policy":"interleave"}' \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/numatune-auto-nodeset-invalid.x86_64-latest.args b/tests/qemuxml2argvdata/numatune-auto-nodeset-invalid.x86_64-latest.args
index 57a2b893f1..e35471d91b 100644
--- a/tests/qemuxml2argvdata/numatune-auto-nodeset-invalid.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numatune-auto-nodeset-invalid.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0,1,2,3],"policy":"preferred"}' \
-overcommit mem-lock=off \
--smp 2,sockets=2,dies=1,cores=1,threads=1 \
+-smp 2,sockets=2,dies=1,clusters=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
diff --git a/tests/qemuxml2argvdata/pci-expander-bus.x86_64-latest.args b/tests/qemuxml2argvdata/pci-expander-bus.x86_64-latest.args
index bf553a8e32..d3960731be 100644
--- a/tests/qemuxml2argvdata/pci-expander-bus.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/pci-expander-bus.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-expander-test/.config \
-cpu qemu64 \
-m size=219136k \
-overcommit mem-lock=off \
--smp 16,sockets=2,dies=1,cores=4,threads=2 \
+-smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":112197632}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":112197632}' \
diff --git a/tests/qemuxml2argvdata/pcie-expander-bus.x86_64-latest.args b/tests/qemuxml2argvdata/pcie-expander-bus.x86_64-latest.args
index 3fb86c29c2..b179fadc27 100644
--- a/tests/qemuxml2argvdata/pcie-expander-bus.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/pcie-expander-bus.x86_64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-pcie-expander-bus-te/.config \
-cpu qemu64 \
-m size=219136k \
-overcommit mem-lock=off \
--smp 16,sockets=2,dies=1,cores=4,threads=2 \
+-smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":112197632}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":112197632}' \
diff --git a/tests/qemuxml2argvdata/pseries-phb-numa-node.ppc64-latest.args b/tests/qemuxml2argvdata/pseries-phb-numa-node.ppc64-latest.args
index 7ffcb1d8c5..942540a296 100644
--- a/tests/qemuxml2argvdata/pseries-phb-numa-node.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/pseries-phb-numa-node.ppc64-latest.args
@@ -15,7 +15,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-cpu POWER9 \
-m size=2097152k \
-overcommit mem-lock=off \
--smp 8,sockets=2,dies=1,cores=1,threads=4 \
+-smp 8,sockets=2,dies=1,clusters=1,cores=1,threads=4 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824,"host-nodes":[1],"policy":"bind"}' \
-numa node,nodeid=0,cpus=0-3,memdev=ram-node0 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":1073741824,"host-nodes":[2],"policy":"bind"}' \
--
2.43.0

View File

@ -1,97 +0,0 @@
From 1c1274ab6be81184ca2193a86735e2edb27aee8d Mon Sep 17 00:00:00 2001
Message-ID: <1c1274ab6be81184ca2193a86735e2edb27aee8d.1689974709.git.jdenemar@redhat.com>
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
Date: Wed, 5 Jul 2023 08:20:25 +0200
Subject: [PATCH] qemu: add run-with async-teardown capability
QEMU capability is looking in query-command-line-options response for
...
{
"parameters": [
{
"name": "async-teardown",
"type": "boolean"
}
],
"option": "run-with"
}
...
allow to use the QEMU option -run-with async-teardown=on|off
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 65c6513811d1cdc7e97319164d7528411520dd0c)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2168499
Signed-off-by: Boris Fiuczynski <bfiuczyn@redhat.com>
---
src/qemu/qemu_capabilities.c | 4 ++++
src/qemu/qemu_capabilities.h | 3 +++
tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml | 1 +
4 files changed, 9 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7dad7231ee..c9f4b17208 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -694,6 +694,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
"rbd-encryption-layering", /* QEMU_CAPS_RBD_ENCRYPTION_LAYERING */
"rbd-encryption-luks-any", /* QEMU_CAPS_RBD_ENCRYPTION_LUKS_ANY */
"qcow2-discard-no-unref", /* QEMU_CAPS_QCOW2_DISCARD_NO_UNREF */
+
+ /* 450 */
+ "run-with.async-teardown", /* QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN */
);
@@ -3369,6 +3372,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
{ "spice", "gl", QEMU_CAPS_SPICE_GL },
{ "spice", "rendernode", QEMU_CAPS_SPICE_RENDERNODE },
{ "vnc", "power-control", QEMU_CAPS_VNC_POWER_CONTROL },
+ { "run-with", "async-teardown", QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN },
};
static int
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index ce545cb2cc..2460fa7fa0 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -674,6 +674,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_RBD_ENCRYPTION_LUKS_ANY, /* luks-any (LUKS and LUKS2) encryption format for Ceph RBD */
QEMU_CAPS_QCOW2_DISCARD_NO_UNREF, /* qcow2 block driver allows discards without unrefing the sector */
+ /* 450 */
+ QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN, /* asynchronous teardown -run-with async-teardown=on|off */
+
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml b/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml
index 23b5aece15..88c7ac89db 100644
--- a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml
@@ -114,6 +114,7 @@
<flag name='virtio-gpu.blob'/>
<flag name='rbd-encryption-layering'/>
<flag name='rbd-encryption-luks-any'/>
+ <flag name='run-with.async-teardown'/>
<version>8000050</version>
<microcodeVersion>39100245</microcodeVersion>
<package>v8.0.0-1270-g1c12355b</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml
index f717c83fec..475496a8c8 100644
--- a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml
@@ -206,6 +206,7 @@
<flag name='rbd-encryption-layering'/>
<flag name='rbd-encryption-luks-any'/>
<flag name='qcow2-discard-no-unref'/>
+ <flag name='run-with.async-teardown'/>
<version>8000050</version>
<microcodeVersion>43100245</microcodeVersion>
<package>v8.0.0-1739-g5f9dd6a8ce</package>
--
2.41.0

View File

@ -1,836 +0,0 @@
From d216c360f9d0acda0726194aed81e145018a3951 Mon Sep 17 00:00:00 2001
Message-ID: <d216c360f9d0acda0726194aed81e145018a3951.1689974709.git.jdenemar@redhat.com>
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
Date: Wed, 5 Jul 2023 08:20:26 +0200
Subject: [PATCH] qemu: allow use of async teardown in domain
Asynchronous teardown can be specified if the QEMU binary supports it by
adding in the domain XML
<features>
...
<async-teardown enabled='yes|no'/>
...
</features>
By default this new feature is disabled.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 3bf02acdc5446b2c4a3078f99d8f5232acff9043)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2168499
Signed-off-by: Boris Fiuczynski <bfiuczyn@redhat.com>
---
docs/formatdomain.rst | 6 +++
src/conf/domain_conf.c | 22 ++++++++++
src/conf/domain_conf.h | 1 +
src/conf/schemas/domaincommon.rng | 9 ++++
src/qemu/qemu_command.c | 22 ++++++++++
src/qemu/qemu_validate.c | 9 ++++
.../async-teardown.x86_64-latest.args | 37 ++++++++++++++++
tests/qemuxml2argvdata/async-teardown.xml | 31 +++++++++++++
...0-async-teardown-disabled.s390x-6.0.0.args | 35 +++++++++++++++
...-async-teardown-disabled.s390x-latest.args | 36 +++++++++++++++
.../s390-async-teardown-disabled.xml | 24 ++++++++++
...async-teardown-no-attrib.s390x-latest.args | 36 +++++++++++++++
.../s390-async-teardown-no-attrib.xml | 24 ++++++++++
.../s390-async-teardown.s390x-6.0.0.err | 1 +
.../s390-async-teardown.s390x-latest.args | 36 +++++++++++++++
.../qemuxml2argvdata/s390-async-teardown.xml | 24 ++++++++++
tests/qemuxml2argvtest.c | 7 +++
.../async-teardown.x86_64-latest.xml | 44 +++++++++++++++++++
...90-async-teardown-disabled.s390x-6.0.0.xml | 36 +++++++++++++++
...0-async-teardown-disabled.s390x-latest.xml | 36 +++++++++++++++
...-async-teardown-no-attrib.s390x-latest.xml | 36 +++++++++++++++
.../s390-async-teardown.s390x-latest.xml | 36 +++++++++++++++
tests/qemuxml2xmltest.c | 6 +++
23 files changed, 554 insertions(+)
create mode 100644 tests/qemuxml2argvdata/async-teardown.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/async-teardown.xml
create mode 100644 tests/qemuxml2argvdata/s390-async-teardown-disabled.s390x-6.0.0.args
create mode 100644 tests/qemuxml2argvdata/s390-async-teardown-disabled.s390x-latest.args
create mode 100644 tests/qemuxml2argvdata/s390-async-teardown-disabled.xml
create mode 100644 tests/qemuxml2argvdata/s390-async-teardown-no-attrib.s390x-latest.args
create mode 100644 tests/qemuxml2argvdata/s390-async-teardown-no-attrib.xml
create mode 100644 tests/qemuxml2argvdata/s390-async-teardown.s390x-6.0.0.err
create mode 100644 tests/qemuxml2argvdata/s390-async-teardown.s390x-latest.args
create mode 100644 tests/qemuxml2argvdata/s390-async-teardown.xml
create mode 100644 tests/qemuxml2xmloutdata/async-teardown.x86_64-latest.xml
create mode 100644 tests/qemuxml2xmloutdata/s390-async-teardown-disabled.s390x-6.0.0.xml
create mode 100644 tests/qemuxml2xmloutdata/s390-async-teardown-disabled.s390x-latest.xml
create mode 100644 tests/qemuxml2xmloutdata/s390-async-teardown-no-attrib.s390x-latest.xml
create mode 100644 tests/qemuxml2xmloutdata/s390-async-teardown.s390x-latest.xml
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index f29449f749..c61c8a3fec 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -2000,6 +2000,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off.
<tcg>
<tb-cache unit='MiB'>128</tb-cache>
</tcg>
+ <async-teardown enabled='yes'/>
</features>
...
@@ -2230,6 +2231,11 @@ are:
tb-cache The size of translation block cache size an integer (a multiple of MiB) :since:`8.0.0`
=========== ============================================== =================================================== ==============
+``async-teardown``
+ Depending on the ``enabled`` attribute (values ``yes``, ``no``) enable or
+ disable QEMU asynchronous teardown to improve memory reclaiming on a guest.
+ :since:`Since 9.6.0` (QEMU only)
+
Time keeping
------------
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4121b6a054..5ac5c0b771 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -181,6 +181,7 @@ VIR_ENUM_IMPL(virDomainFeature,
"sbbc",
"ibs",
"tcg",
+ "async-teardown",
);
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy,
@@ -16689,6 +16690,20 @@ virDomainFeaturesDefParse(virDomainDef *def,
return -1;
break;
+ case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN: {
+ virTristateBool enabled;
+
+ if (virXMLPropTristateBool(nodes[i], "enabled",
+ VIR_XML_PROP_NONE, &enabled) < 0)
+ return -1;
+
+ if (enabled == VIR_TRISTATE_BOOL_ABSENT)
+ enabled = VIR_TRISTATE_BOOL_YES;
+
+ def->features[val] = enabled;
+ break;
+ }
+
case VIR_DOMAIN_FEATURE_LAST:
break;
}
@@ -20628,6 +20643,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
case VIR_DOMAIN_FEATURE_MSRS:
case VIR_DOMAIN_FEATURE_TCG:
+ case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN:
case VIR_DOMAIN_FEATURE_LAST:
break;
}
@@ -27340,6 +27356,12 @@ virDomainDefFormatFeatures(virBuffer *buf,
virDomainFeatureTCGFormat(&childBuf, def);
break;
+ case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN:
+ if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT)
+ virBufferAsprintf(&childBuf, "<async-teardown enabled='%s'/>\n",
+ virTristateBoolTypeToString(def->features[i]));
+ break;
+
case VIR_DOMAIN_FEATURE_LAST:
break;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cddaa3824d..c857ba556f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2170,6 +2170,7 @@ typedef enum {
VIR_DOMAIN_FEATURE_SBBC,
VIR_DOMAIN_FEATURE_IBS,
VIR_DOMAIN_FEATURE_TCG,
+ VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN,
VIR_DOMAIN_FEATURE_LAST
} virDomainFeature;
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index fcf9e00600..c2f56b0490 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -6660,6 +6660,15 @@
<optional>
<ref name="tcgfeatures"/>
</optional>
+ <optional>
+ <element name="async-teardown">
+ <optional>
+ <attribute name="enabled">
+ <ref name="virYesNo"/>
+ </attribute>
+ </optional>
+ </element>
+ </optional>
</interleave>
</element>
</optional>
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index cde6ab4dde..ec5d8b52d4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10175,6 +10175,25 @@ qemuBuildCryptoCommandLine(virCommand *cmd,
}
+static int
+qemuBuildAsyncTeardownCommandLine(virCommand *cmd,
+ const virDomainDef *def,
+ virQEMUCaps *qemuCaps)
+{
+ g_autofree char *async = NULL;
+ virTristateBool enabled = def->features[VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN];
+
+ if (enabled != VIR_TRISTATE_BOOL_ABSENT &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN)) {
+ async = g_strdup_printf("async-teardown=%s",
+ virTristateSwitchTypeToString(enabled));
+ virCommandAddArgList(cmd, "-run-with", async, NULL);
+ }
+
+ return 0;
+}
+
+
typedef enum {
QEMU_COMMAND_DEPRECATION_BEHAVIOR_NONE = 0,
QEMU_COMMAND_DEPRECATION_BEHAVIOR_OMIT,
@@ -10530,6 +10549,9 @@ qemuBuildCommandLine(virDomainObj *vm,
if (qemuBuildCryptoCommandLine(cmd, def, qemuCaps) < 0)
return NULL;
+ if (qemuBuildAsyncTeardownCommandLine(cmd, def, qemuCaps) < 0)
+ return NULL;
+
if (cfg->logTimestamp)
virCommandAddArgList(cmd, "-msg", "timestamp=on", NULL);
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index a53729d349..7e09e2c52f 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -219,6 +219,15 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
}
break;
+ case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN:
+ if (def->features[i] == VIR_TRISTATE_BOOL_YES &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("asynchronous teardown is not available with this QEMU binary"));
+ return -1;
+ }
+ break;
+
case VIR_DOMAIN_FEATURE_SMM:
case VIR_DOMAIN_FEATURE_KVM:
case VIR_DOMAIN_FEATURE_XEN:
diff --git a/tests/qemuxml2argvdata/async-teardown.x86_64-latest.args b/tests/qemuxml2argvdata/async-teardown.x86_64-latest.args
new file mode 100644
index 0000000000..455382f1f0
--- /dev/null
+++ b/tests/qemuxml2argvdata/async-teardown.x86_64-latest.args
@@ -0,0 +1,37 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=219136k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
+-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-run-with async-teardown=on \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/async-teardown.xml b/tests/qemuxml2argvdata/async-teardown.xml
new file mode 100644
index 0000000000..70c1eccc55
--- /dev/null
+++ b/tests/qemuxml2argvdata/async-teardown.xml
@@ -0,0 +1,31 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <features>
+ <async-teardown enabled='yes'/>
+ </features>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='fdc' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/s390-async-teardown-disabled.s390x-6.0.0.args b/tests/qemuxml2argvdata/s390-async-teardown-disabled.s390x-6.0.0.args
new file mode 100644
index 0000000000..57690530a2
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-async-teardown-disabled.s390x-6.0.0.args
@@ -0,0 +1,35 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-s390x \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine s390-ccw-virtio-6.0,usb=off,dump-guest-core=off,memory-backend=s390.ram \
+-accel tcg \
+-cpu qemu \
+-m size=262144k \
+-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":268435456}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device virtio-serial-ccw,id=virtio-serial0,devno=fe.0.0000 \
+-chardev pty,id=charconsole0 \
+-device virtconsole,chardev=charconsole0,id=console0 \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0001 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/s390-async-teardown-disabled.s390x-latest.args b/tests/qemuxml2argvdata/s390-async-teardown-disabled.s390x-latest.args
new file mode 100644
index 0000000000..96b18b83ce
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-async-teardown-disabled.s390x-latest.args
@@ -0,0 +1,36 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-s390x \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine s390-ccw-virtio,usb=off,dump-guest-core=off,memory-backend=s390.ram \
+-accel tcg \
+-cpu qemu \
+-m size=262144k \
+-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":268435456}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"virtio-serial-ccw","id":"virtio-serial0","devno":"fe.0.0000"}' \
+-chardev pty,id=charconsole0 \
+-device '{"driver":"virtconsole","chardev":"charconsole0","id":"console0"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-balloon-ccw","id":"balloon0","devno":"fe.0.0001"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-run-with async-teardown=off \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/s390-async-teardown-disabled.xml b/tests/qemuxml2argvdata/s390-async-teardown-disabled.xml
new file mode 100644
index 0000000000..3939be0006
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-async-teardown-disabled.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory>262144</memory>
+ <currentMemory>262144</currentMemory>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <features>
+ <async-teardown enabled='no'/>
+ </features>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <controller type='virtio-serial' index='0'>
+ </controller>
+ <console type='pty'>
+ <target type='virtio'/>
+ </console>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/s390-async-teardown-no-attrib.s390x-latest.args b/tests/qemuxml2argvdata/s390-async-teardown-no-attrib.s390x-latest.args
new file mode 100644
index 0000000000..cc7866499f
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-async-teardown-no-attrib.s390x-latest.args
@@ -0,0 +1,36 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-s390x \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine s390-ccw-virtio,usb=off,dump-guest-core=off,memory-backend=s390.ram \
+-accel tcg \
+-cpu qemu \
+-m size=262144k \
+-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":268435456}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"virtio-serial-ccw","id":"virtio-serial0","devno":"fe.0.0000"}' \
+-chardev pty,id=charconsole0 \
+-device '{"driver":"virtconsole","chardev":"charconsole0","id":"console0"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-balloon-ccw","id":"balloon0","devno":"fe.0.0001"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-run-with async-teardown=on \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/s390-async-teardown-no-attrib.xml b/tests/qemuxml2argvdata/s390-async-teardown-no-attrib.xml
new file mode 100644
index 0000000000..e069cd41ed
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-async-teardown-no-attrib.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory>262144</memory>
+ <currentMemory>262144</currentMemory>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <features>
+ <async-teardown/>
+ </features>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <controller type='virtio-serial' index='0'>
+ </controller>
+ <console type='pty'>
+ <target type='virtio'/>
+ </console>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/s390-async-teardown.s390x-6.0.0.err b/tests/qemuxml2argvdata/s390-async-teardown.s390x-6.0.0.err
new file mode 100644
index 0000000000..aa9a4739cb
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-async-teardown.s390x-6.0.0.err
@@ -0,0 +1 @@
+unsupported configuration: asynchronous teardown is not available with this QEMU binary
diff --git a/tests/qemuxml2argvdata/s390-async-teardown.s390x-latest.args b/tests/qemuxml2argvdata/s390-async-teardown.s390x-latest.args
new file mode 100644
index 0000000000..cc7866499f
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-async-teardown.s390x-latest.args
@@ -0,0 +1,36 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-s390x \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine s390-ccw-virtio,usb=off,dump-guest-core=off,memory-backend=s390.ram \
+-accel tcg \
+-cpu qemu \
+-m size=262144k \
+-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":268435456}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"virtio-serial-ccw","id":"virtio-serial0","devno":"fe.0.0000"}' \
+-chardev pty,id=charconsole0 \
+-device '{"driver":"virtconsole","chardev":"charconsole0","id":"console0"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-balloon-ccw","id":"balloon0","devno":"fe.0.0001"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-run-with async-teardown=on \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/s390-async-teardown.xml b/tests/qemuxml2argvdata/s390-async-teardown.xml
new file mode 100644
index 0000000000..3291b1ada3
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-async-teardown.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory>262144</memory>
+ <currentMemory>262144</currentMemory>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <features>
+ <async-teardown enabled='yes'/>
+ </features>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <controller type='virtio-serial' index='0'>
+ </controller>
+ <console type='pty'>
+ <target type='virtio'/>
+ </console>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c1bba779b3..9abaa72674 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2701,6 +2701,13 @@ mymain(void)
DO_TEST_CAPS_LATEST("crypto-builtin");
+ DO_TEST_CAPS_LATEST("async-teardown");
+ DO_TEST_CAPS_ARCH_LATEST("s390-async-teardown", "s390x");
+ DO_TEST_CAPS_ARCH_LATEST("s390-async-teardown-no-attrib", "s390x");
+ DO_TEST_CAPS_ARCH_VER_PARSE_ERROR("s390-async-teardown", "s390x", "6.0.0");
+ DO_TEST_CAPS_ARCH_LATEST("s390-async-teardown-disabled", "s390x");
+ DO_TEST_CAPS_ARCH_VER("s390-async-teardown-disabled", "s390x", "6.0.0");
+
qemuTestDriverFree(&driver);
virFileWrapperClearPrefixes();
diff --git a/tests/qemuxml2xmloutdata/async-teardown.x86_64-latest.xml b/tests/qemuxml2xmloutdata/async-teardown.x86_64-latest.xml
new file mode 100644
index 0000000000..e98308a9b1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/async-teardown.x86_64-latest.xml
@@ -0,0 +1,44 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <async-teardown enabled='yes'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='fdc' index='0'/>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/s390-async-teardown-disabled.s390x-6.0.0.xml b/tests/qemuxml2xmloutdata/s390-async-teardown-disabled.s390x-6.0.0.xml
new file mode 100644
index 0000000000..a53d4995f0
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/s390-async-teardown-disabled.s390x-6.0.0.xml
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory unit='KiB'>262144</memory>
+ <currentMemory unit='KiB'>262144</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio-6.0'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <async-teardown enabled='no'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <controller type='virtio-serial' index='0'>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <console type='pty'>
+ <target type='virtio' port='0'/>
+ </console>
+ <audio id='1' type='none'/>
+ <memballoon model='virtio'>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </memballoon>
+ <panic model='s390'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/s390-async-teardown-disabled.s390x-latest.xml b/tests/qemuxml2xmloutdata/s390-async-teardown-disabled.s390x-latest.xml
new file mode 100644
index 0000000000..06c890cbff
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/s390-async-teardown-disabled.s390x-latest.xml
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory unit='KiB'>262144</memory>
+ <currentMemory unit='KiB'>262144</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <async-teardown enabled='no'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <controller type='virtio-serial' index='0'>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <console type='pty'>
+ <target type='virtio' port='0'/>
+ </console>
+ <audio id='1' type='none'/>
+ <memballoon model='virtio'>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </memballoon>
+ <panic model='s390'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/s390-async-teardown-no-attrib.s390x-latest.xml b/tests/qemuxml2xmloutdata/s390-async-teardown-no-attrib.s390x-latest.xml
new file mode 100644
index 0000000000..510396a9a8
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/s390-async-teardown-no-attrib.s390x-latest.xml
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory unit='KiB'>262144</memory>
+ <currentMemory unit='KiB'>262144</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <async-teardown enabled='yes'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <controller type='virtio-serial' index='0'>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <console type='pty'>
+ <target type='virtio' port='0'/>
+ </console>
+ <audio id='1' type='none'/>
+ <memballoon model='virtio'>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </memballoon>
+ <panic model='s390'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/s390-async-teardown.s390x-latest.xml b/tests/qemuxml2xmloutdata/s390-async-teardown.s390x-latest.xml
new file mode 100644
index 0000000000..510396a9a8
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/s390-async-teardown.s390x-latest.xml
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory unit='KiB'>262144</memory>
+ <currentMemory unit='KiB'>262144</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <async-teardown enabled='yes'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <controller type='virtio-serial' index='0'>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <console type='pty'>
+ <target type='virtio' port='0'/>
+ </console>
+ <audio id='1' type='none'/>
+ <memballoon model='virtio'>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </memballoon>
+ <panic model='s390'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 565cb3e1e1..b66274beb8 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1241,6 +1241,12 @@ mymain(void)
DO_TEST_CAPS_LATEST("cpu-phys-bits-limit");
DO_TEST_CAPS_LATEST("cpu-phys-bits-emulate-bare");
+ DO_TEST_CAPS_LATEST("async-teardown");
+ DO_TEST_CAPS_ARCH_LATEST("s390-async-teardown", "s390x");
+ DO_TEST_CAPS_ARCH_LATEST("s390-async-teardown-no-attrib", "s390x");
+ DO_TEST_CAPS_ARCH_LATEST("s390-async-teardown-disabled", "s390x");
+ DO_TEST_CAPS_ARCH_VER("s390-async-teardown-disabled", "s390x", "6.0.0");
+
cleanup:
qemuTestDriverFree(&driver);
virFileWrapperClearPrefixes();
--
2.41.0

View File

@ -0,0 +1,100 @@
From 52036c598d2670b4d103c923be1fdd95c096be4e Mon Sep 17 00:00:00 2001
Message-ID: <52036c598d2670b4d103c923be1fdd95c096be4e.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 16 Jan 2024 15:52:25 +0100
Subject: [PATCH] qemu: migration: Properly handle reservation of manually
specified NBD port
Originally the migration code didn't register the NBD disk port with the
port allocator when it was manually specified. Later when commit
e74d627bb3bc2684cbe3 refactored the code and started registering it, the
old logic which was clearing 'priv->nbdPort' in case when it was manually
specified was not removed.
This caused following problems:
- the port was not released after successful migration
- the port was released even when it was not allocated on failures
regarding the NBD server start
- the port was not released on other failures of the migration after
NBD server startup
To address this we remove the assumption that 'priv->nbdPort' is used
only for auto-allocated port and fill it only once the port is
allocated and make the caller of qemuMigrationDstStartNBDServer
responsible for releasing it.
Fixes: e74d627bb3bc2684cbe3edc1e2f7cc745b4e1ff3
Resolves: https://issues.redhat.com/browse/RHEL-21543
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 43f027b57c4d885fc076ffb8829d525a3c343c6f)
---
src/qemu/qemu_migration.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 25dc16a9e9..6f8b830969 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -527,6 +527,8 @@ qemuMigrationDstPrepareStorage(virDomainObj *vm,
* arguments in 'migrate' monitor command.
* Error is reported here.
*
+ * Caller is responsible for releasing 'priv->nbdPort' from the port allocator.
+ *
* Returns 0 on success, -1 otherwise.
*/
static int
@@ -627,6 +629,9 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
server.port = port;
}
+
+ /* caller will release the port */
+ priv->nbdPort = server.port;
}
if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_IN) < 0)
@@ -643,14 +648,9 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
qemuDomainObjExitMonitor(vm);
}
- if (server.transport == VIR_STORAGE_NET_HOST_TRANS_TCP)
- priv->nbdPort = server.port;
-
ret = 0;
cleanup:
- if (ret < 0)
- virPortAllocatorRelease(server.port);
return ret;
exit_monitor:
@@ -3261,11 +3261,7 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver,
virDomainAuditStart(vm, "migrated", false);
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
VIR_ASYNC_JOB_MIGRATION_IN, stopFlags);
- /* release if port is auto selected which is not the case if
- * it is given in parameters
- */
- if (nbdPort == 0)
- virPortAllocatorRelease(priv->nbdPort);
+ virPortAllocatorRelease(priv->nbdPort);
priv->nbdPort = 0;
}
goto cleanup;
@@ -3425,11 +3421,7 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver,
if (autoPort)
priv->migrationPort = port;
- /* in this case port is not auto selected and we don't need to manage it
- * anymore after cookie is baked
- */
- if (nbdPort != 0)
- priv->nbdPort = 0;
+
ret = 0;
cleanup:
--
2.43.0

View File

@ -0,0 +1,40 @@
From 2087ac009a019ceb206475363113bbe6c2821e2f Mon Sep 17 00:00:00 2001
Message-ID: <2087ac009a019ceb206475363113bbe6c2821e2f.1708614745.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 16 Feb 2024 16:40:20 +0100
Subject: [PATCH] qemuMigrationDstPrepareStorage: Properly consider path for
'vdpa' devices
Allow storage migration of VDPA devices by properly checking that they
exist on the destionation. Pre-creation is not supported but if the
device exists the migration should be able to succeed.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 00c0a94ab5f135ea7d9f0a905ff53d13c82761db)
https://issues.redhat.com/browse/RHEL-24825
---
src/qemu/qemu_migration.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3e0aae4e7c..5e27cd5dbe 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -479,10 +479,13 @@ qemuMigrationDstPrepareStorage(virDomainObj *vm,
diskSrcPath = nvmePath;
break;
+ case VIR_STORAGE_TYPE_VHOST_VDPA:
+ diskSrcPath = disk->src->vdpadev;
+ break;
+
case VIR_STORAGE_TYPE_NETWORK:
case VIR_STORAGE_TYPE_VOLUME:
case VIR_STORAGE_TYPE_VHOST_USER:
- case VIR_STORAGE_TYPE_VHOST_VDPA:
case VIR_STORAGE_TYPE_LAST:
case VIR_STORAGE_TYPE_NONE:
break;
--
2.43.2

View File

@ -0,0 +1,60 @@
From b73313c9679766c493afb91f0c691e437632e4fa Mon Sep 17 00:00:00 2001
Message-ID: <b73313c9679766c493afb91f0c691e437632e4fa.1708614745.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 8 Feb 2024 16:48:25 +0100
Subject: [PATCH] qemuMigrationDstPrepareStorage: Use 'switch' statement to
include all storage types
Decrease the likelyhood that addition of a new storage type will be
forgotten.
This patch also unifies the type check to consult the 'actual' type of
the storage in both cases as the NVMe check looked for the XML declared
type while virStorageSourceIsLocalStorage() looks for the
actual/translated type.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit e158b523b8522931200c415ef86562641a2a7c8c)
https://issues.redhat.com/browse/RHEL-24825
---
src/qemu/qemu_migration.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 01ab803842..3e0aae4e7c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -465,11 +465,27 @@ qemuMigrationDstPrepareStorage(virDomainObj *vm,
if (!qemuMigrationAnyCopyDisk(disk, nmigrate_disks, migrate_disks))
continue;
- if (disk->src->type == VIR_STORAGE_TYPE_NVME) {
+ switch (virStorageSourceGetActualType(disk->src)) {
+ case VIR_STORAGE_TYPE_FILE:
+ case VIR_STORAGE_TYPE_BLOCK:
+ case VIR_STORAGE_TYPE_DIR:
+ diskSrcPath = virDomainDiskGetSource(disk);
+ break;
+
+ case VIR_STORAGE_TYPE_NVME:
+ /* While NVMe disks are local, they are not accessible via src->path.
+ * Therefore, we have to return false here. */
virPCIDeviceAddressGetSysfsFile(&disk->src->nvme->pciAddr, &nvmePath);
diskSrcPath = nvmePath;
- } else if (virStorageSourceIsLocalStorage(disk->src)) {
- diskSrcPath = virDomainDiskGetSource(disk);
+ break;
+
+ case VIR_STORAGE_TYPE_NETWORK:
+ case VIR_STORAGE_TYPE_VOLUME:
+ case VIR_STORAGE_TYPE_VHOST_USER:
+ case VIR_STORAGE_TYPE_VHOST_VDPA:
+ case VIR_STORAGE_TYPE_LAST:
+ case VIR_STORAGE_TYPE_NONE:
+ break;
}
if (diskSrcPath) {
--
2.43.2

View File

@ -0,0 +1,84 @@
From d968a490b2fb8b4c7af2c835288e6f693ea1cc67 Mon Sep 17 00:00:00 2001
Message-ID: <d968a490b2fb8b4c7af2c835288e6f693ea1cc67.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 16 Jan 2024 16:22:03 +0100
Subject: [PATCH] qemuMigrationDstStartNBDServer: Refactor cleanup
There's nothing under the 'cleanup:' label thus the whole code can be
simplified.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 36e11cca83c6617a81528969c27579a1ab891443)
https://issues.redhat.com/browse/RHEL-21543
---
src/qemu/qemu_migration.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 6f8b830969..01ab803842 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -541,7 +541,6 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
const char *nbdURI,
const char *tls_alias)
{
- int ret = -1;
qemuDomainObjPrivate *priv = vm->privateData;
size_t i;
virStorageNetHostDef server = {
@@ -610,22 +609,22 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("Cannot migrate empty or read-only disk %1$s"),
disk->dst);
- goto cleanup;
+ return -1;
}
if (!(diskAlias = qemuAliasDiskDriveFromDisk(disk)))
- goto cleanup;
+ return -1;
if (!server_started &&
server.transport == VIR_STORAGE_NET_HOST_TRANS_TCP) {
if (server.port) {
if (virPortAllocatorSetUsed(server.port) < 0)
- goto cleanup;
+ return -1;
} else {
unsigned short port = 0;
if (virPortAllocatorAcquire(driver->migrationPorts, &port) < 0)
- goto cleanup;
+ return -1;
server.port = port;
}
@@ -635,7 +634,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
}
if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_IN) < 0)
- goto cleanup;
+ return -1;
if (!server_started) {
if (qemuMonitorNBDServerStart(priv->mon, &server, tls_alias) < 0)
@@ -648,14 +647,11 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
qemuDomainObjExitMonitor(vm);
}
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
exit_monitor:
qemuDomainObjExitMonitor(vm);
- goto cleanup;
+ return -1;
}
--
2.43.0

View File

@ -0,0 +1,94 @@
From 7dd85500450b1889a81d574337331e080b218c9f Mon Sep 17 00:00:00 2001
Message-ID: <7dd85500450b1889a81d574337331e080b218c9f.1707394626.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 4 Jan 2024 10:57:12 +0100
Subject: [PATCH] qemu_capabilities: Add
QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS capability
Starting from v8.2.0-rc0~74^2~2 QEMU has .dynamic-memslots
attribute for virtio-mem-pci device. Introduce a capability which
reflects that.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 497cab753b801c7a66e2a480482e5144665ecbf4)
Resolves: https://issues.redhat.com/browse/RHEL-15316
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml | 1 +
5 files changed, 6 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a4d42b40ed..e13df2b27d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -700,6 +700,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
"virtio-blk-vhost-vdpa", /* QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA */
"virtio-blk.iothread-mapping", /* QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING */
"smp-clusters", /* QEMU_CAPS_SMP_CLUSTERS */
+ "virtio-mem-pci.dynamic-memslots", /* QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS */
);
@@ -1519,6 +1520,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVhostUserFS[] =
static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioMemPCI[] = {
{ "prealloc", QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC, NULL },
+ { "dynamic-memslots", QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS, NULL },
};
static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioIOMMU[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a353750670..82ae4b738b 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -679,6 +679,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA, /* virtio-blk-vhost-vdpa block driver */
QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING, /* virtio-blk supports per-virtqueue iothread mapping */
QEMU_CAPS_SMP_CLUSTERS, /* -smp clusters= */
+ QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS, /* -device virtio-mem-pci.dynamic-memslots= */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml b/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml
index 54fd349365..03c9343da5 100644
--- a/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml
@@ -163,6 +163,7 @@
<flag name='qcow2-discard-no-unref'/>
<flag name='run-with.async-teardown'/>
<flag name='smp-clusters'/>
+ <flag name='virtio-mem-pci.dynamic-memslots'/>
<version>8002000</version>
<microcodeVersion>61700246</microcodeVersion>
<package>v8.2.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml
index 8a6527810a..d16cd88720 100644
--- a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml
@@ -200,6 +200,7 @@
<flag name='run-with.async-teardown'/>
<flag name='virtio-blk-vhost-vdpa'/>
<flag name='smp-clusters'/>
+ <flag name='virtio-mem-pci.dynamic-memslots'/>
<version>8002000</version>
<microcodeVersion>43100246</microcodeVersion>
<package>v8.2.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml
index b4c3b1bae3..65eaa08cd4 100644
--- a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml
@@ -201,6 +201,7 @@
<flag name='virtio-blk-vhost-vdpa'/>
<flag name='virtio-blk.iothread-mapping'/>
<flag name='smp-clusters'/>
+ <flag name='virtio-mem-pci.dynamic-memslots'/>
<version>8002050</version>
<microcodeVersion>43100245</microcodeVersion>
<package>v8.2.0-196-g7425b6277f</package>
--
2.43.0

View File

@ -0,0 +1,62 @@
From 866ec16d8264b3ef2533b276d161e6dc1db470a0 Mon Sep 17 00:00:00 2001
Message-ID: <866ec16d8264b3ef2533b276d161e6dc1db470a0.1707394627.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 4 Jan 2024 10:49:06 +0100
Subject: [PATCH] qemu_command: Generate cmd line for virtio-mem
dynamicMemslots
This is pretty straightforward.
Resolves: https://issues.redhat.com/browse/RHEL-15316
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit dab99eedcd15d135e287185ce03eb05338ce225d)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 3 +++
.../memory-hotplug-virtio-mem.x86_64-latest.args | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 712feb7b81..4d5a202c7d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3653,6 +3653,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
unsigned long long requestedsize = 0;
unsigned long long address = 0;
bool prealloc = false;
+ virTristateBool dynamicMemslots = VIR_TRISTATE_BOOL_ABSENT;
if (!mem->info.alias) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -3694,6 +3695,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
blocksize = mem->target.virtio_mem.blocksize;
requestedsize = mem->target.virtio_mem.requestedsize;
address = mem->target.virtio_mem.address;
+ dynamicMemslots = mem->target.virtio_mem.dynamicMemslots;
break;
case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
@@ -3716,6 +3718,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
"s:memdev", memdev,
"B:prealloc", prealloc,
"P:memaddr", address,
+ "T:dynamic-memslots", dynamicMemslots,
"s:id", mem->info.alias,
NULL) < 0)
return NULL;
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
index dbe96ae21d..36cff6ec13 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
@@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-object '{"qom-type":"memory-backend-ram","id":"memvirtiomem0","reserve":false,"size":1073741824}' \
-device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"requested-size":536870912,"memdev":"memvirtiomem0","id":"virtiomem0","bus":"pci.0","addr":"0x2"}' \
-object '{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":2147483648,"host-nodes":[1,2,3],"policy":"bind"}' \
--device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"requested-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"memaddr":5637144576,"id":"virtiomem1","bus":"pci.1","addr":"0x1"}' \
+-device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"requested-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"memaddr":5637144576,"dynamic-memslots":true,"id":"virtiomem1","bus":"pci.1","addr":"0x1"}' \
-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
--
2.43.0

View File

@ -0,0 +1,67 @@
From 7a7c3f71744b2211bdf50332918495d3042e3236 Mon Sep 17 00:00:00 2001
Message-ID: <7a7c3f71744b2211bdf50332918495d3042e3236.1706524416.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 24 Jan 2024 18:43:21 +0100
Subject: [PATCH] qemu_hotplug: Don't lose 'created' flag in
qemuDomainChangeNet()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
After v9.1.0-rc1~116 we track whether it's us who created a
macvtap or not. But when updating a vNIC its definition might be
replaced with a new one (though, ifname is not allowed to
change), e.g. to reflect new QoS, link state, etc.
Now, the fact whether we created macvtap for given vNIC is stored
in net->privateData->created. And replacing definition is done by
simply freeing the old definition and making the pointer point to
the new one. But this does not preserve the 'created' flag, which
in turn means when a domain is shutting off, the macvtap is not
removed (see loop inside of qemuProcessStop()).
Copy this flag into new definition and leave a note in
_qemuDomainNetworkPrivate struct.
Fixes: 61d1b9e6592660121aeda66bf7adbcd39de06aa8
Resolves: https://issues.redhat.com/browse/RHEL-22714
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit ccfc5c1e1637d20e479fafde7aa3ea4c6fb29e21)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_domain.h | 2 ++
src/qemu/qemu_hotplug.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index fa566dded6..0b5af5d014 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -420,6 +420,8 @@ typedef struct _qemuDomainNetworkPrivate qemuDomainNetworkPrivate;
struct _qemuDomainNetworkPrivate {
virObject parent;
+ /* Don't forget to possibly copy these members in qemuDomainChangeNet(). */
+
/* True if the device was created by us. Otherwise we should
* avoid removing it. Currently only used for
* VIR_DOMAIN_NET_TYPE_DIRECT. */
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0e45bd53e1..31b00e05ca 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4166,6 +4166,11 @@ qemuDomainChangeNet(virQEMUDriver *driver,
else
VIR_WARN("Unable to release network device '%s'", NULLSTR(olddev->ifname));
}
+
+ /* Carry over fact whether we created the device or not. */
+ QEMU_DOMAIN_NETWORK_PRIVATE(newdev)->created =
+ QEMU_DOMAIN_NETWORK_PRIVATE(olddev)->created;
+
virDomainNetDefFree(olddev);
/* move newdev into the nets list, and NULL it out from the
* virDomainDeviceDef that we were given so that the caller
--
2.43.0

View File

@ -0,0 +1,67 @@
From 743afd9422e59bc6cbda6b4a904394a045eb9aec Mon Sep 17 00:00:00 2001
Message-ID: <743afd9422e59bc6cbda6b4a904394a045eb9aec.1707394627.git.jdenemar@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 30 Jan 2024 12:13:32 +0100
Subject: [PATCH] qemu_snapshot: create: don't require disk-only flag for
offline external snapshot
Historically creating offline external snapshot required disk-only flag
as well. Now when user requests new snapshot for offline VM and at least
one disk is specified to use external snapshot we will no longer require
disk-only flag as all other not specified disk will use external
snapshots as well.
Resolves: https://issues.redhat.com/browse/RHEL-22797
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 189fdeff10b85786a495a8fcf67ba1428d9fc482)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/qemu/qemu_snapshot.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 871e63c9cd..0cac0c4146 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1582,15 +1582,27 @@ qemuSnapshotCreateXMLValidateDef(virDomainObj *vm,
* to internal snapshots.
*/
static bool
-qemuSnapshotCreateUseExternal(virDomainSnapshotDef *def,
+qemuSnapshotCreateUseExternal(virDomainObj *vm,
+ virDomainSnapshotDef *def,
unsigned int flags)
{
+ size_t i;
+
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
return true;
if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
return true;
+ if (!virDomainObjIsActive(vm)) {
+ /* No need to check all disks as function qemuSnapshotPrepare() guarantees
+ * that we don't have a combination of internal and external location. */
+ for (i = 0; i < def->ndisks; i++) {
+ if (def->disks[i].snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+ return true;
+ }
+ }
+
return false;
}
@@ -1623,7 +1635,7 @@ qemuSnapshotCreateAlignDisks(virDomainObj *vm,
return -1;
}
- if (qemuSnapshotCreateUseExternal(def, flags)) {
+ if (qemuSnapshotCreateUseExternal(vm, def, flags)) {
align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
def->state = virDomainObjGetState(vm, NULL);
--
2.43.0

View File

@ -0,0 +1,88 @@
From b12f3837ddde95373b39843b8526b55e40d96500 Mon Sep 17 00:00:00 2001
Message-ID: <b12f3837ddde95373b39843b8526b55e40d96500.1707394627.git.jdenemar@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 30 Jan 2024 11:33:23 +0100
Subject: [PATCH] qemu_snapshot: create: refactor external snapshot detection
Introduce new function qemuSnapshotCreateUseExternal() that will return
true if we will use external snapshots as default location.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit faa2e3bb541e50d719d05e58a129b4443c0c737c)
Resolves: https://issues.redhat.com/browse/RHEL-22797
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/qemu/qemu_snapshot.c | 39 ++++++++++++++++++++++++++++++---------
1 file changed, 30 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index af5f995b0d..871e63c9cd 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1576,6 +1576,25 @@ qemuSnapshotCreateXMLValidateDef(virDomainObj *vm,
}
+/**
+ * Check if libvirt should use external snapshots as default align_location
+ * that will be used by virDomainSnapshotAlignDisks(). Otherwise we default
+ * to internal snapshots.
+ */
+static bool
+qemuSnapshotCreateUseExternal(virDomainSnapshotDef *def,
+ unsigned int flags)
+{
+ if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
+ return true;
+
+ if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+ return true;
+
+ return false;
+}
+
+
static int
qemuSnapshotCreateAlignDisks(virDomainObj *vm,
virDomainSnapshotDef *def,
@@ -1584,7 +1603,7 @@ qemuSnapshotCreateAlignDisks(virDomainObj *vm,
{
g_autofree char *xml = NULL;
qemuDomainObjPrivate *priv = vm->privateData;
- virDomainSnapshotLocation align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL;
+ virDomainSnapshotLocation align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT;
/* Easiest way to clone inactive portion of vm->def is via
* conversion in and back out of xml. */
@@ -1604,17 +1623,19 @@ qemuSnapshotCreateAlignDisks(virDomainObj *vm,
return -1;
}
- if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) {
+ if (qemuSnapshotCreateUseExternal(def, flags)) {
align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
- if (virDomainObjIsActive(vm))
- def->state = VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT;
- else
- def->state = VIR_DOMAIN_SNAPSHOT_SHUTOFF;
- def->memory = VIR_DOMAIN_SNAPSHOT_LOCATION_NO;
- } else if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) {
def->state = virDomainObjGetState(vm, NULL);
- align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
+
+ if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) {
+ if (virDomainObjIsActive(vm))
+ def->state = VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT;
+ else
+ def->state = VIR_DOMAIN_SNAPSHOT_SHUTOFF;
+ def->memory = VIR_DOMAIN_SNAPSHOT_LOCATION_NO;
+ }
} else {
+ align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL;
def->state = virDomainObjGetState(vm, NULL);
if (virDomainObjIsActive(vm) &&
--
2.43.0

View File

@ -0,0 +1,66 @@
From aa70508df0626a00e4ed7c0ecb11b985beeb92cd Mon Sep 17 00:00:00 2001
Message-ID: <aa70508df0626a00e4ed7c0ecb11b985beeb92cd.1707394627.git.jdenemar@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 30 Jan 2024 13:05:22 +0100
Subject: [PATCH] qemu_snapshot: fix detection if non-leaf snapshot isn't in
active chain
The condition was completely wrong. As per the comment for function
virDomainMomentIsAncestor() it checks that the first argument is
descendant of the second argument.
Consider the following snapshot tree for VM:
s1
|
+- s2
| |
| +- s3
|
+- s4
|
+- s5 (current)
When deleting s2 with the original code we checked if
virDomainMomentIsAncestor(s2, s5) which would return false basically for
any snapshot as s5 is leaf snapshot so no children.
When deleting s2 with fixed code we check if
virDomainMomentIsAncestor(s5, s2) which still returns false but when
deleting s4 it will correctly return true.
Before this fix it fails with the following error:
error: Failed to delete snapshot s2
error: invalid argument: could not find base disk source in disk source chain
After the fix it fails with correct error:
error: Failed to delete snapshot s2
error: unsupported configuration: deletion of non-leaf external snapshot that is not in active chain is not supported
Resolves: https://issues.redhat.com/browse/RHEL-23212
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 7143c4e1f95b4dc804f67cc5de98fba746193892)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/qemu/qemu_snapshot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 73ff533827..af5f995b0d 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -3815,7 +3815,7 @@ qemuSnapshotDeleteValidate(virDomainObj *vm,
}
if (snap != current && snap->nchildren != 0 &&
- virDomainMomentIsAncestor(snap, current)) {
+ !virDomainMomentIsAncestor(current, snap)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("deletion of non-leaf external snapshot that is not in active chain is not supported"));
return -1;
--
2.43.0

View File

@ -0,0 +1,40 @@
From 9f35c04add8d64748671e76171683332bd454317 Mon Sep 17 00:00:00 2001
Message-ID: <9f35c04add8d64748671e76171683332bd454317.1707394627.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 4 Jan 2024 11:04:51 +0100
Subject: [PATCH] qemu_validate: Check capability for virtio-mem
dynamicMemslots
The QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS reflects
whether QEMU is capable of .dynamic-memslots for virtio-mem.
Use it when validating domain configuration.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 6be07af817e0a8d48613296af66873e62a73339a)
Resolves: https://issues.redhat.com/browse/RHEL-15316
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_validate.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index b22d3618fe..fe8f7ae8cc 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -5066,6 +5066,13 @@ qemuValidateDomainDeviceDefMemory(virDomainMemoryDef *mem,
_("virtio-mem isn't supported by this QEMU binary"));
return -1;
}
+
+ if (mem->target.virtio_mem.dynamicMemslots == VIR_TRISTATE_BOOL_YES &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtio-mem does not support dynamicMemslots"));
+ return -1;
+ }
break;
case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
--
2.43.0

View File

@ -0,0 +1,142 @@
From 1b87b9821afe39c2af5c1893b11cb7f452c61014 Mon Sep 17 00:00:00 2001
Message-ID: <1b87b9821afe39c2af5c1893b11cb7f452c61014.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 17 Jan 2024 15:55:35 +0100
Subject: [PATCH] remoteDispatchAuthPolkit: Fix lock ordering deadlock if
client closes connection during auth
Locks in following text:
A: virNetServer
B: virNetServerClient
C: daemonClientPrivate
'virNetServerSetClientAuthenticated' locks A then B
'remoteDispatchAuthPolkit' calls 'virNetServerSetClientAuthenticated'
while holding C.
If a client closes its connection 'virNetServerProcessClients' with the
lock A and B locked will call 'virNetServerClientCloseLocked' which will
try to dispose of the 'client' private data by:
ref(b);
unlock(b);
remoteClientFreePrivateCallbacks();
lock(b);
unref(b);
Unfortunately remoteClientFreePrivateCallbacks() tries lock C.
Thus the locks are held in the following order:
polkit auth: C -> A
connection close: A -> C
causing a textbook-example deadlock. To resolve it we can simply drop
lock 'C' before calling 'virNetServerSetClientAuthenticated' as the lock
is not needed any more.
Resolves: https://issues.redhat.com/browse/RHEL-20337
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit c697aff8a1b5542d51c0b4a10046ad37089d12d5)
---
src/remote/remote_daemon_dispatch.c | 76 +++++++++++++++--------------
1 file changed, 39 insertions(+), 37 deletions(-)
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 7daf503b51..aaabd1e56c 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -3979,50 +3979,52 @@ remoteDispatchAuthPolkit(virNetServer *server,
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
int rv;
- VIR_LOCK_GUARD lock = virLockGuardLock(&priv->lock);
-
- action = virNetServerClientGetReadonly(client) ?
- "org.libvirt.unix.monitor" :
- "org.libvirt.unix.manage";
- VIR_DEBUG("Start PolicyKit auth %d", virNetServerClientGetFD(client));
- if (virNetServerClientGetAuth(client) != VIR_NET_SERVER_SERVICE_AUTH_POLKIT) {
- VIR_ERROR(_("client tried invalid PolicyKit init request"));
- goto authfail;
- }
+ VIR_WITH_MUTEX_LOCK_GUARD(&priv->lock) {
+ action = virNetServerClientGetReadonly(client) ?
+ "org.libvirt.unix.monitor" :
+ "org.libvirt.unix.manage";
- if (virNetServerClientGetUNIXIdentity(client, &callerUid, &callerGid,
- &callerPid, &timestamp) < 0) {
- goto authfail;
- }
+ VIR_DEBUG("Start PolicyKit auth %d", virNetServerClientGetFD(client));
+ if (virNetServerClientGetAuth(client) != VIR_NET_SERVER_SERVICE_AUTH_POLKIT) {
+ VIR_ERROR(_("client tried invalid PolicyKit init request"));
+ goto authfail;
+ }
- if (timestamp == 0) {
- VIR_WARN("Failing polkit auth due to missing client (pid=%lld) start time",
- (long long)callerPid);
- goto authfail;
- }
+ if (virNetServerClientGetUNIXIdentity(client, &callerUid, &callerGid,
+ &callerPid, &timestamp) < 0) {
+ goto authfail;
+ }
- VIR_INFO("Checking PID %lld running as %d",
- (long long) callerPid, callerUid);
+ if (timestamp == 0) {
+ VIR_WARN("Failing polkit auth due to missing client (pid=%lld) start time",
+ (long long)callerPid);
+ goto authfail;
+ }
- rv = virPolkitCheckAuth(action,
- callerPid,
- timestamp,
- callerUid,
- NULL,
- true);
- if (rv == -1)
- goto authfail;
- else if (rv == -2)
- goto authdeny;
+ VIR_INFO("Checking PID %lld running as %d",
+ (long long) callerPid, callerUid);
- PROBE(RPC_SERVER_CLIENT_AUTH_ALLOW,
- "client=%p auth=%d identity=%s",
- client, REMOTE_AUTH_POLKIT, ident);
- VIR_INFO("Policy allowed action %s from pid %lld, uid %d",
- action, (long long) callerPid, callerUid);
- ret->complete = 1;
+ rv = virPolkitCheckAuth(action,
+ callerPid,
+ timestamp,
+ callerUid,
+ NULL,
+ true);
+ if (rv == -1)
+ goto authfail;
+ else if (rv == -2)
+ goto authdeny;
+
+ PROBE(RPC_SERVER_CLIENT_AUTH_ALLOW,
+ "client=%p auth=%d identity=%s",
+ client, REMOTE_AUTH_POLKIT, ident);
+ VIR_INFO("Policy allowed action %s from pid %lld, uid %d",
+ action, (long long) callerPid, callerUid);
+ ret->complete = 1;
+ }
+ /* this must be called with the private data mutex unlocked */
virNetServerSetClientAuthenticated(server, client);
return 0;
--
2.43.0

View File

@ -0,0 +1,45 @@
From 5821f93bf9b42e3732fe168cdae85054e9a3ac61 Mon Sep 17 00:00:00 2001
Message-ID: <5821f93bf9b42e3732fe168cdae85054e9a3ac61.1707394626.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 29 Jan 2024 10:07:05 +0100
Subject: [PATCH] remote_driver: Restore special behavior of
remoteDomainGetBlockIoTune()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In v9.10.0-rc1~103 the remote driver was switched to g_auto() for
client RPC return parameters. But whilst doing so a small bug
slipped in: previously, when virDomainGetBlockIoTune() was called
with *nparams == 0, the function set *nparams to the number of
supported params and zero was returned (so that client can
allocate memory and call the API second time). IOW - the usual,
old style of APIs where we didn't want to allocate memory on
caller's behalf. But because of this bug, a negative one is
returned instead.
Fixes: 501825011c1fe80f458820c7efe5a198e0af9be5
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3a3f73ea9f1925ca5e256fa54c5aa451ddeaa19e)
Resolves: https://issues.redhat.com/browse/RHEL-22800
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/remote/remote_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 392377deae..bedf2cb833 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2570,7 +2570,7 @@ static int remoteDomainGetBlockIoTune(virDomainPtr domain,
*/
if (*nparams == 0) {
*nparams = ret.nparams;
- return -1;
+ return 0;
}
if (virTypedParamsDeserialize((struct _virTypedParameterRemote *) ret.params.params_val,
--
2.43.0

View File

@ -0,0 +1,39 @@
From 4c070fe8db9456a0cd33910d37e613a045a1ec77 Mon Sep 17 00:00:00 2001
Message-ID: <4c070fe8db9456a0cd33910d37e613a045a1ec77.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 16:12:09 +0100
Subject: [PATCH] schema: nodedev: Adjust allowed characters in
'vpdFieldValueFormat'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The check in 'virPCIVPDResourceIsValidTextValue' allows any printable
characters, thus the XML schema should do the same.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit edaa1112ffef253013dcc3318794cebfaa2a6cb7)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
https://issues.redhat.com/browse/RHEL-22400 [9.3.z]
https://issues.redhat.com/browse/RHEL-22399 [9.2.z]
---
src/conf/schemas/nodedev.rng | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/schemas/nodedev.rng b/src/conf/schemas/nodedev.rng
index fba4021754..ff07313968 100644
--- a/src/conf/schemas/nodedev.rng
+++ b/src/conf/schemas/nodedev.rng
@@ -869,7 +869,7 @@
<define name="vpdFieldValueFormat">
<data type="string">
- <param name="pattern">[0-9a-zA-F -_,.:;=]{0,255}</param>
+ <param name="pattern">.{0,255}</param>
</data>
</define>
--
2.43.0

View File

@ -1,56 +0,0 @@
From 0a213a6808d5d076e7c9658960a13c27642a68a8 Mon Sep 17 00:00:00 2001
Message-ID: <0a213a6808d5d076e7c9658960a13c27642a68a8.1690808082.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 13 Jul 2023 16:16:37 +0200
Subject: [PATCH] storage: Fix returning of locked objects from
'virStoragePoolObjListSearch'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
CVE-2023-3750
'virStoragePoolObjListSearch' explicitly documents that it's returning
a pointer to a locked and ref'd pool that maches the lookup function.
This was not the case as in commit 0c4b391e2a9 (released in
libvirt-8.3.0) the code was accidentally converted to use 'VIR_LOCK_GUARD'
which auto-unlocked it when leaving the scope, even when the code was
originally "leaking" the lock.
Revert the corresponding conversion and add a comment that this function
is intentionally leaking a locked object.
Fixes: 0c4b391e2a9
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2221851
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 9a47442366fcf8a7b6d7422016d7bbb6764a1098)
---
src/conf/virstorageobj.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 7010e97d61..59fa5da372 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -454,11 +454,16 @@ virStoragePoolObjListSearchCb(const void *payload,
virStoragePoolObj *obj = (virStoragePoolObj *) payload;
struct _virStoragePoolObjListSearchData *data =
(struct _virStoragePoolObjListSearchData *)opaque;
- VIR_LOCK_GUARD lock = virObjectLockGuard(obj);
+ virObjectLock(obj);
+
+ /* If we find the matching pool object we must return while the object is
+ * locked as the caller wants to return a locked object. */
if (data->searcher(obj, data->opaque))
return 1;
+ virObjectUnlock(obj);
+
return 0;
}
--
2.41.0

View File

@ -0,0 +1,919 @@
From 87b424cacef5bbbe7e01c69ade8a8a6707cd779c Mon Sep 17 00:00:00 2001
Message-ID: <87b424cacef5bbbe7e01c69ade8a8a6707cd779c.1706524416.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 5 Jan 2024 15:07:06 +0100
Subject: [PATCH] tests: Add hostcpudata for machine with CPU clusters
The data is taken from an HPE Apollo 70 machine, which uses
aarch64 CPUs. It is interesting for us because non-dummy
information about CPU clusters is exposed through sysfs.
In order to keep things reasonable, the data was manually
modified so that only 8 of the original 224 CPUs are included.
Care has been taken to ensure that the topology is otherwise
unaltered.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit fb81a56f321019685be80b14e3be3046e46412ad)
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
.../linux-basic-clusters/system/cpu | 1 +
.../linux-basic-clusters/system/node | 1 +
.../vircaps-aarch64-basic-clusters.xml | 39 ++++++++++
tests/vircaps2xmltest.c | 1 +
.../linux-aarch64-with-clusters.cpuinfo | 72 +++++++++++++++++++
.../linux-aarch64-with-clusters.expected | 1 +
.../cpu/cpu0/topology/cluster_cpus_list | 1 +
.../cpu/cpu0/topology/cluster_id | 1 +
.../cpu/cpu0/topology/core_cpus_list | 1 +
.../cpu/cpu0/topology/core_id | 1 +
.../cpu/cpu0/topology/core_siblings_list | 1 +
.../cpu/cpu0/topology/package_cpus_list | 1 +
.../cpu/cpu0/topology/physical_package_id | 1 +
.../cpu/cpu0/topology/thread_siblings_list | 1 +
.../cpu/cpu1/topology/cluster_cpus_list | 1 +
.../cpu/cpu1/topology/cluster_id | 1 +
.../cpu/cpu1/topology/core_cpus_list | 1 +
.../cpu/cpu1/topology/core_id | 1 +
.../cpu/cpu1/topology/core_siblings_list | 1 +
.../cpu/cpu1/topology/package_cpus_list | 1 +
.../cpu/cpu1/topology/physical_package_id | 1 +
.../cpu/cpu1/topology/thread_siblings_list | 1 +
.../cpu/cpu2/topology/cluster_cpus_list | 1 +
.../cpu/cpu2/topology/cluster_id | 1 +
.../cpu/cpu2/topology/core_cpus_list | 1 +
.../cpu/cpu2/topology/core_id | 1 +
.../cpu/cpu2/topology/core_siblings_list | 1 +
.../cpu/cpu2/topology/package_cpus_list | 1 +
.../cpu/cpu2/topology/physical_package_id | 1 +
.../cpu/cpu2/topology/thread_siblings_list | 1 +
.../cpu/cpu3/topology/cluster_cpus_list | 1 +
.../cpu/cpu3/topology/cluster_id | 1 +
.../cpu/cpu3/topology/core_cpus_list | 1 +
.../cpu/cpu3/topology/core_id | 1 +
.../cpu/cpu3/topology/core_siblings_list | 1 +
.../cpu/cpu3/topology/package_cpus_list | 1 +
.../cpu/cpu3/topology/physical_package_id | 1 +
.../cpu/cpu3/topology/thread_siblings_list | 1 +
.../cpu/cpu4/topology/cluster_cpus_list | 1 +
.../cpu/cpu4/topology/cluster_id | 1 +
.../cpu/cpu4/topology/core_cpus_list | 1 +
.../cpu/cpu4/topology/core_id | 1 +
.../cpu/cpu4/topology/core_siblings_list | 1 +
.../cpu/cpu4/topology/package_cpus_list | 1 +
.../cpu/cpu4/topology/physical_package_id | 1 +
.../cpu/cpu4/topology/thread_siblings_list | 1 +
.../cpu/cpu5/topology/cluster_cpus_list | 1 +
.../cpu/cpu5/topology/cluster_id | 1 +
.../cpu/cpu5/topology/core_cpus_list | 1 +
.../cpu/cpu5/topology/core_id | 1 +
.../cpu/cpu5/topology/core_siblings_list | 1 +
.../cpu/cpu5/topology/package_cpus_list | 1 +
.../cpu/cpu5/topology/physical_package_id | 1 +
.../cpu/cpu5/topology/thread_siblings_list | 1 +
.../cpu/cpu6/topology/cluster_cpus_list | 1 +
.../cpu/cpu6/topology/cluster_id | 1 +
.../cpu/cpu6/topology/core_cpus_list | 1 +
.../cpu/cpu6/topology/core_id | 1 +
.../cpu/cpu6/topology/core_siblings_list | 1 +
.../cpu/cpu6/topology/package_cpus_list | 1 +
.../cpu/cpu6/topology/physical_package_id | 1 +
.../cpu/cpu6/topology/thread_siblings_list | 1 +
.../cpu/cpu7/topology/cluster_cpus_list | 1 +
.../cpu/cpu7/topology/cluster_id | 1 +
.../cpu/cpu7/topology/core_cpus_list | 1 +
.../cpu/cpu7/topology/core_id | 1 +
.../cpu/cpu7/topology/core_siblings_list | 1 +
.../cpu/cpu7/topology/package_cpus_list | 1 +
.../cpu/cpu7/topology/physical_package_id | 1 +
.../cpu/cpu7/topology/thread_siblings_list | 1 +
.../linux-with-clusters/cpu/online | 1 +
.../linux-with-clusters/cpu/present | 1 +
.../linux-with-clusters/node/node0/cpu0 | 1 +
.../linux-with-clusters/node/node0/cpu1 | 1 +
.../linux-with-clusters/node/node0/cpu2 | 1 +
.../linux-with-clusters/node/node0/cpu3 | 1 +
.../linux-with-clusters/node/node0/cpulist | 1 +
.../linux-with-clusters/node/node1/cpu4 | 1 +
.../linux-with-clusters/node/node1/cpu5 | 1 +
.../linux-with-clusters/node/node1/cpu6 | 1 +
.../linux-with-clusters/node/node1/cpu7 | 1 +
.../linux-with-clusters/node/node1/cpulist | 1 +
.../linux-with-clusters/node/online | 1 +
.../linux-with-clusters/node/possible | 1 +
tests/virhostcputest.c | 1 +
85 files changed, 194 insertions(+)
create mode 120000 tests/vircaps2xmldata/linux-basic-clusters/system/cpu
create mode 120000 tests/vircaps2xmldata/linux-basic-clusters/system/node
create mode 100644 tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml
create mode 100644 tests/virhostcpudata/linux-aarch64-with-clusters.cpuinfo
create mode 100644 tests/virhostcpudata/linux-aarch64-with-clusters.expected
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/cluster_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/cluster_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/package_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/physical_package_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/thread_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/cluster_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/cluster_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/package_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/physical_package_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/thread_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/cluster_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/cluster_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/package_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/physical_package_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/thread_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/cluster_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/cluster_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/package_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/physical_package_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/thread_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/cluster_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/cluster_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/package_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/physical_package_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/thread_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/cluster_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/cluster_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/package_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/physical_package_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/thread_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/cluster_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/cluster_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/package_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/physical_package_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/thread_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/cluster_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/cluster_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/package_cpus_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/physical_package_id
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/thread_siblings_list
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/online
create mode 100644 tests/virhostcpudata/linux-with-clusters/cpu/present
create mode 120000 tests/virhostcpudata/linux-with-clusters/node/node0/cpu0
create mode 120000 tests/virhostcpudata/linux-with-clusters/node/node0/cpu1
create mode 120000 tests/virhostcpudata/linux-with-clusters/node/node0/cpu2
create mode 120000 tests/virhostcpudata/linux-with-clusters/node/node0/cpu3
create mode 100644 tests/virhostcpudata/linux-with-clusters/node/node0/cpulist
create mode 120000 tests/virhostcpudata/linux-with-clusters/node/node1/cpu4
create mode 120000 tests/virhostcpudata/linux-with-clusters/node/node1/cpu5
create mode 120000 tests/virhostcpudata/linux-with-clusters/node/node1/cpu6
create mode 120000 tests/virhostcpudata/linux-with-clusters/node/node1/cpu7
create mode 100644 tests/virhostcpudata/linux-with-clusters/node/node1/cpulist
create mode 100644 tests/virhostcpudata/linux-with-clusters/node/online
create mode 100644 tests/virhostcpudata/linux-with-clusters/node/possible
diff --git a/tests/vircaps2xmldata/linux-basic-clusters/system/cpu b/tests/vircaps2xmldata/linux-basic-clusters/system/cpu
new file mode 120000
index 0000000000..f7354e3525
--- /dev/null
+++ b/tests/vircaps2xmldata/linux-basic-clusters/system/cpu
@@ -0,0 +1 @@
+../../../virhostcpudata/linux-with-clusters/cpu
\ No newline at end of file
diff --git a/tests/vircaps2xmldata/linux-basic-clusters/system/node b/tests/vircaps2xmldata/linux-basic-clusters/system/node
new file mode 120000
index 0000000000..57b972ce90
--- /dev/null
+++ b/tests/vircaps2xmldata/linux-basic-clusters/system/node
@@ -0,0 +1 @@
+../../../virhostcpudata/linux-with-clusters/node
\ No newline at end of file
diff --git a/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml b/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml
new file mode 100644
index 0000000000..fe61fc42cc
--- /dev/null
+++ b/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml
@@ -0,0 +1,39 @@
+<capabilities>
+
+ <host>
+ <cpu>
+ <arch>aarch64</arch>
+ </cpu>
+ <power_management/>
+ <iommu support='no'/>
+ <topology>
+ <cells num='2'>
+ <cell id='0'>
+ <memory unit='KiB'>1048576</memory>
+ <pages unit='KiB' size='4'>2048</pages>
+ <pages unit='KiB' size='2048'>4096</pages>
+ <pages unit='KiB' size='1048576'>6144</pages>
+ <cpus num='4'>
+ <cpu id='0' socket_id='36' die_id='0' core_id='0' siblings='0-1'/>
+ <cpu id='1' socket_id='36' die_id='0' core_id='0' siblings='0-1'/>
+ <cpu id='2' socket_id='36' die_id='0' core_id='1' siblings='2-3'/>
+ <cpu id='3' socket_id='36' die_id='0' core_id='1' siblings='2-3'/>
+ </cpus>
+ </cell>
+ <cell id='1'>
+ <memory unit='KiB'>2097152</memory>
+ <pages unit='KiB' size='4'>4096</pages>
+ <pages unit='KiB' size='2048'>6144</pages>
+ <pages unit='KiB' size='1048576'>8192</pages>
+ <cpus num='4'>
+ <cpu id='4' socket_id='3180' die_id='0' core_id='256' siblings='4-5'/>
+ <cpu id='5' socket_id='3180' die_id='0' core_id='256' siblings='4-5'/>
+ <cpu id='6' socket_id='3180' die_id='0' core_id='257' siblings='6-7'/>
+ <cpu id='7' socket_id='3180' die_id='0' core_id='257' siblings='6-7'/>
+ </cpus>
+ </cell>
+ </cells>
+ </topology>
+ </host>
+
+</capabilities>
diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c
index 26a512e87f..2fdf694640 100644
--- a/tests/vircaps2xmltest.c
+++ b/tests/vircaps2xmltest.c
@@ -93,6 +93,7 @@ mymain(void)
DO_TEST_FULL("basic", VIR_ARCH_X86_64, false, false);
DO_TEST_FULL("basic", VIR_ARCH_AARCH64, true, false);
DO_TEST_FULL("basic-dies", VIR_ARCH_X86_64, false, false);
+ DO_TEST_FULL("basic-clusters", VIR_ARCH_AARCH64, false, false);
DO_TEST_FULL("caches", VIR_ARCH_X86_64, true, true);
diff --git a/tests/virhostcpudata/linux-aarch64-with-clusters.cpuinfo b/tests/virhostcpudata/linux-aarch64-with-clusters.cpuinfo
new file mode 100644
index 0000000000..94030201d2
--- /dev/null
+++ b/tests/virhostcpudata/linux-aarch64-with-clusters.cpuinfo
@@ -0,0 +1,72 @@
+processor : 0
+BogoMIPS : 400.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm
+CPU implementer : 0x43
+CPU architecture: 8
+CPU variant : 0x1
+CPU part : 0x0af
+CPU revision : 1
+
+processor : 1
+BogoMIPS : 400.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm
+CPU implementer : 0x43
+CPU architecture: 8
+CPU variant : 0x1
+CPU part : 0x0af
+CPU revision : 1
+
+processor : 2
+BogoMIPS : 400.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm
+CPU implementer : 0x43
+CPU architecture: 8
+CPU variant : 0x1
+CPU part : 0x0af
+CPU revision : 1
+
+processor : 3
+BogoMIPS : 400.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm
+CPU implementer : 0x43
+CPU architecture: 8
+CPU variant : 0x1
+CPU part : 0x0af
+CPU revision : 1
+
+processor : 4
+BogoMIPS : 400.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm
+CPU implementer : 0x43
+CPU architecture: 8
+CPU variant : 0x1
+CPU part : 0x0af
+CPU revision : 1
+
+processor : 5
+BogoMIPS : 400.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm
+CPU implementer : 0x43
+CPU architecture: 8
+CPU variant : 0x1
+CPU part : 0x0af
+CPU revision : 1
+
+processor : 6
+BogoMIPS : 400.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm
+CPU implementer : 0x43
+CPU architecture: 8
+CPU variant : 0x1
+CPU part : 0x0af
+CPU revision : 1
+
+processor : 7
+BogoMIPS : 400.00
+Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm
+CPU implementer : 0x43
+CPU architecture: 8
+CPU variant : 0x1
+CPU part : 0x0af
+CPU revision : 1
+
diff --git a/tests/virhostcpudata/linux-aarch64-with-clusters.expected b/tests/virhostcpudata/linux-aarch64-with-clusters.expected
new file mode 100644
index 0000000000..bf350bd40b
--- /dev/null
+++ b/tests/virhostcpudata/linux-aarch64-with-clusters.expected
@@ -0,0 +1 @@
+CPUs: 8/8, MHz: 0, Nodes: 2, Sockets: 1, Cores: 2, Threads: 2
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/cluster_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/cluster_cpus_list
new file mode 100644
index 0000000000..8b0fab869c
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/cluster_cpus_list
@@ -0,0 +1 @@
+0-1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/cluster_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/cluster_id
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/cluster_id
@@ -0,0 +1 @@
+0
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_cpus_list
new file mode 100644
index 0000000000..8b0fab869c
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_cpus_list
@@ -0,0 +1 @@
+0-1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_id
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_id
@@ -0,0 +1 @@
+0
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_siblings_list
new file mode 100644
index 0000000000..40c7bb2f1a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/core_siblings_list
@@ -0,0 +1 @@
+0-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/package_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/package_cpus_list
new file mode 100644
index 0000000000..40c7bb2f1a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/package_cpus_list
@@ -0,0 +1 @@
+0-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/physical_package_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/physical_package_id
new file mode 100644
index 0000000000..7facc89938
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/physical_package_id
@@ -0,0 +1 @@
+36
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/thread_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/thread_siblings_list
new file mode 100644
index 0000000000..8b0fab869c
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu0/topology/thread_siblings_list
@@ -0,0 +1 @@
+0-1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/cluster_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/cluster_cpus_list
new file mode 100644
index 0000000000..8b0fab869c
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/cluster_cpus_list
@@ -0,0 +1 @@
+0-1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/cluster_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/cluster_id
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/cluster_id
@@ -0,0 +1 @@
+0
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_cpus_list
new file mode 100644
index 0000000000..8b0fab869c
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_cpus_list
@@ -0,0 +1 @@
+0-1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_id
new file mode 100644
index 0000000000..573541ac97
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_id
@@ -0,0 +1 @@
+0
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_siblings_list
new file mode 100644
index 0000000000..40c7bb2f1a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/core_siblings_list
@@ -0,0 +1 @@
+0-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/package_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/package_cpus_list
new file mode 100644
index 0000000000..40c7bb2f1a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/package_cpus_list
@@ -0,0 +1 @@
+0-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/physical_package_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/physical_package_id
new file mode 100644
index 0000000000..7facc89938
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/physical_package_id
@@ -0,0 +1 @@
+36
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/thread_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/thread_siblings_list
new file mode 100644
index 0000000000..8b0fab869c
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu1/topology/thread_siblings_list
@@ -0,0 +1 @@
+0-1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/cluster_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/cluster_cpus_list
new file mode 100644
index 0000000000..7a9857542a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/cluster_cpus_list
@@ -0,0 +1 @@
+2-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/cluster_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/cluster_id
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/cluster_id
@@ -0,0 +1 @@
+1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_cpus_list
new file mode 100644
index 0000000000..7a9857542a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_cpus_list
@@ -0,0 +1 @@
+2-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_id
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_id
@@ -0,0 +1 @@
+1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_siblings_list
new file mode 100644
index 0000000000..40c7bb2f1a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/core_siblings_list
@@ -0,0 +1 @@
+0-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/package_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/package_cpus_list
new file mode 100644
index 0000000000..40c7bb2f1a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/package_cpus_list
@@ -0,0 +1 @@
+0-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/physical_package_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/physical_package_id
new file mode 100644
index 0000000000..7facc89938
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/physical_package_id
@@ -0,0 +1 @@
+36
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/thread_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/thread_siblings_list
new file mode 100644
index 0000000000..7a9857542a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu2/topology/thread_siblings_list
@@ -0,0 +1 @@
+2-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/cluster_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/cluster_cpus_list
new file mode 100644
index 0000000000..7a9857542a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/cluster_cpus_list
@@ -0,0 +1 @@
+2-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/cluster_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/cluster_id
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/cluster_id
@@ -0,0 +1 @@
+1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_cpus_list
new file mode 100644
index 0000000000..7a9857542a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_cpus_list
@@ -0,0 +1 @@
+2-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_id
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_id
@@ -0,0 +1 @@
+1
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_siblings_list
new file mode 100644
index 0000000000..40c7bb2f1a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/core_siblings_list
@@ -0,0 +1 @@
+0-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/package_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/package_cpus_list
new file mode 100644
index 0000000000..40c7bb2f1a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/package_cpus_list
@@ -0,0 +1 @@
+0-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/physical_package_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/physical_package_id
new file mode 100644
index 0000000000..7facc89938
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/physical_package_id
@@ -0,0 +1 @@
+36
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/thread_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/thread_siblings_list
new file mode 100644
index 0000000000..7a9857542a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu3/topology/thread_siblings_list
@@ -0,0 +1 @@
+2-3
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/cluster_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/cluster_cpus_list
new file mode 100644
index 0000000000..e66d883ade
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/cluster_cpus_list
@@ -0,0 +1 @@
+4-5
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/cluster_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/cluster_id
new file mode 100644
index 0000000000..9183bf03fc
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/cluster_id
@@ -0,0 +1 @@
+256
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_cpus_list
new file mode 100644
index 0000000000..e66d883ade
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_cpus_list
@@ -0,0 +1 @@
+4-5
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_id
new file mode 100644
index 0000000000..9183bf03fc
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_id
@@ -0,0 +1 @@
+256
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_siblings_list
new file mode 100644
index 0000000000..93fccd3cc6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/core_siblings_list
@@ -0,0 +1 @@
+4-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/package_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/package_cpus_list
new file mode 100644
index 0000000000..93fccd3cc6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/package_cpus_list
@@ -0,0 +1 @@
+4-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/physical_package_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/physical_package_id
new file mode 100644
index 0000000000..58cecca290
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/physical_package_id
@@ -0,0 +1 @@
+3180
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/thread_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/thread_siblings_list
new file mode 100644
index 0000000000..e66d883ade
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu4/topology/thread_siblings_list
@@ -0,0 +1 @@
+4-5
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/cluster_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/cluster_cpus_list
new file mode 100644
index 0000000000..e66d883ade
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/cluster_cpus_list
@@ -0,0 +1 @@
+4-5
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/cluster_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/cluster_id
new file mode 100644
index 0000000000..9183bf03fc
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/cluster_id
@@ -0,0 +1 @@
+256
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_cpus_list
new file mode 100644
index 0000000000..e66d883ade
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_cpus_list
@@ -0,0 +1 @@
+4-5
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_id
new file mode 100644
index 0000000000..9183bf03fc
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_id
@@ -0,0 +1 @@
+256
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_siblings_list
new file mode 100644
index 0000000000..93fccd3cc6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/core_siblings_list
@@ -0,0 +1 @@
+4-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/package_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/package_cpus_list
new file mode 100644
index 0000000000..93fccd3cc6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/package_cpus_list
@@ -0,0 +1 @@
+4-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/physical_package_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/physical_package_id
new file mode 100644
index 0000000000..58cecca290
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/physical_package_id
@@ -0,0 +1 @@
+3180
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/thread_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/thread_siblings_list
new file mode 100644
index 0000000000..e66d883ade
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu5/topology/thread_siblings_list
@@ -0,0 +1 @@
+4-5
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/cluster_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/cluster_cpus_list
new file mode 100644
index 0000000000..fdd9f37517
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/cluster_cpus_list
@@ -0,0 +1 @@
+6-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/cluster_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/cluster_id
new file mode 100644
index 0000000000..a700e79997
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/cluster_id
@@ -0,0 +1 @@
+257
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_cpus_list
new file mode 100644
index 0000000000..fdd9f37517
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_cpus_list
@@ -0,0 +1 @@
+6-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_id
new file mode 100644
index 0000000000..a700e79997
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_id
@@ -0,0 +1 @@
+257
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_siblings_list
new file mode 100644
index 0000000000..93fccd3cc6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/core_siblings_list
@@ -0,0 +1 @@
+4-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/package_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/package_cpus_list
new file mode 100644
index 0000000000..93fccd3cc6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/package_cpus_list
@@ -0,0 +1 @@
+4-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/physical_package_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/physical_package_id
new file mode 100644
index 0000000000..58cecca290
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/physical_package_id
@@ -0,0 +1 @@
+3180
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/thread_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/thread_siblings_list
new file mode 100644
index 0000000000..fdd9f37517
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu6/topology/thread_siblings_list
@@ -0,0 +1 @@
+6-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/cluster_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/cluster_cpus_list
new file mode 100644
index 0000000000..fdd9f37517
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/cluster_cpus_list
@@ -0,0 +1 @@
+6-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/cluster_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/cluster_id
new file mode 100644
index 0000000000..a700e79997
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/cluster_id
@@ -0,0 +1 @@
+257
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_cpus_list
new file mode 100644
index 0000000000..fdd9f37517
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_cpus_list
@@ -0,0 +1 @@
+6-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_id
new file mode 100644
index 0000000000..a700e79997
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_id
@@ -0,0 +1 @@
+257
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_siblings_list
new file mode 100644
index 0000000000..93fccd3cc6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/core_siblings_list
@@ -0,0 +1 @@
+4-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/package_cpus_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/package_cpus_list
new file mode 100644
index 0000000000..93fccd3cc6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/package_cpus_list
@@ -0,0 +1 @@
+4-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/physical_package_id b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/physical_package_id
new file mode 100644
index 0000000000..58cecca290
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/physical_package_id
@@ -0,0 +1 @@
+3180
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/thread_siblings_list b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/thread_siblings_list
new file mode 100644
index 0000000000..fdd9f37517
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/cpu7/topology/thread_siblings_list
@@ -0,0 +1 @@
+6-7
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/online b/tests/virhostcpudata/linux-with-clusters/cpu/online
new file mode 100644
index 0000000000..5f4593c34a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/online
@@ -0,0 +1 @@
+0-223
diff --git a/tests/virhostcpudata/linux-with-clusters/cpu/present b/tests/virhostcpudata/linux-with-clusters/cpu/present
new file mode 100644
index 0000000000..5f4593c34a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/cpu/present
@@ -0,0 +1 @@
+0-223
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node0/cpu0 b/tests/virhostcpudata/linux-with-clusters/node/node0/cpu0
new file mode 120000
index 0000000000..c841bea28b
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node0/cpu0
@@ -0,0 +1 @@
+../../cpu/cpu0
\ No newline at end of file
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node0/cpu1 b/tests/virhostcpudata/linux-with-clusters/node/node0/cpu1
new file mode 120000
index 0000000000..5f4536279e
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node0/cpu1
@@ -0,0 +1 @@
+../../cpu/cpu1
\ No newline at end of file
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node0/cpu2 b/tests/virhostcpudata/linux-with-clusters/node/node0/cpu2
new file mode 120000
index 0000000000..2dcca332ce
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node0/cpu2
@@ -0,0 +1 @@
+../../cpu/cpu2
\ No newline at end of file
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node0/cpu3 b/tests/virhostcpudata/linux-with-clusters/node/node0/cpu3
new file mode 120000
index 0000000000..c7690e5aa6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node0/cpu3
@@ -0,0 +1 @@
+../../cpu/cpu3
\ No newline at end of file
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node0/cpulist b/tests/virhostcpudata/linux-with-clusters/node/node0/cpulist
new file mode 100644
index 0000000000..40c7bb2f1a
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node0/cpulist
@@ -0,0 +1 @@
+0-3
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node1/cpu4 b/tests/virhostcpudata/linux-with-clusters/node/node1/cpu4
new file mode 120000
index 0000000000..9e77a64eb4
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node1/cpu4
@@ -0,0 +1 @@
+../../cpu/cpu4
\ No newline at end of file
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node1/cpu5 b/tests/virhostcpudata/linux-with-clusters/node/node1/cpu5
new file mode 120000
index 0000000000..cc07c3b97b
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node1/cpu5
@@ -0,0 +1 @@
+../../cpu/cpu5
\ No newline at end of file
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node1/cpu6 b/tests/virhostcpudata/linux-with-clusters/node/node1/cpu6
new file mode 120000
index 0000000000..2e7576354f
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node1/cpu6
@@ -0,0 +1 @@
+../../cpu/cpu6
\ No newline at end of file
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node1/cpu7 b/tests/virhostcpudata/linux-with-clusters/node/node1/cpu7
new file mode 120000
index 0000000000..09e3f79b43
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node1/cpu7
@@ -0,0 +1 @@
+../../cpu/cpu7
\ No newline at end of file
diff --git a/tests/virhostcpudata/linux-with-clusters/node/node1/cpulist b/tests/virhostcpudata/linux-with-clusters/node/node1/cpulist
new file mode 100644
index 0000000000..93fccd3cc6
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/node1/cpulist
@@ -0,0 +1 @@
+4-7
diff --git a/tests/virhostcpudata/linux-with-clusters/node/online b/tests/virhostcpudata/linux-with-clusters/node/online
new file mode 100644
index 0000000000..8b0fab869c
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/online
@@ -0,0 +1 @@
+0-1
diff --git a/tests/virhostcpudata/linux-with-clusters/node/possible b/tests/virhostcpudata/linux-with-clusters/node/possible
new file mode 100644
index 0000000000..8b0fab869c
--- /dev/null
+++ b/tests/virhostcpudata/linux-with-clusters/node/possible
@@ -0,0 +1 @@
+0-1
diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c
index 0990013878..cf310cb4ce 100644
--- a/tests/virhostcputest.c
+++ b/tests/virhostcputest.c
@@ -273,6 +273,7 @@ mymain(void)
{"subcores3", VIR_ARCH_PPC64},
{"with-frequency", VIR_ARCH_S390X},
{"with-die", VIR_ARCH_X86_64},
+ {"with-clusters", VIR_ARCH_AARCH64},
};
if (virInitialize() < 0)
--
2.43.0

View File

@ -1,94 +0,0 @@
From b0d6ee0778c6c2f49c88de9025f6a398b2d07c0f Mon Sep 17 00:00:00 2001
Message-ID: <b0d6ee0778c6c2f49c88de9025f6a398b2d07c0f.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 16 May 2023 16:50:37 +0200
Subject: [PATCH] tests: Add some more DO_TEST*ABI_UPDATE* macros
These are going to be useful later.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 87d91e9e242520048579009ce2ddf8b238ec2733)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
tests/qemuxml2argvtest.c | 19 +++++++++++++++++++
tests/qemuxml2xmltest.c | 3 +++
2 files changed, 22 insertions(+)
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 84e0963ec8..a8711ff833 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -836,6 +836,9 @@ mymain(void)
# define DO_TEST_CAPS_LATEST(name) \
DO_TEST_CAPS_ARCH_LATEST(name, "x86_64")
+# define DO_TEST_CAPS_LATEST_ABI_UPDATE(name) \
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE(name, "x86_64")
+
# define DO_TEST_CAPS_VER(name, ver) \
DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
@@ -855,6 +858,11 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, \
ARG_FLAGS, FLAG_EXPECT_FAILURE)
+# define DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE_FAILURE(name, arch) \
+ DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, \
+ ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, \
+ ARG_FLAGS, FLAG_EXPECT_FAILURE)
+
# define DO_TEST_CAPS_ARCH_VER_FAILURE(name, arch, ver) \
DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, \
ARG_FLAGS, FLAG_EXPECT_FAILURE)
@@ -862,6 +870,9 @@ mymain(void)
# define DO_TEST_CAPS_LATEST_FAILURE(name) \
DO_TEST_CAPS_ARCH_LATEST_FAILURE(name, "x86_64")
+# define DO_TEST_CAPS_LATEST_ABI_UPDATE_FAILURE(name) \
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE_FAILURE(name, "x86_64")
+
# define DO_TEST_CAPS_VER_FAILURE(name, ver) \
DO_TEST_CAPS_ARCH_VER_FAILURE(name, "x86_64", ver)
@@ -869,6 +880,11 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, \
ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR)
+# define DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE_PARSE_ERROR(name, arch) \
+ DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, \
+ ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, \
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR)
+
# define DO_TEST_CAPS_ARCH_VER_PARSE_ERROR(name, arch, ver) \
DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, \
ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR)
@@ -876,6 +892,9 @@ mymain(void)
# define DO_TEST_CAPS_LATEST_PARSE_ERROR(name) \
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR(name, "x86_64")
+# define DO_TEST_CAPS_LATEST_ABI_UPDATE_PARSE_ERROR(name) \
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE_PARSE_ERROR(name, "x86_64")
+
# define DO_TEST_CAPS_VER_PARSE_ERROR(name, ver) \
DO_TEST_CAPS_ARCH_VER_PARSE_ERROR(name, "x86_64", ver)
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 6f7f6690bd..5356872ba8 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -184,6 +184,9 @@ mymain(void)
#define DO_TEST_CAPS_LATEST(name) \
DO_TEST_CAPS_ARCH_LATEST(name, "x86_64")
+#define DO_TEST_CAPS_LATEST_ABI_UPDATE(name) \
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE(name, "x86_64")
+
#define DO_TEST_CAPS_VER(name, ver) \
DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
--
2.42.0

View File

@ -0,0 +1,146 @@
From ce0166ed0811034173aca1edf9e7e2025a100cfb Mon Sep 17 00:00:00 2001
Message-ID: <ce0166ed0811034173aca1edf9e7e2025a100cfb.1706524416.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Mon, 8 Jan 2024 16:21:25 +0100
Subject: [PATCH] tests: Add test case for CPU clusters
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 82c9196bfa19e73167faccbc1c2713a6d7ddbafc)
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
.../cpu-topology5.aarch64-latest.args | 31 +++++++++++++++++++
tests/qemuxml2argvdata/cpu-topology5.xml | 17 ++++++++++
tests/qemuxml2argvtest.c | 1 +
.../cpu-topology5.aarch64-latest.xml | 29 +++++++++++++++++
tests/qemuxml2xmltest.c | 2 ++
5 files changed, 80 insertions(+)
create mode 100644 tests/qemuxml2argvdata/cpu-topology5.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/cpu-topology5.xml
create mode 100644 tests/qemuxml2xmloutdata/cpu-topology5.aarch64-latest.xml
diff --git a/tests/qemuxml2argvdata/cpu-topology5.aarch64-latest.args b/tests/qemuxml2argvdata/cpu-topology5.aarch64-latest.args
new file mode 100644
index 0000000000..d835e1c0fa
--- /dev/null
+++ b/tests/qemuxml2argvdata/cpu-topology5.aarch64-latest.args
@@ -0,0 +1,31 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-aarch64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine virt,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,acpi=off \
+-accel tcg \
+-cpu cortex-a15 \
+-m size=219136k \
+-object '{"qom-type":"memory-backend-ram","id":"mach-virt.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 1,maxcpus=8,sockets=1,dies=1,clusters=2,cores=2,threads=2 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/cpu-topology5.xml b/tests/qemuxml2argvdata/cpu-topology5.xml
new file mode 100644
index 0000000000..f78f0b6b54
--- /dev/null
+++ b/tests/qemuxml2argvdata/cpu-topology5.xml
@@ -0,0 +1,17 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <vcpu placement='static' current='1'>8</vcpu>
+ <os>
+ <type arch='aarch64' machine='virt'>hvm</type>
+ </os>
+ <cpu>
+ <topology sockets='1' dies='1' clusters='2' cores='2' threads='2'/>
+ </cpu>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <controller type='usb' model='none'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index cb78465fc2..1be138bb0f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1813,6 +1813,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("cpu-topology2");
DO_TEST_CAPS_LATEST("cpu-topology3");
DO_TEST_CAPS_LATEST("cpu-topology4");
+ DO_TEST_CAPS_ARCH_LATEST("cpu-topology5", "aarch64");
DO_TEST_CAPS_ARCH_LATEST_FULL("cpu-minimum1", "x86_64", ARG_CAPS_HOST_CPU_MODEL, QEMU_CPU_DEF_HASWELL);
DO_TEST_CAPS_ARCH_LATEST_FULL("cpu-minimum2", "x86_64", ARG_CAPS_HOST_CPU_MODEL, QEMU_CPU_DEF_HASWELL);
diff --git a/tests/qemuxml2xmloutdata/cpu-topology5.aarch64-latest.xml b/tests/qemuxml2xmloutdata/cpu-topology5.aarch64-latest.xml
new file mode 100644
index 0000000000..2f5645baab
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/cpu-topology5.aarch64-latest.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static' current='1'>8</vcpu>
+ <os>
+ <type arch='aarch64' machine='virt'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <gic version='2'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>cortex-a15</model>
+ <topology sockets='1' dies='1' clusters='2' cores='2' threads='2'/>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <controller type='usb' index='0' model='none'/>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <audio id='1' type='none'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 4e39763dc7..15cb6bd692 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -674,6 +674,8 @@ mymain(void)
DO_TEST_CAPS_LATEST("chardev-label");
+ DO_TEST_CAPS_ARCH_LATEST("cpu-topology5", "aarch64");
+
DO_TEST_CAPS_LATEST("cpu-numa1");
DO_TEST_CAPS_LATEST("cpu-numa2");
DO_TEST_CAPS_LATEST("cpu-numa-no-memory-element");
--
2.43.0

View File

@ -1,104 +0,0 @@
From 7523f6531ec5cd7e7d77f86b2756ca84d5f87357 Mon Sep 17 00:00:00 2001
Message-ID: <7523f6531ec5cd7e7d77f86b2756ca84d5f87357.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Mon, 15 May 2023 19:04:12 +0200
Subject: [PATCH] tests: Consistently use /path/to/guest_VARS.fd
That's what we already use in almost all cases.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 17735262243293cc68354a06d1042726b2b7293d)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
.../qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args | 2 +-
tests/qemuxml2argvdata/aarch64-virt-graphics.xml | 2 +-
.../qemuxml2argvdata/aarch64-virt-headless.aarch64-latest.args | 2 +-
tests/qemuxml2argvdata/aarch64-virt-headless.xml | 2 +-
.../qemuxml2xmloutdata/aarch64-virt-graphics.aarch64-latest.xml | 2 +-
.../qemuxml2xmloutdata/aarch64-virt-headless.aarch64-latest.xml | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args b/tests/qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args
index 1b7b0a70ff..eaa558747f 100644
--- a/tests/qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args
+++ b/tests/qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args
@@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/usr/share/AAVMF/AAVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
--blockdev '{"driver":"file","filename":"/some/user/nvram/path/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"driver":"file","filename":"/path/to/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
-machine virt-4.0,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel tcg \
diff --git a/tests/qemuxml2argvdata/aarch64-virt-graphics.xml b/tests/qemuxml2argvdata/aarch64-virt-graphics.xml
index 2b1704ad7b..3c7da08381 100644
--- a/tests/qemuxml2argvdata/aarch64-virt-graphics.xml
+++ b/tests/qemuxml2argvdata/aarch64-virt-graphics.xml
@@ -12,7 +12,7 @@
<os>
<type arch='aarch64' machine='virt-4.0'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
- <nvram>/some/user/nvram/path/guest_VARS.fd</nvram>
+ <nvram>/path/to/guest_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
diff --git a/tests/qemuxml2argvdata/aarch64-virt-headless.aarch64-latest.args b/tests/qemuxml2argvdata/aarch64-virt-headless.aarch64-latest.args
index 23b514da9a..9d13abb531 100644
--- a/tests/qemuxml2argvdata/aarch64-virt-headless.aarch64-latest.args
+++ b/tests/qemuxml2argvdata/aarch64-virt-headless.aarch64-latest.args
@@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/usr/share/AAVMF/AAVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
--blockdev '{"driver":"file","filename":"/some/user/nvram/path/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"driver":"file","filename":"/path/to/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
-machine virt-4.0,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel tcg \
diff --git a/tests/qemuxml2argvdata/aarch64-virt-headless.xml b/tests/qemuxml2argvdata/aarch64-virt-headless.xml
index 1d1fc071d7..4cb309037b 100644
--- a/tests/qemuxml2argvdata/aarch64-virt-headless.xml
+++ b/tests/qemuxml2argvdata/aarch64-virt-headless.xml
@@ -12,7 +12,7 @@
<os>
<type arch='aarch64' machine='virt-4.0'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
- <nvram>/some/user/nvram/path/guest_VARS.fd</nvram>
+ <nvram>/path/to/guest_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
diff --git a/tests/qemuxml2xmloutdata/aarch64-virt-graphics.aarch64-latest.xml b/tests/qemuxml2xmloutdata/aarch64-virt-graphics.aarch64-latest.xml
index f0a4003655..1150aceb02 100644
--- a/tests/qemuxml2xmloutdata/aarch64-virt-graphics.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/aarch64-virt-graphics.aarch64-latest.xml
@@ -16,7 +16,7 @@
<feature enabled='no' name='secure-boot'/>
</firmware>
<loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
- <nvram template='/usr/share/AAVMF/AAVMF_VARS.fd'>/some/user/nvram/path/guest_VARS.fd</nvram>
+ <nvram template='/usr/share/AAVMF/AAVMF_VARS.fd'>/path/to/guest_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
diff --git a/tests/qemuxml2xmloutdata/aarch64-virt-headless.aarch64-latest.xml b/tests/qemuxml2xmloutdata/aarch64-virt-headless.aarch64-latest.xml
index ab4126318a..68df856a28 100644
--- a/tests/qemuxml2xmloutdata/aarch64-virt-headless.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/aarch64-virt-headless.aarch64-latest.xml
@@ -16,7 +16,7 @@
<feature enabled='no' name='secure-boot'/>
</firmware>
<loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
- <nvram template='/usr/share/AAVMF/AAVMF_VARS.fd'>/some/user/nvram/path/guest_VARS.fd</nvram>
+ <nvram template='/usr/share/AAVMF/AAVMF_VARS.fd'>/path/to/guest_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
--
2.42.0

View File

@ -1,34 +0,0 @@
From eda27de700194d435b2ca03d4578f34b5388ecc2 Mon Sep 17 00:00:00 2001
Message-ID: <eda27de700194d435b2ca03d4578f34b5388ecc2.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Mon, 31 Jul 2023 17:05:58 +0200
Subject: [PATCH] tests: Drop tags from BIOS firmware descriptor
They aren't used for anything.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit da6b98394bcce6c128edafb3eefe9570d8b96e84)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
tests/qemufirmwaredata/usr/share/qemu/firmware/91-bios.json | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tests/qemufirmwaredata/usr/share/qemu/firmware/91-bios.json b/tests/qemufirmwaredata/usr/share/qemu/firmware/91-bios.json
index 137ff70779..378e6d93a5 100644
--- a/tests/qemufirmwaredata/usr/share/qemu/firmware/91-bios.json
+++ b/tests/qemufirmwaredata/usr/share/qemu/firmware/91-bios.json
@@ -28,8 +28,5 @@
"acpi-s4"
],
"tags": [
- "CONFIG_BOOTSPLASH=n",
- "CONFIG_ROM_SIZE=256",
- "CONFIG_USE_SMM=n"
]
}
--
2.42.0

View File

@ -1,36 +0,0 @@
From a6233b1853d1090e7387ab6dea3cb4e46f1bbe0f Mon Sep 17 00:00:00 2001
Message-ID: <a6233b1853d1090e7387ab6dea3cb4e46f1bbe0f.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Thu, 18 May 2023 14:57:07 +0200
Subject: [PATCH] tests: Include microvm in firmwaretest
libvirt doesn't really support the microvm machine type, but
it can parse the firmware descriptor just fine.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 1b3e9c67e3a2902b882ac2310f4876f5fa48d8f7)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
tests/qemufirmwaretest.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/qemufirmwaretest.c b/tests/qemufirmwaretest.c
index 86c708c7ac..7596c746ab 100644
--- a/tests/qemufirmwaretest.c
+++ b/tests/qemufirmwaretest.c
@@ -295,6 +295,9 @@ mymain(void)
DO_SUPPORTED_TEST("pc-q35-3.1", VIR_ARCH_I686, false,
"/usr/share/seabios/bios-256k.bin:NULL",
VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS);
+ DO_SUPPORTED_TEST("microvm", VIR_ARCH_X86_64, false,
+ "/usr/share/edk2/ovmf/MICROVM.fd:NULL",
+ VIR_DOMAIN_OS_DEF_FIRMWARE_EFI);
DO_SUPPORTED_TEST("virt-3.1", VIR_ARCH_AARCH64, false,
"/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.qcow2:/usr/share/edk2/aarch64/vars-template-pflash.qcow2:"
"/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw:/usr/share/edk2/aarch64/vars-template-pflash.raw:"
--
2.42.0

View File

@ -1,70 +0,0 @@
From 7673738e37d6cb0953b3d338fa8e05a09247a389 Mon Sep 17 00:00:00 2001
Message-ID: <7673738e37d6cb0953b3d338fa8e05a09247a389.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Thu, 3 Aug 2023 15:22:10 +0200
Subject: [PATCH] tests: Reintroduce firmware-auto-efi-format-mismatch
Since the previous version of this negative test now passes,
create a new version that still triggers the intended failure.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 7c328b6cf48b4b75c0964bc127aaafb640ea944c)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
...auto-efi-format-mismatch.x86_64-latest.err | 1 +
.../firmware-auto-efi-format-mismatch.xml | 19 +++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
3 files changed, 21 insertions(+)
create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.err
create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.err b/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.err
new file mode 100644
index 0000000000..abfdfc4357
--- /dev/null
+++ b/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.err
@@ -0,0 +1 @@
+XML error: Format mismatch: loader.format='qcow2' nvram.format='raw'
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml b/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml
new file mode 100644
index 0000000000..4af77c3bee
--- /dev/null
+++ b/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml
@@ -0,0 +1,19 @@
+<domain type='kvm'>
+ <name>guest</name>
+ <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os firmware='efi'>
+ <type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
+ <loader format='qcow2'/>
+ <nvram format='raw'/>
+ </os>
+ <features>
+ <acpi/>
+ </features>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' model='none'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index cc3345f5b1..37ae14d61b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1118,6 +1118,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-nvram-qcow2-network-nbd");
DO_TEST_CAPS_ARCH_LATEST("firmware-auto-efi-format-loader-raw", "aarch64");
DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("firmware-auto-efi-format-loader-raw-abi-update", "aarch64");
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-auto-efi-format-mismatch");
DO_TEST_NOCAPS("clock-utc");
DO_TEST_NOCAPS("clock-localtime");
--
2.42.0

View File

@ -1,117 +0,0 @@
From b262d1dfbdbc8bb6c57bf4f6053dada37691ceab Mon Sep 17 00:00:00 2001
Message-ID: <b262d1dfbdbc8bb6c57bf4f6053dada37691ceab.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Thu, 3 Aug 2023 15:19:59 +0200
Subject: [PATCH] tests: Rename
firmware-auto-efi-format-loader-qcow2-nvram-path
Now that, after the recent changes, the test passes, its old
name is no longer accurate.
While at it, enable the xml2xml part for it as well.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 48e5fe7af43b291e98a6c57cb8830e0adff49d6f)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
...oader-qcow2-nvram-path.x86_64-latest.args} | 0
...to-efi-format-loader-qcow2-nvram-path.xml} | 0
tests/qemuxml2argvtest.c | 2 +-
...-loader-qcow2-nvram-path.x86_64-latest.xml | 41 +++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
5 files changed, 43 insertions(+), 1 deletion(-)
rename tests/qemuxml2argvdata/{firmware-auto-efi-format-mismatch.x86_64-latest.args => firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.args} (100%)
rename tests/qemuxml2argvdata/{firmware-auto-efi-format-mismatch.xml => firmware-auto-efi-format-loader-qcow2-nvram-path.xml} (100%)
create mode 100644 tests/qemuxml2xmloutdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.xml
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.args
similarity index 100%
rename from tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.args
rename to tests/qemuxml2argvdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.args
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml b/tests/qemuxml2argvdata/firmware-auto-efi-format-loader-qcow2-nvram-path.xml
similarity index 100%
rename from tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.xml
rename to tests/qemuxml2argvdata/firmware-auto-efi-format-loader-qcow2-nvram-path.xml
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 9439a5a1e6..cc3345f5b1 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1112,12 +1112,12 @@ mymain(void)
DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-network-iscsi");
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-loader-qcow2");
+ DO_TEST_CAPS_LATEST("firmware-auto-efi-format-loader-qcow2-nvram-path");
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-nvram-qcow2");
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-nvram-qcow2-path");
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-nvram-qcow2-network-nbd");
DO_TEST_CAPS_ARCH_LATEST("firmware-auto-efi-format-loader-raw", "aarch64");
DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("firmware-auto-efi-format-loader-raw-abi-update", "aarch64");
- DO_TEST_CAPS_LATEST("firmware-auto-efi-format-mismatch");
DO_TEST_NOCAPS("clock-utc");
DO_TEST_NOCAPS("clock-localtime");
diff --git a/tests/qemuxml2xmloutdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.xml
new file mode 100644
index 0000000000..49fdfc5c5f
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.xml
@@ -0,0 +1,41 @@
+<domain type='kvm'>
+ <name>guest</name>
+ <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os firmware='efi'>
+ <type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
+ <firmware>
+ <feature enabled='yes' name='enrolled-keys'/>
+ <feature enabled='yes' name='secure-boot'/>
+ </firmware>
+ <loader readonly='yes' secure='yes' type='pflash' format='qcow2'>/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2</loader>
+ <nvram template='/usr/share/edk2/ovmf/OVMF_VARS_4M.secboot.qcow2' format='qcow2'>/path/to/guest_VARS.qcow2</nvram>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <smm state='on'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' index='0' model='none'/>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <watchdog model='itco' action='reset'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 3f2ef10df7..c210673e39 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -921,6 +921,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-network-iscsi");
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-loader-qcow2");
+ DO_TEST_CAPS_LATEST("firmware-auto-efi-format-loader-qcow2-nvram-path");
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-nvram-qcow2");
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-nvram-qcow2-path");
DO_TEST_CAPS_LATEST("firmware-auto-efi-format-nvram-qcow2-network-nbd");
--
2.42.0

View File

@ -1,81 +0,0 @@
From f8725c0f60e94a393fc731f323bbdfdbaa35dd02 Mon Sep 17 00:00:00 2001
Message-ID: <f8725c0f60e94a393fc731f323bbdfdbaa35dd02.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 26 May 2023 18:16:24 +0200
Subject: [PATCH] tests: Rename firmware-auto-efi-nvram-path
The new name better describes the test scenario and will fit
better with the additional tests that we're about to introduce.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 4ba04107d9ebc0070f64a031673cef61a5947866)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
...est.args => firmware-auto-efi-nvram-path.x86_64-latest.args} | 0
...ware-auto-efi-nvram.xml => firmware-auto-efi-nvram-path.xml} | 0
tests/qemuxml2argvtest.c | 2 +-
...atest.xml => firmware-auto-efi-nvram-path.x86_64-latest.xml} | 0
tests/qemuxml2xmltest.c | 2 +-
5 files changed, 2 insertions(+), 2 deletions(-)
rename tests/qemuxml2argvdata/{firmware-auto-efi-nvram.x86_64-latest.args => firmware-auto-efi-nvram-path.x86_64-latest.args} (100%)
rename tests/qemuxml2argvdata/{firmware-auto-efi-nvram.xml => firmware-auto-efi-nvram-path.xml} (100%)
rename tests/qemuxml2xmloutdata/{firmware-auto-efi-nvram.x86_64-latest.xml => firmware-auto-efi-nvram-path.x86_64-latest.xml} (100%)
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-nvram.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-auto-efi-nvram-path.x86_64-latest.args
similarity index 100%
rename from tests/qemuxml2argvdata/firmware-auto-efi-nvram.x86_64-latest.args
rename to tests/qemuxml2argvdata/firmware-auto-efi-nvram-path.x86_64-latest.args
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-nvram.xml b/tests/qemuxml2argvdata/firmware-auto-efi-nvram-path.xml
similarity index 100%
rename from tests/qemuxml2argvdata/firmware-auto-efi-nvram.xml
rename to tests/qemuxml2argvdata/firmware-auto-efi-nvram-path.xml
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 549ecdf9ce..84e0963ec8 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1059,7 +1059,6 @@ mymain(void)
DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-auto-bios-nvram");
DO_TEST_CAPS_LATEST("firmware-auto-efi");
DO_TEST_CAPS_LATEST("firmware-auto-efi-stateless");
- DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-secure");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-insecure");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-path");
@@ -1072,6 +1071,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("firmware-auto-efi-smm-off");
DO_TEST_CAPS_ARCH_LATEST("firmware-auto-efi-aarch64", "aarch64");
DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("firmware-auto-efi-abi-update-aarch64", "aarch64");
+ DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-path");
DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-file");
DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-network-nbd");
DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-network-iscsi");
diff --git a/tests/qemuxml2xmloutdata/firmware-auto-efi-nvram.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-auto-efi-nvram-path.x86_64-latest.xml
similarity index 100%
rename from tests/qemuxml2xmloutdata/firmware-auto-efi-nvram.x86_64-latest.xml
rename to tests/qemuxml2xmloutdata/firmware-auto-efi-nvram-path.x86_64-latest.xml
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 74e6a27b73..6f7f6690bd 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -886,7 +886,6 @@ mymain(void)
DO_TEST_CAPS_LATEST("firmware-auto-bios-stateless");
DO_TEST_CAPS_LATEST("firmware-auto-efi");
DO_TEST_CAPS_LATEST("firmware-auto-efi-stateless");
- DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-secure");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-insecure");
DO_TEST_CAPS_LATEST("firmware-auto-efi-loader-path");
@@ -898,6 +897,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("firmware-auto-efi-smm-off");
DO_TEST_CAPS_ARCH_LATEST("firmware-auto-efi-aarch64", "aarch64");
DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("firmware-auto-efi-abi-update-aarch64", "aarch64");
+ DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-path");
DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-file");
DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-network-nbd");
DO_TEST_CAPS_LATEST("firmware-auto-efi-nvram-network-iscsi");
--
2.42.0

View File

@ -1,148 +0,0 @@
From 5f3f84811feda3b30d9f5e3d99c629169b8ba39c Mon Sep 17 00:00:00 2001
Message-ID: <5f3f84811feda3b30d9f5e3d99c629169b8ba39c.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Mon, 15 May 2023 18:42:27 +0200
Subject: [PATCH] tests: Switch to firmware autoselection for hvf
Firmware selection is not relevant to these tests, so adopt
the most convenient approach.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8c326914d8fc49c838650aef3432e0669cbd8fe1)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
.../hvf-aarch64-virt-headless.aarch64-latest.args | 6 +++---
tests/qemuxml2argvdata/hvf-aarch64-virt-headless.xml | 6 ++----
.../hvf-x86_64-q35-headless.x86_64-latest.args | 7 ++++++-
tests/qemuxml2argvdata/hvf-x86_64-q35-headless.xml | 4 ++--
.../hvf-aarch64-virt-headless.aarch64-latest.xml | 12 ++++++++----
.../hvf-x86_64-q35-headless.x86_64-latest.xml | 11 +++++++++--
6 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.aarch64-latest.args b/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.aarch64-latest.args
index 8fae9ebfa6..7559b9885f 100644
--- a/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.aarch64-latest.args
+++ b/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.aarch64-latest.args
@@ -10,11 +10,11 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-test/.config \
-name guest=test,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-test/master-key.aes"}' \
--blockdev '{"driver":"file","filename":"/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"driver":"file","filename":"/usr/share/AAVMF/AAVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
--blockdev '{"driver":"file","filename":"/some/user/nvram/path/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/test_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
--machine virt,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
+-machine virt-4.0,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel hvf \
-m size=4194304k \
-object '{"qom-type":"memory-backend-ram","id":"mach-virt.ram","size":4294967296}' \
diff --git a/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.xml b/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.xml
index 01997b9731..3ae6f93647 100644
--- a/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.xml
+++ b/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.xml
@@ -4,10 +4,8 @@
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>2</vcpu>
- <os>
- <type arch='aarch64' machine='virt'>hvm</type>
- <loader readonly='yes' type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw</loader>
- <nvram>/some/user/nvram/path/guest_VARS.fd</nvram>
+ <os firmware='efi'>
+ <type arch='aarch64' machine='virt-4.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
diff --git a/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.x86_64-latest.args b/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.x86_64-latest.args
index 92fbcffd57..abea7bf158 100644
--- a/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.x86_64-latest.args
@@ -10,9 +10,14 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-test/.config \
-name guest=test,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-test/master-key.aes"}' \
--machine q35,usb=off,dump-guest-core=off,memory-backend=pc.ram \
+-blockdev '{"driver":"file","filename":"/usr/share/OVMF/OVMF_CODE.secboot.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/test_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
+-machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel hvf \
-cpu qemu64 \
+-global driver=cfi.pflash01,property=secure,value=on \
-m size=4194304k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":4294967296}' \
-overcommit mem-lock=off \
diff --git a/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.xml b/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.xml
index cad560e9ca..93980d434c 100644
--- a/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.xml
+++ b/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.xml
@@ -4,8 +4,8 @@
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>2</vcpu>
- <os>
- <type arch='x86_64' machine='q35'>hvm</type>
+ <os firmware='efi'>
+ <type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
diff --git a/tests/qemuxml2xmloutdata/hvf-aarch64-virt-headless.aarch64-latest.xml b/tests/qemuxml2xmloutdata/hvf-aarch64-virt-headless.aarch64-latest.xml
index 16e8c23a79..69c1d5deb3 100644
--- a/tests/qemuxml2xmloutdata/hvf-aarch64-virt-headless.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/hvf-aarch64-virt-headless.aarch64-latest.xml
@@ -4,10 +4,14 @@
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>2</vcpu>
- <os>
- <type arch='aarch64' machine='virt'>hvm</type>
- <loader readonly='yes' type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw</loader>
- <nvram>/some/user/nvram/path/guest_VARS.fd</nvram>
+ <os firmware='efi'>
+ <type arch='aarch64' machine='virt-4.0'>hvm</type>
+ <firmware>
+ <feature enabled='no' name='enrolled-keys'/>
+ <feature enabled='no' name='secure-boot'/>
+ </firmware>
+ <loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
+ <nvram template='/usr/share/AAVMF/AAVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/test_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
diff --git a/tests/qemuxml2xmloutdata/hvf-x86_64-q35-headless.x86_64-latest.xml b/tests/qemuxml2xmloutdata/hvf-x86_64-q35-headless.x86_64-latest.xml
index 384241ac3d..032fd43471 100644
--- a/tests/qemuxml2xmloutdata/hvf-x86_64-q35-headless.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/hvf-x86_64-q35-headless.x86_64-latest.xml
@@ -4,13 +4,20 @@
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>2</vcpu>
- <os>
- <type arch='x86_64' machine='q35'>hvm</type>
+ <os firmware='efi'>
+ <type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
+ <firmware>
+ <feature enabled='yes' name='enrolled-keys'/>
+ <feature enabled='yes' name='secure-boot'/>
+ </firmware>
+ <loader readonly='yes' secure='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.secboot.fd</loader>
+ <nvram template='/usr/share/OVMF/OVMF_VARS.secboot.fd'>/var/lib/libvirt/qemu/nvram/test_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
+ <smm state='on'/>
</features>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
--
2.42.0

View File

@ -0,0 +1,88 @@
From a7c145e58b5de35554004f5a779091cec7d03be1 Mon Sep 17 00:00:00 2001
Message-ID: <a7c145e58b5de35554004f5a779091cec7d03be1.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 23 Jan 2024 16:40:34 +0100
Subject: [PATCH] tests: Test the previously mishandled PCI VPD characters
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Modify the test data to validate '<>' and other characters.
Unfortunately the test suite doesn't have a proper end-to-end test, thus
we just add a XML->XML variant and also add data to the binary parser.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 9eda33161f49fcf3ba07d648bd80d2a9a2388479)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
https://issues.redhat.com/browse/RHEL-22400 [9.3.z]
https://issues.redhat.com/browse/RHEL-22399 [9.2.z]
---
tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml | 4 ++--
tests/virpcimock.c | 4 ++--
tests/virpcivpdtest.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml b/tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml
index 8b56e4f6b4..c9a2901381 100644
--- a/tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml
+++ b/tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml
@@ -15,7 +15,7 @@
<change_level>B1</change_level>
<manufacture_id>foobar</manufacture_id>
<part_number>MBF2H332A-AEEOT</part_number>
- <serial_number>MT2113X00000</serial_number>
+ <serial_number>MT2113X00000&gt;&lt;</serial_number>
<vendor_field index='0'>PCIeGen4 x8</vendor_field>
<vendor_field index='2'>MBF2H332A-AEEOT</vendor_field>
<vendor_field index='3'>3c53d07eec484d8aab34dabd24fe575aa</vendor_field>
@@ -25,7 +25,7 @@
<asset_tag>fooasset</asset_tag>
<vendor_field index='0'>vendorfield0</vendor_field>
<vendor_field index='2'>vendorfield2</vendor_field>
- <vendor_field index='A'>vendorfieldA</vendor_field>
+ <vendor_field index='A'>!@#$./&gt;&lt;</vendor_field>
<system_field index='B'>systemfieldB</system_field>
<system_field index='0'>systemfield0</system_field>
</fields>
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 13b37bb23d..2f98b0cf13 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -966,9 +966,9 @@ init_env(void)
't', 'e', 's', 't', 'n', 'a', 'm', 'e',
PCI_VPD_LARGE_RESOURCE_FLAG | PCI_VPD_READ_ONLY_LARGE_RESOURCE_FLAG, 0x16, 0x00,
'P', 'N', 0x02, '4', '2',
- 'E', 'C', 0x04, '4', '2', '4', '2',
+ 'E', 'C', 0x04, '4', '<', '>', '2',
'V', 'A', 0x02, 'E', 'X',
- 'R', 'V', 0x02, 0x31, 0x00,
+ 'R', 'V', 0x02, 0x1D, 0x00,
PCI_VPD_RESOURCE_END_VAL
};
struct pciVPD exampleVPD = {
diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c
index b4dd68b7aa..ae5772d3f5 100644
--- a/tests/virpcivpdtest.c
+++ b/tests/virpcivpdtest.c
@@ -424,7 +424,7 @@ testPCIVPDGetFieldValueFormat(const void *data G_GNUC_UNUSED)
# define VPD_W_EXAMPLE_FIELDS \
'V', 'Z', 0x02, '4', '2', \
- 'Y', 'A', 0x04, 'I', 'D', '4', '2', \
+ 'Y', 'A', 0x04, '!', '<', '>', ':', \
'Y', 'F', 0x02, 'E', 'X', \
'Y', 'E', 0x00, \
'R', 'W', 0x02, 0x00, 0x00
@@ -579,7 +579,7 @@ testVirPCIVPDParseFullVPD(const void *opaque G_GNUC_UNUSED)
if (testVirPCIVPDValidateExampleReadOnlyFields(res))
return -1;
- if (STRNEQ_NULLABLE(res->rw->asset_tag, "ID42"))
+ if (STRNEQ_NULLABLE(res->rw->asset_tag, "!<>:"))
return -1;
if (!res->rw->vendor_specific)
--
2.43.0

View File

@ -1,57 +0,0 @@
From 57b899e51b68ec5e9a78a90f9c1a06c572d9f5c7 Mon Sep 17 00:00:00 2001
Message-ID: <57b899e51b68ec5e9a78a90f9c1a06c572d9f5c7.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 16 May 2023 16:55:41 +0200
Subject: [PATCH] tests: Turn abi-update.xml into a symlink
Since the idea behind introducing the abi-update variant of
a test is showing that libvirt behaves differently based on
whether the configuration is for a newly-defined domain or an
existing one, we don't want the input files to ever go out of
sync.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8627ec167cb29bc4bea7609992670c0a718e8c79)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
.../firmware-auto-efi-abi-update-aarch64.xml | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
mode change 100644 => 120000 tests/qemuxml2argvdata/firmware-auto-efi-abi-update-aarch64.xml
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-abi-update-aarch64.xml b/tests/qemuxml2argvdata/firmware-auto-efi-abi-update-aarch64.xml
deleted file mode 100644
index 5c6c5192ba..0000000000
--- a/tests/qemuxml2argvdata/firmware-auto-efi-abi-update-aarch64.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<domain type='qemu'>
- <name>guest</name>
- <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid>
- <memory unit='KiB'>1048576</memory>
- <vcpu placement='static'>1</vcpu>
- <os firmware='efi'>
- <type arch='aarch64' machine='virt-4.0'>hvm</type>
- </os>
- <features>
- <acpi/>
- </features>
- <devices>
- <emulator>/usr/bin/qemu-system-aarch64</emulator>
- <controller type='usb' model='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-abi-update-aarch64.xml b/tests/qemuxml2argvdata/firmware-auto-efi-abi-update-aarch64.xml
new file mode 120000
index 0000000000..551082260a
--- /dev/null
+++ b/tests/qemuxml2argvdata/firmware-auto-efi-abi-update-aarch64.xml
@@ -0,0 +1 @@
+firmware-auto-efi-aarch64.xml
\ No newline at end of file
--
2.42.0

File diff suppressed because it is too large Load Diff

View File

@ -1,119 +0,0 @@
From 38b7b94f3b0571d4411e858a17232626499f1e45 Mon Sep 17 00:00:00 2001
Message-ID: <38b7b94f3b0571d4411e858a17232626499f1e45.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 30 May 2023 17:48:58 +0200
Subject: [PATCH] tests: Use DO_TEST_CAPS_*_ABI_UPDATE() for ppc64
We have a number of tests that can benefit from this macro
instead of open-coding it.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 751b0e6dbfba160dac8dead6c6e6c68660e0a706)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
...lug-nvdimm-ppc64-abi-update.ppc64-latest.args} | 0
...lug-ppc64-nonuma-abi-update.ppc64-latest.args} | 0
...64-usb-controller-qemu-xhci.ppc64-latest.args} | 0
tests/qemuxml2argvtest.c | 15 +++------------
...plug-nvdimm-ppc64-abi-update.ppc64-latest.xml} | 0
...plug-ppc64-nonuma-abi-update.ppc64-latest.xml} | 0
tests/qemuxml2xmltest.c | 8 ++------
7 files changed, 5 insertions(+), 18 deletions(-)
rename tests/qemuxml2argvdata/{memory-hotplug-nvdimm-ppc64-abi-update.args => memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.args} (100%)
rename tests/qemuxml2argvdata/{memory-hotplug-ppc64-nonuma-abi-update.args => memory-hotplug-ppc64-nonuma-abi-update.ppc64-latest.args} (100%)
rename tests/qemuxml2argvdata/{ppc64-usb-controller-qemu-xhci.args => ppc64-usb-controller-qemu-xhci.ppc64-latest.args} (100%)
rename tests/qemuxml2xmloutdata/{memory-hotplug-nvdimm-ppc64-abi-update.xml => memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml} (100%)
rename tests/qemuxml2xmloutdata/{memory-hotplug-ppc64-nonuma-abi-update.xml => memory-hotplug-ppc64-nonuma-abi-update.ppc64-latest.xml} (100%)
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.args
similarity index 100%
rename from tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args
rename to tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.args
diff --git a/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args b/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.ppc64-latest.args
similarity index 100%
rename from tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args
rename to tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.ppc64-latest.args
diff --git a/tests/qemuxml2argvdata/ppc64-usb-controller-qemu-xhci.args b/tests/qemuxml2argvdata/ppc64-usb-controller-qemu-xhci.ppc64-latest.args
similarity index 100%
rename from tests/qemuxml2argvdata/ppc64-usb-controller-qemu-xhci.args
rename to tests/qemuxml2argvdata/ppc64-usb-controller-qemu-xhci.ppc64-latest.args
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 9abaa72674..549ecdf9ce 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2440,10 +2440,7 @@ mymain(void)
DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM);
DO_TEST_CAPS_LATEST("memory-hotplug-dimm-addr");
DO_TEST_CAPS_ARCH_LATEST("memory-hotplug-ppc64-nonuma", "ppc64");
- DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", "",
- ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
- ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest",
- ARG_END);
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("memory-hotplug-ppc64-nonuma-abi-update", "ppc64");
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm");
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-access");
DO_TEST_CAPS_VER("memory-hotplug-nvdimm-label", "5.2.0");
@@ -2455,10 +2452,7 @@ mymain(void)
DO_TEST_CAPS_VER("memory-hotplug-nvdimm-readonly", "5.2.0");
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-readonly");
DO_TEST_CAPS_ARCH_LATEST("memory-hotplug-nvdimm-ppc64", "ppc64");
- DO_TEST_FULL("memory-hotplug-nvdimm-ppc64-abi-update", "",
- ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
- ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest",
- ARG_END);
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("memory-hotplug-nvdimm-ppc64-abi-update", "ppc64");
DO_TEST_CAPS_VER("memory-hotplug-virtio-pmem", "5.2.0");
DO_TEST_CAPS_LATEST("memory-hotplug-virtio-pmem");
DO_TEST_CAPS_LATEST("memory-hotplug-virtio-mem");
@@ -2497,10 +2491,7 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("ppc64-usb-controller", "ppc64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-usb-controller-legacy", "ppc64");
- DO_TEST_FULL("ppc64-usb-controller-qemu-xhci", "",
- ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
- ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest",
- ARG_END);
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("ppc64-usb-controller-qemu-xhci", "ppc64");
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("ppc64-tpmproxy-double", "ppc64");
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("ppc64-tpm-double", "ppc64");
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml
similarity index 100%
rename from tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.xml
rename to tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma-abi-update.xml b/tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma-abi-update.ppc64-latest.xml
similarity index 100%
rename from tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma-abi-update.xml
rename to tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma-abi-update.ppc64-latest.xml
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b66274beb8..74e6a27b73 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -995,9 +995,7 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("aarch64-usb-controller", "aarch64");
DO_TEST_CAPS_ARCH_LATEST("memory-hotplug-ppc64-nonuma", "ppc64");
- DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", "", WHEN_BOTH,
- ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
- ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest", ARG_END);
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("memory-hotplug-ppc64-nonuma-abi-update", "ppc64");
DO_TEST_NOCAPS("memory-hotplug");
DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM);
DO_TEST_CAPS_LATEST("memory-hotplug-dimm-addr");
@@ -1009,9 +1007,7 @@ mymain(void)
DO_TEST("memory-hotplug-nvdimm-readonly", QEMU_CAPS_DEVICE_NVDIMM,
QEMU_CAPS_DEVICE_NVDIMM_UNARMED);
DO_TEST_CAPS_ARCH_LATEST("memory-hotplug-nvdimm-ppc64", "ppc64");
- DO_TEST_FULL("memory-hotplug-nvdimm-ppc64-abi-update", "", WHEN_BOTH,
- ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
- ARG_CAPS_ARCH, "ppc64", ARG_CAPS_VER, "latest", ARG_END);
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE("memory-hotplug-nvdimm-ppc64-abi-update", "ppc64");
DO_TEST_CAPS_LATEST("memory-hotplug-virtio-pmem");
DO_TEST_CAPS_LATEST("memory-hotplug-virtio-mem");
DO_TEST_CAPS_LATEST("memory-hotplug-multiple");
--
2.42.0

View File

@ -1,118 +0,0 @@
From f3437c2d4bce7b21f199cdc59bb6778e49507f5b Mon Sep 17 00:00:00 2001
Message-ID: <f3437c2d4bce7b21f199cdc59bb6778e49507f5b.1692951632.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Mon, 15 May 2023 18:39:18 +0200
Subject: [PATCH] tests: Use virt-4.0 machine type for aarch64
Using the unversioned machine type means that firmware
descriptors can't be used to discover additional information
about the chosen firmware build.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 5c129c8e7a15650fcb0deac53d9d3c0ac1802da5)
https://bugzilla.redhat.com/show_bug.cgi?id=2196178
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
.../aarch64-virt-graphics.aarch64-latest.args | 2 +-
tests/qemuxml2argvdata/aarch64-virt-graphics.xml | 2 +-
.../aarch64-virt-headless.aarch64-latest.args | 2 +-
tests/qemuxml2argvdata/aarch64-virt-headless.xml | 2 +-
.../aarch64-virt-graphics.aarch64-latest.xml | 8 ++++++--
.../aarch64-virt-headless.aarch64-latest.xml | 8 ++++++--
6 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/tests/qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args b/tests/qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args
index 2c07824346..1b7b0a70ff 100644
--- a/tests/qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args
+++ b/tests/qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
-blockdev '{"driver":"file","filename":"/some/user/nvram/path/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
--machine virt,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
+-machine virt-4.0,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel tcg \
-cpu cortex-a15 \
-m size=4194304k \
diff --git a/tests/qemuxml2argvdata/aarch64-virt-graphics.xml b/tests/qemuxml2argvdata/aarch64-virt-graphics.xml
index b1b5e87c22..2b1704ad7b 100644
--- a/tests/qemuxml2argvdata/aarch64-virt-graphics.xml
+++ b/tests/qemuxml2argvdata/aarch64-virt-graphics.xml
@@ -10,7 +10,7 @@
<currentMemory>4194304</currentMemory>
<vcpu>4</vcpu>
<os>
- <type arch='aarch64' machine='virt'>hvm</type>
+ <type arch='aarch64' machine='virt-4.0'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
<nvram>/some/user/nvram/path/guest_VARS.fd</nvram>
<boot dev='hd'/>
diff --git a/tests/qemuxml2argvdata/aarch64-virt-headless.aarch64-latest.args b/tests/qemuxml2argvdata/aarch64-virt-headless.aarch64-latest.args
index 734e62ed53..23b514da9a 100644
--- a/tests/qemuxml2argvdata/aarch64-virt-headless.aarch64-latest.args
+++ b/tests/qemuxml2argvdata/aarch64-virt-headless.aarch64-latest.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
-blockdev '{"driver":"file","filename":"/some/user/nvram/path/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
--machine virt,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
+-machine virt-4.0,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel tcg \
-cpu cortex-a15 \
-m size=4194304k \
diff --git a/tests/qemuxml2argvdata/aarch64-virt-headless.xml b/tests/qemuxml2argvdata/aarch64-virt-headless.xml
index 27825e9a55..1d1fc071d7 100644
--- a/tests/qemuxml2argvdata/aarch64-virt-headless.xml
+++ b/tests/qemuxml2argvdata/aarch64-virt-headless.xml
@@ -10,7 +10,7 @@
<currentMemory>4194304</currentMemory>
<vcpu>4</vcpu>
<os>
- <type arch='aarch64' machine='virt'>hvm</type>
+ <type arch='aarch64' machine='virt-4.0'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
<nvram>/some/user/nvram/path/guest_VARS.fd</nvram>
<boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/aarch64-virt-graphics.aarch64-latest.xml b/tests/qemuxml2xmloutdata/aarch64-virt-graphics.aarch64-latest.xml
index 24109a11c3..f0a4003655 100644
--- a/tests/qemuxml2xmloutdata/aarch64-virt-graphics.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/aarch64-virt-graphics.aarch64-latest.xml
@@ -9,8 +9,12 @@
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>4</vcpu>
- <os>
- <type arch='aarch64' machine='virt'>hvm</type>
+ <os firmware='efi'>
+ <type arch='aarch64' machine='virt-4.0'>hvm</type>
+ <firmware>
+ <feature enabled='no' name='enrolled-keys'/>
+ <feature enabled='no' name='secure-boot'/>
+ </firmware>
<loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
<nvram template='/usr/share/AAVMF/AAVMF_VARS.fd'>/some/user/nvram/path/guest_VARS.fd</nvram>
<boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/aarch64-virt-headless.aarch64-latest.xml b/tests/qemuxml2xmloutdata/aarch64-virt-headless.aarch64-latest.xml
index 6182da4dc6..ab4126318a 100644
--- a/tests/qemuxml2xmloutdata/aarch64-virt-headless.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/aarch64-virt-headless.aarch64-latest.xml
@@ -9,8 +9,12 @@
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>4</vcpu>
- <os>
- <type arch='aarch64' machine='virt'>hvm</type>
+ <os firmware='efi'>
+ <type arch='aarch64' machine='virt-4.0'>hvm</type>
+ <firmware>
+ <feature enabled='no' name='enrolled-keys'/>
+ <feature enabled='no' name='secure-boot'/>
+ </firmware>
<loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
<nvram template='/usr/share/AAVMF/AAVMF_VARS.fd'>/some/user/nvram/path/guest_VARS.fd</nvram>
<boot dev='hd'/>
--
2.42.0

View File

@ -0,0 +1,458 @@
From 28cda48f6a1af4868de1604755137db2ef5a2405 Mon Sep 17 00:00:00 2001
Message-ID: <28cda48f6a1af4868de1604755137db2ef5a2405.1706524416.git.jdenemar@redhat.com>
From: Andrea Bolognani <abologna@redhat.com>
Date: Mon, 8 Jan 2024 18:44:25 +0100
Subject: [PATCH] tests: Verify handling of CPU clusters in QMP data
Since aarch64 doesn't support CPU hotplug at the moment, we have
to get a bit creative.
While the 'query-cpus-fast' output is taken directly from a VM
configured as
<vcpu current='7'>16</vcpu>
<cpu mode='host-passthrough'>
<topology sockets='2' dies='1' clusters='2' cores='2' threads='2'/>
</cpu>
the 'query-hotpluggable-cpus' output is constructed by hand
starting from the former and using the 'x86-dies' test data as
a model.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit cb7abb0703f4c2b55b17cce5ecb8f83fed8775be)
https://issues.redhat.com/browse/RHEL-7043
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
...torjson-cpuinfo-aarch64-clusters-cpus.json | 88 +++++++++
...json-cpuinfo-aarch64-clusters-hotplug.json | 171 ++++++++++++++++++
...umonitorjson-cpuinfo-aarch64-clusters.data | 108 +++++++++++
tests/qemumonitorjsontest.c | 9 +-
4 files changed, 375 insertions(+), 1 deletion(-)
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters-cpus.json
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters-hotplug.json
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters.data
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters-cpus.json
new file mode 100644
index 0000000000..817f65d109
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters-cpus.json
@@ -0,0 +1,88 @@
+{
+ "return": [
+ {
+ "thread-id": 284700,
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "socket-id": 0,
+ "cluster-id": 0
+ },
+ "qom-path": "/machine/unattached/device[0]",
+ "cpu-index": 0,
+ "target": "aarch64"
+ },
+ {
+ "thread-id": 284701,
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "socket-id": 0,
+ "cluster-id": 0
+ },
+ "qom-path": "/machine/unattached/device[1]",
+ "cpu-index": 1,
+ "target": "aarch64"
+ },
+ {
+ "thread-id": 284702,
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "socket-id": 0,
+ "cluster-id": 0
+ },
+ "qom-path": "/machine/unattached/device[2]",
+ "cpu-index": 2,
+ "target": "aarch64"
+ },
+ {
+ "thread-id": 284703,
+ "props": {
+ "core-id": 1,
+ "thread-id": 1,
+ "socket-id": 0,
+ "cluster-id": 0
+ },
+ "qom-path": "/machine/unattached/device[3]",
+ "cpu-index": 3,
+ "target": "aarch64"
+ },
+ {
+ "thread-id": 284704,
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "socket-id": 0,
+ "cluster-id": 1
+ },
+ "qom-path": "/machine/unattached/device[4]",
+ "cpu-index": 4,
+ "target": "aarch64"
+ },
+ {
+ "thread-id": 284705,
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "socket-id": 0,
+ "cluster-id": 1
+ },
+ "qom-path": "/machine/unattached/device[5]",
+ "cpu-index": 5,
+ "target": "aarch64"
+ },
+ {
+ "thread-id": 284706,
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "socket-id": 0,
+ "cluster-id": 1
+ },
+ "qom-path": "/machine/unattached/device[6]",
+ "cpu-index": 6,
+ "target": "aarch64"
+ }
+ ]
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters-hotplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters-hotplug.json
new file mode 100644
index 0000000000..7ae30bf111
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters-hotplug.json
@@ -0,0 +1,171 @@
+{
+ "return": [
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 1,
+ "socket-id": 1,
+ "cluster-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "socket-id": 1,
+ "cluster-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "socket-id": 1,
+ "cluster-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "socket-id": 1,
+ "cluster-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 1,
+ "socket-id": 1,
+ "cluster-id": 0
+ },
+ "vcpus-count": 1,
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "socket-id": 1,
+ "cluster-id": 0
+ },
+ "vcpus-count": 1,
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "socket-id": 1,
+ "cluster-id": 0
+ },
+ "vcpus-count": 1,
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "socket-id": 1,
+ "cluster-id": 0
+ },
+ "vcpus-count": 1,
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 1,
+ "socket-id": 0,
+ "cluster-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "socket-id": 0,
+ "cluster-id": 1
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[6]",
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "socket-id": 0,
+ "cluster-id": 1
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[5]",
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "socket-id": 0,
+ "cluster-id": 1
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[4]",
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 1,
+ "socket-id": 0,
+ "cluster-id": 0
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[3]",
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "socket-id": 0,
+ "cluster-id": 0
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[2]",
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "socket-id": 0,
+ "cluster-id": 0
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[1]",
+ "type": "host-arm-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "socket-id": 0,
+ "cluster-id": 0
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[0]",
+ "type": "host-arm-cpu"
+ }
+ ]
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters.data
new file mode 100644
index 0000000000..87e927e7a8
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-aarch64-clusters.data
@@ -0,0 +1,108 @@
+[vcpu libvirt-id='0']
+ online=yes
+ hotpluggable=no
+ thread-id='284700'
+ enable-id='1'
+ query-cpus-id='0'
+ type='host-arm-cpu'
+ qom_path='/machine/unattached/device[0]'
+ topology: socket='0' cluster_id='0' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='1']
+ online=yes
+ hotpluggable=no
+ thread-id='284701'
+ enable-id='2'
+ query-cpus-id='1'
+ type='host-arm-cpu'
+ qom_path='/machine/unattached/device[1]'
+ topology: socket='0' cluster_id='0' core='0' thread='1' vcpus='1'
+[vcpu libvirt-id='2']
+ online=yes
+ hotpluggable=no
+ thread-id='284702'
+ enable-id='3'
+ query-cpus-id='2'
+ type='host-arm-cpu'
+ qom_path='/machine/unattached/device[2]'
+ topology: socket='0' cluster_id='0' core='1' thread='0' vcpus='1'
+[vcpu libvirt-id='3']
+ online=yes
+ hotpluggable=no
+ thread-id='284703'
+ enable-id='4'
+ query-cpus-id='3'
+ type='host-arm-cpu'
+ qom_path='/machine/unattached/device[3]'
+ topology: socket='0' cluster_id='0' core='1' thread='1' vcpus='1'
+[vcpu libvirt-id='4']
+ online=yes
+ hotpluggable=no
+ thread-id='284704'
+ enable-id='5'
+ query-cpus-id='4'
+ type='host-arm-cpu'
+ qom_path='/machine/unattached/device[4]'
+ topology: socket='0' cluster_id='1' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='5']
+ online=yes
+ hotpluggable=no
+ thread-id='284705'
+ enable-id='6'
+ query-cpus-id='5'
+ type='host-arm-cpu'
+ qom_path='/machine/unattached/device[5]'
+ topology: socket='0' cluster_id='1' core='0' thread='1' vcpus='1'
+[vcpu libvirt-id='6']
+ online=yes
+ hotpluggable=no
+ thread-id='284706'
+ enable-id='7'
+ query-cpus-id='6'
+ type='host-arm-cpu'
+ qom_path='/machine/unattached/device[6]'
+ topology: socket='0' cluster_id='1' core='1' thread='0' vcpus='1'
+[vcpu libvirt-id='7']
+ online=no
+ hotpluggable=yes
+ type='host-arm-cpu'
+ topology: socket='0' cluster_id='1' core='1' thread='1' vcpus='1'
+[vcpu libvirt-id='8']
+ online=no
+ hotpluggable=yes
+ type='host-arm-cpu'
+ topology: socket='1' cluster_id='0' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='9']
+ online=no
+ hotpluggable=yes
+ type='host-arm-cpu'
+ topology: socket='1' cluster_id='0' core='0' thread='1' vcpus='1'
+[vcpu libvirt-id='10']
+ online=no
+ hotpluggable=yes
+ type='host-arm-cpu'
+ topology: socket='1' cluster_id='0' core='1' thread='0' vcpus='1'
+[vcpu libvirt-id='11']
+ online=no
+ hotpluggable=yes
+ type='host-arm-cpu'
+ topology: socket='1' cluster_id='0' core='1' thread='1' vcpus='1'
+[vcpu libvirt-id='12']
+ online=no
+ hotpluggable=yes
+ type='host-arm-cpu'
+ topology: socket='1' cluster_id='1' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='13']
+ online=no
+ hotpluggable=yes
+ type='host-arm-cpu'
+ topology: socket='1' cluster_id='1' core='0' thread='1' vcpus='1'
+[vcpu libvirt-id='14']
+ online=no
+ hotpluggable=yes
+ type='host-arm-cpu'
+ topology: socket='1' cluster_id='1' core='1' thread='0' vcpus='1'
+[vcpu libvirt-id='15']
+ online=no
+ hotpluggable=yes
+ type='host-arm-cpu'
+ topology: socket='1' cluster_id='1' core='1' thread='1' vcpus='1'
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index d9ebb429e7..45cee23798 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2262,13 +2262,16 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfo *vcpus,
if (vcpu->qom_path)
virBufferAsprintf(&buf, "qom_path='%s'\n", vcpu->qom_path);
- if (vcpu->socket_id != -1 || vcpu->core_id != -1 ||
+ if (vcpu->socket_id != -1 || vcpu->die_id != -1 ||
+ vcpu->cluster_id != -1 || vcpu->core_id != -1 ||
vcpu->thread_id != -1 || vcpu->vcpus != 0) {
virBufferAddLit(&buf, "topology:");
if (vcpu->socket_id != -1)
virBufferAsprintf(&buf, " socket='%d'", vcpu->socket_id);
if (vcpu->die_id != -1)
virBufferAsprintf(&buf, " die='%d'", vcpu->die_id);
+ if (vcpu->cluster_id != -1)
+ virBufferAsprintf(&buf, " cluster_id='%d'", vcpu->cluster_id);
if (vcpu->core_id != -1)
virBufferAsprintf(&buf, " core='%d'", vcpu->core_id);
if (vcpu->thread_id != -1)
@@ -2919,6 +2922,10 @@ mymain(void)
DO_TEST_CPU_INFO("ppc64-hotplug-4", 24);
DO_TEST_CPU_INFO("ppc64-no-threads", 16);
+ /* aarch64 doesn't support CPU hotplug yet, so the data used in
+ * this test is partially synthetic */
+ DO_TEST_CPU_INFO("aarch64-clusters", 16);
+
DO_TEST_CPU_INFO("s390", 2);
--
2.43.0

View File

@ -1,127 +0,0 @@
From b775a84c8e8d95cb407e56b0ee289b124027f94d Mon Sep 17 00:00:00 2001
Message-ID: <b775a84c8e8d95cb407e56b0ee289b124027f94d.1689974709.git.jdenemar@redhat.com>
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
Date: Wed, 5 Jul 2023 08:20:23 +0200
Subject: [PATCH] tests: remove acpi support from s390x ccw hotplug tests
In newer QEMU libvirt combinations acpi support is no longer tolerated
and ignored. Therfore before upgrading the test capabilities to QEMU
8.1.0 replies removing the acpi feature from the domain XMLs.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit d8e95ab6b7c45acc121746e2e24edcfca3d8d8a0)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2168499
Signed-off-by: Boris Fiuczynski <bfiuczyn@redhat.com>
---
.../qemuhotplug-base-ccw-live+ccw-virtio.xml | 1 -
...lug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml | 1 -
...plug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml | 1 -
.../qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml | 1 -
...tplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml | 1 -
.../qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml | 1 -
.../qemuhotplug-base-ccw-live-with-ccw-virtio.xml | 1 -
tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml | 1 -
8 files changed, 8 deletions(-)
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
index 798a7ab732..6e879ded86 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
@@ -9,7 +9,6 @@
<boot dev='hd'/>
</os>
<features>
- <acpi/>
<apic/>
<pae/>
</features>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml
index 0c76410ff1..86d8da651d 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml
@@ -9,7 +9,6 @@
<boot dev='hd'/>
</os>
<features>
- <acpi/>
<apic/>
<pae/>
</features>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
index 5d2769c420..9b16951e46 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
@@ -9,7 +9,6 @@
<boot dev='hd'/>
</os>
<features>
- <acpi/>
<apic/>
<pae/>
</features>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
index 845c0e1c98..b5292a7ed2 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
@@ -9,7 +9,6 @@
<boot dev='hd'/>
</os>
<features>
- <acpi/>
<apic/>
<pae/>
</features>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
index 29b8fdd6c8..f37868101c 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
@@ -9,7 +9,6 @@
<boot dev='hd'/>
</os>
<features>
- <acpi/>
<apic/>
<pae/>
</features>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
index 29b8fdd6c8..f37868101c 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
@@ -9,7 +9,6 @@
<boot dev='hd'/>
</os>
<features>
- <acpi/>
<apic/>
<pae/>
</features>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml
index 82402ffe1b..42f89a07a2 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml
@@ -9,7 +9,6 @@
<boot dev='hd'/>
</os>
<features>
- <acpi/>
<apic/>
<pae/>
</features>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml
index 6eb60b13a9..f0570b5cf4 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml
@@ -9,7 +9,6 @@
<boot dev='hd'/>
</os>
<features>
- <acpi/>
<apic/>
<pae/>
</features>
--
2.41.0

View File

@ -0,0 +1,81 @@
From 7c634eb7244604521b0f2a00f3a7e2e65a6a8399 Mon Sep 17 00:00:00 2001
Message-ID: <7c634eb7244604521b0f2a00f3a7e2e65a6a8399.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 17:55:06 +0100
Subject: [PATCH] tests: virpcivpd: Remove
'testVirPCIVPDParseVPDStringResource' case
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The test case excercises 'virPCIVPDParseVPDLargeResourceString' which is
also tested by other cases which parse the whole VPD block. Remove the
specific test case as it's not adding any additional value.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 78e17cd550f0ee1f200557d496ef43724319c17e)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
tests/virpcivpdtest.c | 38 --------------------------------------
1 file changed, 38 deletions(-)
diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c
index aadd1b222b..fddb42f52c 100644
--- a/tests/virpcivpdtest.c
+++ b/tests/virpcivpdtest.c
@@ -429,42 +429,6 @@ testPCIVPDGetFieldValueFormat(const void *data G_GNUC_UNUSED)
'Y', 'E', 0x00, \
'R', 'W', 0x02, 0x00, 0x00
-static int
-testVirPCIVPDParseVPDStringResource(const void *opaque G_GNUC_UNUSED)
-{
- VIR_AUTOCLOSE fd = -1;
- uint8_t csum = 0;
- size_t dataLen = 0;
- bool result = false;
-
- g_autoptr(virPCIVPDResource) res = g_new0(virPCIVPDResource, 1);
- const char *expectedValue = "testname";
-
- const uint8_t stringResExample[] = {
- VPD_STRING_RESOURCE_EXAMPLE_DATA
- };
-
- dataLen = G_N_ELEMENTS(stringResExample);
- if ((fd = virCreateAnonymousFile(stringResExample, dataLen)) < 0)
- return -1;
-
- result = virPCIVPDParseVPDLargeResourceString(fd, 0, dataLen, &csum, res);
-
- if (!result) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- "Could not parse the example resource.");
- return -1;
- }
-
- if (STRNEQ(expectedValue, res->name)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "Unexpected string resource value: %s, expected: %s",
- res->name, expectedValue);
- return -1;
- }
- return 0;
-}
-
static int
testVirPCIVPDValidateExampleReadOnlyFields(virPCIVPDResource *res)
{
@@ -964,8 +928,6 @@ mymain(void)
if (virTestRun("Determining a field value format by a key ",
testPCIVPDGetFieldValueFormat, NULL) < 0)
ret = -1;
- if (virTestRun("Parsing VPD string resources ", testVirPCIVPDParseVPDStringResource, NULL) < 0)
- ret = -1;
if (virTestRun("Parsing a VPD resource with a zero-length RW ",
testVirPCIVPDParseZeroLengthRW, NULL) < 0)
ret = -1;
--
2.43.0

View File

@ -0,0 +1,83 @@
From c4b66437f7b829efa0ab6c6007347061ca257719 Mon Sep 17 00:00:00 2001
Message-ID: <c4b66437f7b829efa0ab6c6007347061ca257719.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 14:55:47 +0100
Subject: [PATCH] tests: virpcivpdtest: Remove 'testVirPCIVPDReadVPDBytes' case
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The case checks only the 'virPCIVPDReadVPDBytes' which is also tested
multiple times via 'virPCIVPDParse' as it's used to read the data, thus
having a special case for this is pointless.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 1a994a9dc6424ff7ea9d0f5d325059ffd234408b)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
tests/virpcivpdtest.c | 41 -----------------------------------------
1 file changed, 41 deletions(-)
diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c
index ae5772d3f5..aadd1b222b 100644
--- a/tests/virpcivpdtest.c
+++ b/tests/virpcivpdtest.c
@@ -429,45 +429,6 @@ testPCIVPDGetFieldValueFormat(const void *data G_GNUC_UNUSED)
'Y', 'E', 0x00, \
'R', 'W', 0x02, 0x00, 0x00
-static int
-testVirPCIVPDReadVPDBytes(const void *opaque G_GNUC_UNUSED)
-{
- VIR_AUTOCLOSE fd = -1;
- g_autofree uint8_t *buf = NULL;
- uint8_t csum = 0;
- size_t readBytes = 0;
- size_t dataLen = 0;
-
- /* An example of a valid VPD record with one VPD-R resource and 2 fields. */
- uint8_t fullVPDExample[] = {
- VPD_STRING_RESOURCE_EXAMPLE_HEADER, VPD_STRING_RESOURCE_EXAMPLE_DATA,
- VPD_R_FIELDS_EXAMPLE_HEADER, VPD_R_FIELDS_EXAMPLE_DATA,
- PCI_VPD_RESOURCE_END_VAL
- };
- dataLen = G_N_ELEMENTS(fullVPDExample) - 2;
- buf = g_malloc0(dataLen);
-
- if ((fd = virCreateAnonymousFile(fullVPDExample, dataLen)) < 0)
- return -1;
-
- readBytes = virPCIVPDReadVPDBytes(fd, buf, dataLen, 0, &csum);
-
- if (readBytes != dataLen) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "The number of bytes read %zu is lower than expected %zu ",
- readBytes, dataLen);
- return -1;
- }
-
- if (csum) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "The sum of all VPD bytes up to and including the checksum byte"
- "is equal to zero: 0x%02x", csum);
- return -1;
- }
- return 0;
-}
-
static int
testVirPCIVPDParseVPDStringResource(const void *opaque G_GNUC_UNUSED)
{
@@ -1003,8 +964,6 @@ mymain(void)
if (virTestRun("Determining a field value format by a key ",
testPCIVPDGetFieldValueFormat, NULL) < 0)
ret = -1;
- if (virTestRun("Reading VPD bytes ", testVirPCIVPDReadVPDBytes, NULL) < 0)
- ret = -1;
if (virTestRun("Parsing VPD string resources ", testVirPCIVPDParseVPDStringResource, NULL) < 0)
ret = -1;
if (virTestRun("Parsing a VPD resource with a zero-length RW ",
--
2.43.0

View File

@ -0,0 +1,62 @@
From b28e30bd2b1b40fb3bec3064e883cc9f3abff7c5 Mon Sep 17 00:00:00 2001
Message-ID: <b28e30bd2b1b40fb3bec3064e883cc9f3abff7c5.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 15:53:39 +0100
Subject: [PATCH] util: pcivpd: Refactor virPCIVPDResourceIsValidTextValue
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function is never called with NULL argument. Remove the check and
refactor the rest including the debug statement.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit eb3844009dc3bdd50274954618b8cd9962218317)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
https://issues.redhat.com/browse/RHEL-22400 [9.3.z]
https://issues.redhat.com/browse/RHEL-22399 [9.2.z]
---
src/util/virpcivpd.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 248a9b2790..81c7c317b3 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -175,23 +175,18 @@ virPCIVPDResourceGetFieldValueFormat(const char *keyword)
bool
virPCIVPDResourceIsValidTextValue(const char *value)
{
- size_t i = 0;
+ const char *v;
+ bool ret = true;
- if (value == NULL)
- return false;
-
- /* An empty string is a valid value. */
- if (STREQ(value, ""))
- return true;
-
- while (i < strlen(value)) {
- if (!g_ascii_isprint(value[i])) {
- VIR_DEBUG("The provided value contains non-ASCII printable characters: %s", value);
- return false;
+ for (v = value; *v; v++) {
+ if (!g_ascii_isprint(*v)) {
+ ret = false;
+ break;
}
- ++i;
}
- return true;
+
+ VIR_DEBUG("val='%s' ret='%d'", value, ret);
+ return ret;
}
void
--
2.43.0

View File

@ -0,0 +1,82 @@
From 44db6e745e039dd10c1f4256047eaef8be61ecd6 Mon Sep 17 00:00:00 2001
Message-ID: <44db6e745e039dd10c1f4256047eaef8be61ecd6.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 14:40:38 +0100
Subject: [PATCH] util: pcivpd: Unexport virPCIVPDParseVPDLargeResourceFields
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function is not used in other files.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit d395d7a20f218d5c1af956c70fae43e8e9626436)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/libvirt_private.syms | 1 -
src/util/virpcivpd.c | 15 +--------------
src/util/virpcivpdpriv.h | 3 ---
3 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index dbc4e26d79..89b0d01de6 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3700,7 +3700,6 @@ virVHBAPathExists;
# util/virpcivpd.h
virPCIVPDParse;
-virPCIVPDParseVPDLargeResourceFields;
virPCIVPDParseVPDLargeResourceString;
virPCIVPDResourceCustomCompareIndex;
virPCIVPDResourceCustomFree;
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 373321a836..510be65cb6 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -436,7 +436,7 @@ virPCIVPDReadVPDBytes(int vpdFileFd, uint8_t *buf, size_t count, off_t offset, u
* Returns: a pointer to a VPDResource which needs to be freed by the caller or
* NULL if getting it failed for some reason.
*/
-bool
+static bool
virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t resDataLen,
bool readOnly, uint8_t *csum, virPCIVPDResource *res)
{
@@ -744,19 +744,6 @@ virPCIVPDParseVPDLargeResourceString(int vpdFileFd G_GNUC_UNUSED,
return false;
}
-bool
-virPCIVPDParseVPDLargeResourceFields(int vpdFileFd G_GNUC_UNUSED,
- uint16_t resPos G_GNUC_UNUSED,
- uint16_t resDataLen G_GNUC_UNUSED,
- bool readOnly G_GNUC_UNUSED,
- uint8_t *csum G_GNUC_UNUSED,
- virPCIVPDResource *res G_GNUC_UNUSED)
-{
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("PCI VPD reporting not available on this platform"));
- return false;
-}
-
virPCIVPDResource *
virPCIVPDParse(int vpdFileFd G_GNUC_UNUSED)
{
diff --git a/src/util/virpcivpdpriv.h b/src/util/virpcivpdpriv.h
index 17e6e14ab7..d84f1e9c8a 100644
--- a/src/util/virpcivpdpriv.h
+++ b/src/util/virpcivpdpriv.h
@@ -69,8 +69,5 @@ virPCIVPDResourceCustomCompareIndex(virPCIVPDResourceCustom *a, virPCIVPDResourc
bool
virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const value);
-bool virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t resDataLen,
- bool readOnly, uint8_t *csum, virPCIVPDResource *res);
-
bool virPCIVPDParseVPDLargeResourceString(int vpdFileFd, uint16_t resPos, uint16_t resDataLen,
uint8_t *csum, virPCIVPDResource *res);
--
2.43.0

View File

@ -0,0 +1,63 @@
From 3c01b1ab89ad4c16862582a05394f056616925a2 Mon Sep 17 00:00:00 2001
Message-ID: <3c01b1ab89ad4c16862582a05394f056616925a2.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 16:42:45 +0100
Subject: [PATCH] util: virPCIVPDResourceUpdateKeyword: Remove impossible
checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
All callers satisfy these checks as they are just for programming
errors.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit dd328cd48a469d81e91eaf56fad832aa8bd288d6)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index f198faaf42..3beb405252 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -313,20 +313,7 @@ bool
virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res, const bool readOnly,
const char *const keyword, const char *const value)
{
- if (!res) {
- VIR_INFO("Cannot update the resource: a NULL resource pointer has been provided.");
- return false;
- } else if (!keyword) {
- VIR_INFO("Cannot update the resource: a NULL keyword pointer has been provided.");
- return false;
- }
-
if (readOnly) {
- if (!res->ro) {
- VIR_INFO("Cannot update the read-only keyword: RO section not initialized.");
- return false;
- }
-
if (STREQ("EC", keyword) || STREQ("change_level", keyword)) {
g_free(res->ro->change_level);
res->ro->change_level = g_strdup(value);
@@ -353,13 +340,7 @@ virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res, const bool readOnly,
/* The CP keyword is currently not supported and is skipped. */
return true;
}
-
} else {
- if (!res->rw) {
- VIR_INFO("Cannot update the read-write keyword: read-write section not initialized.");
- return false;
- }
-
if (STREQ("YA", keyword) || STREQ("asset_tag", keyword)) {
g_free(res->rw->asset_tag);
res->rw->asset_tag = g_strdup(value);
--
2.43.0

View File

@ -0,0 +1,143 @@
From 509e56de7e817de1edbd76da806eb79dca6d45e3 Mon Sep 17 00:00:00 2001
Message-ID: <509e56de7e817de1edbd76da806eb79dca6d45e3.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 16:11:24 +0100
Subject: [PATCH] util: virpcivpd: Remove return value from
virPCIVPDResourceCustomUpsertValue
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
None of the callers pass NULL, so the NULL check is pointless. Remove it
an remove the return value.
The function is exported only for use in 'virpcivpdtest' thus marking
the arguments as NONNULL is unnecessary.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit d36da8ea4a107d129bdc701f95b1b131bc3df01d)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 18 ++++--------------
src/util/virpcivpdpriv.h | 2 +-
tests/virpcivpdtest.c | 12 ++++--------
3 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 67065dec46..f198faaf42 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -270,7 +270,7 @@ virPCIVPDResourceCustomCompareIndex(virPCIVPDResourceCustom *a, virPCIVPDResourc
*
* Returns: true if a value has been updated successfully, false otherwise.
*/
-bool
+void
virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const value)
{
g_autoptr(virPCIVPDResourceCustom) custom = NULL;
@@ -278,9 +278,6 @@ virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const
guint pos = 0;
bool found = false;
- if (arr == NULL || value == NULL)
- return false;
-
custom = g_new0(virPCIVPDResourceCustom, 1);
custom->idx = index;
custom->value = g_strdup(value);
@@ -294,7 +291,6 @@ virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const
} else {
g_ptr_array_add(arr, g_steal_pointer(&custom));
}
- return true;
}
/**
@@ -348,9 +344,7 @@ virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res, const bool readOnly,
res->ro->serial_number = g_strdup(value);
return true;
} else if (virPCIVPDResourceIsVendorKeyword(keyword)) {
- if (!virPCIVPDResourceCustomUpsertValue(res->ro->vendor_specific, keyword[1], value)) {
- return false;
- }
+ virPCIVPDResourceCustomUpsertValue(res->ro->vendor_specific, keyword[1], value);
return true;
} else if (STREQ("FG", keyword) || STREQ("LC", keyword) || STREQ("PG", keyword)) {
/* Legacy PICMIG keywords are skipped on purpose. */
@@ -371,14 +365,10 @@ virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res, const bool readOnly,
res->rw->asset_tag = g_strdup(value);
return true;
} else if (virPCIVPDResourceIsVendorKeyword(keyword)) {
- if (!virPCIVPDResourceCustomUpsertValue(res->rw->vendor_specific, keyword[1], value)) {
- return false;
- }
+ virPCIVPDResourceCustomUpsertValue(res->rw->vendor_specific, keyword[1], value);
return true;
} else if (virPCIVPDResourceIsSystemKeyword(keyword)) {
- if (!virPCIVPDResourceCustomUpsertValue(res->rw->system_specific, keyword[1], value)) {
- return false;
- }
+ virPCIVPDResourceCustomUpsertValue(res->rw->system_specific, keyword[1], value);
return true;
}
}
diff --git a/src/util/virpcivpdpriv.h b/src/util/virpcivpdpriv.h
index 617991930b..f26b64139d 100644
--- a/src/util/virpcivpdpriv.h
+++ b/src/util/virpcivpdpriv.h
@@ -66,5 +66,5 @@ bool virPCIVPDResourceIsValidTextValue(const char *value);
gboolean
virPCIVPDResourceCustomCompareIndex(virPCIVPDResourceCustom *a, virPCIVPDResourceCustom *b);
-bool
+void
virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const value);
diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c
index fddb42f52c..8a2f337e85 100644
--- a/tests/virpcivpdtest.c
+++ b/tests/virpcivpdtest.c
@@ -244,8 +244,7 @@ testPCIVPDResourceCustomUpsertValue(const void *data G_GNUC_UNUSED)
{
g_autoptr(GPtrArray) arr = g_ptr_array_new_full(0, (GDestroyNotify)virPCIVPDResourceCustomFree);
virPCIVPDResourceCustom *custom = NULL;
- if (!virPCIVPDResourceCustomUpsertValue(arr, 'A', "testval"))
- return -1;
+ virPCIVPDResourceCustomUpsertValue(arr, 'A', "testval");
if (arr->len != 1)
return -1;
@@ -255,8 +254,7 @@ testPCIVPDResourceCustomUpsertValue(const void *data G_GNUC_UNUSED)
return -1;
/* Idempotency */
- if (!virPCIVPDResourceCustomUpsertValue(arr, 'A', "testval"))
- return -1;
+ virPCIVPDResourceCustomUpsertValue(arr, 'A', "testval");
if (arr->len != 1)
return -1;
@@ -266,8 +264,7 @@ testPCIVPDResourceCustomUpsertValue(const void *data G_GNUC_UNUSED)
return -1;
/* Existing value updates. */
- if (!virPCIVPDResourceCustomUpsertValue(arr, 'A', "testvalnew"))
- return -1;
+ virPCIVPDResourceCustomUpsertValue(arr, 'A', "testvalnew");
if (arr->len != 1)
return -1;
@@ -277,8 +274,7 @@ testPCIVPDResourceCustomUpsertValue(const void *data G_GNUC_UNUSED)
return -1;
/* Inserting multiple values */
- if (!virPCIVPDResourceCustomUpsertValue(arr, '1', "42"))
- return -1;
+ virPCIVPDResourceCustomUpsertValue(arr, '1', "42");
if (arr->len != 2)
return -1;
--
2.43.0

View File

@ -0,0 +1,206 @@
From 1fe79c11dab8f390efd2035ba20c194987ba4dee Mon Sep 17 00:00:00 2001
Message-ID: <1fe79c11dab8f390efd2035ba20c194987ba4dee.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 17:15:10 +0100
Subject: [PATCH] util: virpcivpd: Remove return value from
virPCIVPDResourceUpdateKeyword
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function always succeeded and after the removal of programing error
checks doesn't even have a 'return false' case. Additionally one of the
tests in 'virpcivpdtest' tested that this function never failed on wrong
data. Embrace this logic and remove the return value and adjust logging
to VIR_DEBUG level to avoid spamming logs.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 9aa303a948a3eb98b727a333e2571d19ae0a81ce)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 31 +++++++++++--------------------
src/util/virpcivpd.h | 8 +++++---
tests/virpcivpdtest.c | 38 ++++++++++++++++++--------------------
3 files changed, 34 insertions(+), 43 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 3beb405252..0021a88f2d 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -307,54 +307,48 @@ virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const
* used in XML elements. For vendor-specific and system-specific keywords only V%s and Y%s
* (except "YA" which is an asset tag) formatted values are accepted.
*
- * Returns: true if a keyword has been updated successfully, false otherwise.
+ * Unknown or malformed values are ignored.
*/
-bool
-virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res, const bool readOnly,
- const char *const keyword, const char *const value)
+void
+virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res,
+ const bool readOnly,
+ const char *const keyword,
+ const char *const value)
{
if (readOnly) {
if (STREQ("EC", keyword) || STREQ("change_level", keyword)) {
g_free(res->ro->change_level);
res->ro->change_level = g_strdup(value);
- return true;
} else if (STREQ("MN", keyword) || STREQ("manufacture_id", keyword)) {
g_free(res->ro->manufacture_id);
res->ro->manufacture_id = g_strdup(value);
- return true;
} else if (STREQ("PN", keyword) || STREQ("part_number", keyword)) {
g_free(res->ro->part_number);
res->ro->part_number = g_strdup(value);
- return true;
} else if (STREQ("SN", keyword) || STREQ("serial_number", keyword)) {
g_free(res->ro->serial_number);
res->ro->serial_number = g_strdup(value);
- return true;
} else if (virPCIVPDResourceIsVendorKeyword(keyword)) {
virPCIVPDResourceCustomUpsertValue(res->ro->vendor_specific, keyword[1], value);
- return true;
} else if (STREQ("FG", keyword) || STREQ("LC", keyword) || STREQ("PG", keyword)) {
/* Legacy PICMIG keywords are skipped on purpose. */
- return true;
} else if (STREQ("CP", keyword)) {
/* The CP keyword is currently not supported and is skipped. */
- return true;
+ } else {
+ VIR_DEBUG("unhandled PCI VPD r/o keyword '%s'(val='%s')", keyword, value);
}
} else {
if (STREQ("YA", keyword) || STREQ("asset_tag", keyword)) {
g_free(res->rw->asset_tag);
res->rw->asset_tag = g_strdup(value);
- return true;
} else if (virPCIVPDResourceIsVendorKeyword(keyword)) {
virPCIVPDResourceCustomUpsertValue(res->rw->vendor_specific, keyword[1], value);
- return true;
} else if (virPCIVPDResourceIsSystemKeyword(keyword)) {
virPCIVPDResourceCustomUpsertValue(res->rw->system_specific, keyword[1], value);
- return true;
+ } else {
+ VIR_DEBUG("unhandled PCI VPD r/w keyword '%s'(val='%s')", keyword, value);
}
}
- VIR_WARN("Tried to update an unsupported keyword %s: skipping.", keyword);
- return true;
}
#ifdef __linux__
@@ -527,10 +521,7 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
res->rw = virPCIVPDResourceRWNew();
}
/* The field format, keyword and value are determined. Attempt to update the resource. */
- if (!virPCIVPDResourceUpdateKeyword(res, readOnly, fieldKeyword, fieldValue)) {
- VIR_INFO("Could not update the VPD resource keyword: %s", fieldKeyword);
- return false;
- }
+ virPCIVPDResourceUpdateKeyword(res, readOnly, fieldKeyword, fieldValue);
}
/* May have exited the loop prematurely in case RV or RW were encountered and
diff --git a/src/util/virpcivpd.h b/src/util/virpcivpd.h
index 9bfec43e03..d8d3dd3075 100644
--- a/src/util/virpcivpd.h
+++ b/src/util/virpcivpd.h
@@ -67,9 +67,11 @@ void virPCIVPDResourceRWFree(virPCIVPDResourceRW *rw);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virPCIVPDResourceRW, virPCIVPDResourceRWFree);
-bool
-virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res, const bool readOnly,
- const char *const keyword, const char *const value);
+void
+virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res,
+ const bool readOnly,
+ const char *const keyword,
+ const char *const value);
void virPCIVPDResourceCustomFree(virPCIVPDResourceCustom *custom);
diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c
index 20545759d5..a6311bfe76 100644
--- a/tests/virpcivpdtest.c
+++ b/tests/virpcivpdtest.c
@@ -84,17 +84,15 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED)
/* Update keywords one by one and compare actual values with the expected ones. */
for (i = 0; i < numROCases; ++i) {
- if (!virPCIVPDResourceUpdateKeyword(res, true,
- readOnlyCases[i].keyword,
- readOnlyCases[i].value))
- return -1;
+ virPCIVPDResourceUpdateKeyword(res, true,
+ readOnlyCases[i].keyword,
+ readOnlyCases[i].value);
if (STRNEQ(readOnlyCases[i].value, *readOnlyCases[i].actual))
return -1;
}
/* Do a basic vendor field check. */
- if (!virPCIVPDResourceUpdateKeyword(res, true, "V0", "vendor0"))
- return -1;
+ virPCIVPDResourceUpdateKeyword(res, true, "V0", "vendor0");
if (res->ro->vendor_specific->len != 1)
return -1;
@@ -105,25 +103,23 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED)
/* Make sure unsupported RO keyword updates are not fatal. */
for (i = 0; i < numUnsupportedCases; ++i) {
- if (!virPCIVPDResourceUpdateKeyword(res, true,
- unsupportedFieldCases[i].keyword,
- unsupportedFieldCases[i].value))
- return -1;
+ virPCIVPDResourceUpdateKeyword(res, true,
+ unsupportedFieldCases[i].keyword,
+ unsupportedFieldCases[i].value);
}
/* Initialize RW */
res->rw = g_steal_pointer(&rw);
- if (!virPCIVPDResourceUpdateKeyword(res, false, "YA", "tag1")
- || STRNEQ(res->rw->asset_tag, "tag1"))
+ virPCIVPDResourceUpdateKeyword(res, false, "YA", "tag1");
+ if (STRNEQ(res->rw->asset_tag, "tag1"))
return -1;
- if (!virPCIVPDResourceUpdateKeyword(res, false, "asset_tag", "tag2")
- || STRNEQ(res->rw->asset_tag, "tag2"))
+ virPCIVPDResourceUpdateKeyword(res, false, "asset_tag", "tag2");
+ if (STRNEQ(res->rw->asset_tag, "tag2"))
return -1;
/* Do a basic system field check. */
- if (!virPCIVPDResourceUpdateKeyword(res, false, "Y0", "system0"))
- return -1;
+ virPCIVPDResourceUpdateKeyword(res, false, "Y0", "system0");
if (res->rw->system_specific->len != 1)
return -1;
@@ -134,10 +130,12 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED)
/* Make sure unsupported RW keyword updates are not fatal. */
for (i = 0; i < numUnsupportedCases; ++i) {
- if (!virPCIVPDResourceUpdateKeyword(res, false,
- unsupportedFieldCases[i].keyword,
- unsupportedFieldCases[i].value))
- return -1;
+ /* This test is deliberately left in despite
+ * virPCIVPDResourceUpdateKeyword always succeeding to prevent
+ * possible regressions if the function is ever rewritten */
+ virPCIVPDResourceUpdateKeyword(res, false,
+ unsupportedFieldCases[i].keyword,
+ unsupportedFieldCases[i].value);
}
--
2.43.0

View File

@ -0,0 +1,78 @@
From 5c7b4d446b4436deef45176daeb33827007a8ef2 Mon Sep 17 00:00:00 2001
Message-ID: <5c7b4d446b4436deef45176daeb33827007a8ef2.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 17:58:17 +0100
Subject: [PATCH] util: virpcivpd: Unexport
'virPCIVPDParseVPDLargeResourceString'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 810a3ca980801a57298c245c65aa558eda5fb9d8)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/libvirt_private.syms | 1 -
src/util/virpcivpd.c | 14 +-------------
src/util/virpcivpdpriv.h | 3 ---
3 files changed, 1 insertion(+), 17 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 89b0d01de6..035f8c7b5d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3700,7 +3700,6 @@ virVHBAPathExists;
# util/virpcivpd.h
virPCIVPDParse;
-virPCIVPDParseVPDLargeResourceString;
virPCIVPDResourceCustomCompareIndex;
virPCIVPDResourceCustomFree;
virPCIVPDResourceCustomUpsertValue;
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 510be65cb6..b303e161ae 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -595,7 +595,7 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
* Returns: a pointer to a VPDResource which needs to be freed by the caller or
* NULL if getting it failed for some reason.
*/
-bool
+static bool
virPCIVPDParseVPDLargeResourceString(int vpdFileFd, uint16_t resPos,
uint16_t resDataLen, uint8_t *csum, virPCIVPDResource *res)
{
@@ -732,18 +732,6 @@ virPCIVPDParse(int vpdFileFd)
#else /* ! __linux__ */
-bool
-virPCIVPDParseVPDLargeResourceString(int vpdFileFd G_GNUC_UNUSED,
- uint16_t resPos G_GNUC_UNUSED,
- uint16_t resDataLen G_GNUC_UNUSED,
- uint8_t *csum G_GNUC_UNUSED,
- virPCIVPDResource *res G_GNUC_UNUSED)
-{
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("PCI VPD reporting not available on this platform"));
- return false;
-}
-
virPCIVPDResource *
virPCIVPDParse(int vpdFileFd G_GNUC_UNUSED)
{
diff --git a/src/util/virpcivpdpriv.h b/src/util/virpcivpdpriv.h
index d84f1e9c8a..617991930b 100644
--- a/src/util/virpcivpdpriv.h
+++ b/src/util/virpcivpdpriv.h
@@ -68,6 +68,3 @@ virPCIVPDResourceCustomCompareIndex(virPCIVPDResourceCustom *a, virPCIVPDResourc
bool
virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const value);
-
-bool virPCIVPDParseVPDLargeResourceString(int vpdFileFd, uint16_t resPos, uint16_t resDataLen,
- uint8_t *csum, virPCIVPDResource *res);
--
2.43.0

View File

@ -0,0 +1,82 @@
From 225998619d4e6fb87e04d48c74b1320663543312 Mon Sep 17 00:00:00 2001
Message-ID: <225998619d4e6fb87e04d48c74b1320663543312.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 14:58:52 +0100
Subject: [PATCH] util: virpcivpd: Unexport 'virPCIVPDReadVPDBytes'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function is no longer used outside of virpcivpd.c
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 4d229ef4404f277004767bec444448fa83e8be99)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/libvirt_private.syms | 1 -
src/util/virpcivpd.c | 14 +-------------
src/util/virpcivpdpriv.h | 3 ---
3 files changed, 1 insertion(+), 17 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fc26109029..dbc4e26d79 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3702,7 +3702,6 @@ virVHBAPathExists;
virPCIVPDParse;
virPCIVPDParseVPDLargeResourceFields;
virPCIVPDParseVPDLargeResourceString;
-virPCIVPDReadVPDBytes;
virPCIVPDResourceCustomCompareIndex;
virPCIVPDResourceCustomFree;
virPCIVPDResourceCustomUpsertValue;
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 81c7c317b3..373321a836 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -401,7 +401,7 @@ virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res, const bool readOnly,
* descriptor, it is reported and -1 is returned to the caller. If EOF is occurred, 0 is returned
* to the caller.
*/
-size_t
+static size_t
virPCIVPDReadVPDBytes(int vpdFileFd, uint8_t *buf, size_t count, off_t offset, uint8_t *csum)
{
ssize_t numRead = pread(vpdFileFd, buf, count, offset);
@@ -732,18 +732,6 @@ virPCIVPDParse(int vpdFileFd)
#else /* ! __linux__ */
-size_t
-virPCIVPDReadVPDBytes(int vpdFileFd G_GNUC_UNUSED,
- uint8_t *buf G_GNUC_UNUSED,
- size_t count G_GNUC_UNUSED,
- off_t offset G_GNUC_UNUSED,
- uint8_t *csum G_GNUC_UNUSED)
-{
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("PCI VPD reporting not available on this platform"));
- return 0;
-}
-
bool
virPCIVPDParseVPDLargeResourceString(int vpdFileFd G_GNUC_UNUSED,
uint16_t resPos G_GNUC_UNUSED,
diff --git a/src/util/virpcivpdpriv.h b/src/util/virpcivpdpriv.h
index 0f565f81ae..17e6e14ab7 100644
--- a/src/util/virpcivpdpriv.h
+++ b/src/util/virpcivpdpriv.h
@@ -69,9 +69,6 @@ virPCIVPDResourceCustomCompareIndex(virPCIVPDResourceCustom *a, virPCIVPDResourc
bool
virPCIVPDResourceCustomUpsertValue(GPtrArray *arr, char index, const char *const value);
-size_t
-virPCIVPDReadVPDBytes(int vpdFileFd, uint8_t *buf, size_t count, off_t offset, uint8_t *csum);
-
bool virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t resDataLen,
bool readOnly, uint8_t *csum, virPCIVPDResource *res);
--
2.43.0

View File

@ -0,0 +1,64 @@
From 9f199b64bd22f4f740441bb690d9bd9231e8efc0 Mon Sep 17 00:00:00 2001
Message-ID: <9f199b64bd22f4f740441bb690d9bd9231e8efc0.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 16 Jan 2024 15:10:55 +0100
Subject: [PATCH] util: virtportallocator: Add VIR_DEBUG statements for port
allocations and release
Add a few debug statements to be able to trace lifetime of a
reserved/allocated port.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 19eaa854386cc5bfc0f9ed15ac2a0937cb3a4421)
https://issues.redhat.com/browse/RHEL-21543
---
src/util/virportallocator.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/util/virportallocator.c b/src/util/virportallocator.c
index 6d6f99778e..70393d87ee 100644
--- a/src/util/virportallocator.c
+++ b/src/util/virportallocator.c
@@ -29,9 +29,12 @@
#include "virthread.h"
#include "virerror.h"
#include "virutil.h"
+#include "virlog.h"
#define VIR_FROM_THIS VIR_FROM_NONE
+VIR_LOG_INIT("util.virportallocator");
+
#define VIR_PORT_ALLOCATOR_NUM_PORTS 65536
typedef struct _virPortAllocator virPortAllocator;
@@ -228,6 +231,8 @@ virPortAllocatorAcquire(const virPortAllocatorRange *range,
return -1;
}
*port = i;
+ VIR_DEBUG("port='%u'", *port);
+
return 0;
}
}
@@ -247,6 +252,8 @@ virPortAllocatorRelease(unsigned short port)
if (!pa)
return -1;
+ VIR_DEBUG("port='%u'", port);
+
if (!port)
return 0;
@@ -265,6 +272,8 @@ virPortAllocatorSetUsed(unsigned short port)
if (!pa)
return -1;
+ VIR_DEBUG("port='%u'", port);
+
if (!port)
return 0;
--
2.43.0

View File

@ -0,0 +1,94 @@
From dd11b0a672feb5932548aa72c4db859889401587 Mon Sep 17 00:00:00 2001
Message-ID: <dd11b0a672feb5932548aa72c4db859889401587.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 30 Jan 2024 17:11:37 +0100
Subject: [PATCH] virNodeDeviceCapVPDFormat: Properly escape system-originated
strings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Similarly to previous commit other specific fields which come from the
system data and aren't sanitized enough to be safe for XML were also
formatted via virBufferAsprintf.
Other static and safe strings used virBufferEscapeString instead of
virBufferAddLit.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 2ccac1e42f34404e3a5af22671a31fa1dca94e94)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
https://issues.redhat.com/browse/RHEL-22400 [9.3.z]
https://issues.redhat.com/browse/RHEL-22399 [9.2.z]
---
src/conf/node_device_conf.c | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 87c046e571..95de77abe9 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -270,14 +270,6 @@ virNodeDeviceCapVPDFormatCustomSystemField(virPCIVPDResourceCustom *field, virBu
virNodeDeviceCapVPDFormatCustomField(buf, "system_field", field);
}
-static inline void
-virNodeDeviceCapVPDFormatRegularField(virBuffer *buf, const char *keyword, const char *value)
-{
- if (keyword == NULL || value == NULL)
- return;
-
- virBufferAsprintf(buf, "<%s>%s</%s>\n", keyword, value, keyword);
-}
static void
virNodeDeviceCapVPDFormat(virBuffer *buf, virPCIVPDResource *res)
@@ -290,31 +282,33 @@ virNodeDeviceCapVPDFormat(virBuffer *buf, virPCIVPDResource *res)
virBufferEscapeString(buf, "<name>%s</name>\n", res->name);
if (res->ro != NULL) {
- virBufferEscapeString(buf, "<fields access='%s'>\n", "readonly");
-
+ virBufferAddLit(buf, "<fields access='readonly'>\n");
virBufferAdjustIndent(buf, 2);
- virNodeDeviceCapVPDFormatRegularField(buf, "change_level", res->ro->change_level);
- virNodeDeviceCapVPDFormatRegularField(buf, "manufacture_id", res->ro->manufacture_id);
- virNodeDeviceCapVPDFormatRegularField(buf, "part_number", res->ro->part_number);
- virNodeDeviceCapVPDFormatRegularField(buf, "serial_number", res->ro->serial_number);
+
+ virBufferEscapeString(buf, "<change_level>%s</change_level>\n", res->ro->change_level);
+ virBufferEscapeString(buf, "<manufacture_id>%s</manufacture_id>\n", res->ro->manufacture_id);
+ virBufferEscapeString(buf, "<part_number>%s</part_number>\n", res->ro->part_number);
+ virBufferEscapeString(buf, "<serial_number>%s</serial_number>\n", res->ro->serial_number);
+
g_ptr_array_foreach(res->ro->vendor_specific,
(GFunc)virNodeDeviceCapVPDFormatCustomVendorField, buf);
- virBufferAdjustIndent(buf, -2);
+ virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</fields>\n");
}
if (res->rw != NULL) {
- virBufferEscapeString(buf, "<fields access='%s'>\n", "readwrite");
-
+ virBufferAddLit(buf, "<fields access='readwrite'>\n");
virBufferAdjustIndent(buf, 2);
- virNodeDeviceCapVPDFormatRegularField(buf, "asset_tag", res->rw->asset_tag);
+
+ virBufferEscapeString(buf, "<asset_tag>%s</asset_tag>\n", res->rw->asset_tag);
+
g_ptr_array_foreach(res->rw->vendor_specific,
(GFunc)virNodeDeviceCapVPDFormatCustomVendorField, buf);
g_ptr_array_foreach(res->rw->system_specific,
(GFunc)virNodeDeviceCapVPDFormatCustomSystemField, buf);
- virBufferAdjustIndent(buf, -2);
+ virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</fields>\n");
}
--
2.43.0

View File

@ -0,0 +1,80 @@
From 32fe728dafc85c31b34f669b11264967bfc553dd Mon Sep 17 00:00:00 2001
Message-ID: <32fe728dafc85c31b34f669b11264967bfc553dd.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 15:15:03 +0100
Subject: [PATCH] virNodeDeviceCapVPDFormatCustom*: Escape unsanitized strings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The custom field data is taken from PCI device data which can contain
any printable characters, and thus must be escaped when putting into
XML.
Originally, based on the comment and XML schema which was fixed in
previous commits the idea seemed to be that the parser would validate
that only characters which don't break the XML would be present but that
didn't seem to materialize.
Switch to proper escaping of the XML.
Fixes: 3954378d06a
Resolves: https://issues.redhat.com/browse/RHEL-22314
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 5373b8c02ce44d0284bc9c60b3b7bc12bff2f867)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
https://issues.redhat.com/browse/RHEL-22400 [9.3.z]
https://issues.redhat.com/browse/RHEL-22399 [9.2.z]
---
src/conf/node_device_conf.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 4826be6f42..87c046e571 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -242,23 +242,32 @@ virNodeDeviceCapMdevTypesFormat(virBuffer *buf,
}
static void
-virNodeDeviceCapVPDFormatCustomVendorField(virPCIVPDResourceCustom *field, virBuffer *buf)
+virNodeDeviceCapVPDFormatCustomField(virBuffer *buf,
+ const char *fieldtype,
+ virPCIVPDResourceCustom *field)
{
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) content = VIR_BUFFER_INITIALIZER;
+
if (field == NULL || field->value == NULL)
return;
- virBufferAsprintf(buf, "<vendor_field index='%c'>%s</vendor_field>\n", field->idx,
- field->value);
+ virBufferAsprintf(&attrBuf, " index='%c'", field->idx);
+ virBufferEscapeString(&content, "%s", field->value);
+
+ virXMLFormatElementInternal(buf, fieldtype, &attrBuf, &content, false, false);
}
static void
-virNodeDeviceCapVPDFormatCustomSystemField(virPCIVPDResourceCustom *field, virBuffer *buf)
+virNodeDeviceCapVPDFormatCustomVendorField(virPCIVPDResourceCustom *field, virBuffer *buf)
{
- if (field == NULL || field->value == NULL)
- return;
+ virNodeDeviceCapVPDFormatCustomField(buf, "vendor_field", field);
+}
- virBufferAsprintf(buf, "<system_field index='%c'>%s</system_field>\n", field->idx,
- field->value);
+static void
+virNodeDeviceCapVPDFormatCustomSystemField(virPCIVPDResourceCustom *field, virBuffer *buf)
+{
+ virNodeDeviceCapVPDFormatCustomField(buf, "system_field", field);
}
static inline void
--
2.43.0

View File

@ -0,0 +1,74 @@
From 9de66ba6bd07c0c5d674be4dadec1f83a39d1533 Mon Sep 17 00:00:00 2001
Message-ID: <9de66ba6bd07c0c5d674be4dadec1f83a39d1533.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 30 Jan 2024 17:41:44 +0100
Subject: [PATCH] virNodeDeviceCapVPDParseXML: Fix error reporting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Don't overwrite already reported errors and improve parsing of
attributes.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit dd36db2607e40d0df986108224563295b79d969c)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/conf/node_device_conf.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 0f2c341967..c68ac3af78 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1059,11 +1059,11 @@ virNodeDeviceCapVPDParseXML(xmlXPathContextPtr ctxt, virPCIVPDResource **res)
if (!(newres->name = virXPathString("string(./name)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
- _("Could not read a device name from the <name> element"));
+ _("Could not read a device name from the <name> element"));
return -1;
}
- if ((nfields = virXPathNodeSet("./fields[@access]", ctxt, &nodes)) < 0)
+ if ((nfields = virXPathNodeSet("./fields", ctxt, &nodes)) < 0)
return -1;
for (i = 0; i < nfields; i++) {
@@ -1071,27 +1071,19 @@ virNodeDeviceCapVPDParseXML(xmlXPathContextPtr ctxt, virPCIVPDResource **res)
VIR_XPATH_NODE_AUTORESTORE(ctxt);
ctxt->node = nodes[i];
- if (!(access = virXPathString("string(./@access[1])", ctxt))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("VPD fields access type parsing has failed"));
+
+ if (!(access = virXMLPropStringRequired(nodes[i], "access")))
return -1;
- }
if (STREQ(access, "readonly")) {
- if (virNodeDeviceCapVPDParseReadOnlyFields(ctxt, newres) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("Could not parse %1$s VPD resource fields"), access);
+ if (virNodeDeviceCapVPDParseReadOnlyFields(ctxt, newres) < 0)
return -1;
- }
} else if (STREQ(access, "readwrite")) {
- if (virNodeDeviceCapVPDParseReadWriteFields(ctxt, newres) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("Could not parse %1$s VPD resource fields"), access);
+ if (virNodeDeviceCapVPDParseReadWriteFields(ctxt, newres) < 0)
return -1;
- }
} else {
virReportError(VIR_ERR_XML_ERROR,
- _("Unsupported VPD field access type specified %1$s"),
+ _("Unsupported VPD field access type '%1$s'"),
access);
return -1;
}
--
2.43.0

View File

@ -0,0 +1,69 @@
From b025fc09fc5eff84bacea27f99837a013f810d60 Mon Sep 17 00:00:00 2001
Message-ID: <b025fc09fc5eff84bacea27f99837a013f810d60.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 16:59:20 +0100
Subject: [PATCH] virPCIDeviceGetVPD: Fix multiple error handling bugs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- fix passing of 'errno' to 'virReportSystemError'
The 'open' syscall returns '-1' and sets 'errno' on failure. The code
passed '-fd' as 'errno' rather than errno itself, thus always reporting
EPERM.
- don't overwrite errors when closing FD
Use VIR_AUTOCLOSE to avoid overwriting the errors from virPCIVPDParse.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit bac86dd36e2c8c56e3d5678a94fc69f8e41a7d35)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpci.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 99e6e6cbb1..780b4f9eec 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -3103,28 +3103,21 @@ virPCIDeviceHasVPD(virPCIDevice *dev)
virPCIVPDResource *
virPCIDeviceGetVPD(virPCIDevice *dev)
{
- g_autofree char *vpdPath = NULL;
- int fd;
- g_autoptr(virPCIVPDResource) res = NULL;
+ g_autofree char *vpdPath = virPCIFile(dev->name, "vpd");
+ VIR_AUTOCLOSE fd = -1;
- vpdPath = virPCIFile(dev->name, "vpd");
if (!virPCIDeviceHasVPD(dev)) {
virReportError(VIR_ERR_INTERNAL_ERROR, _("Device %1$s does not have a VPD"),
- virPCIDeviceGetName(dev));
- return NULL;
- }
- if ((fd = open(vpdPath, O_RDONLY)) < 0) {
- virReportSystemError(-fd, _("Failed to open a VPD file '%1$s'"), vpdPath);
+ virPCIDeviceGetName(dev));
return NULL;
}
- res = virPCIVPDParse(fd);
- if (VIR_CLOSE(fd) < 0) {
- virReportSystemError(errno, _("Unable to close the VPD file, fd: %1$d"), fd);
+ if ((fd = open(vpdPath, O_RDONLY)) < 0) {
+ virReportSystemError(errno, _("Failed to open a VPD file '%1$s'"), vpdPath);
return NULL;
}
- return g_steal_pointer(&res);
+ return virPCIVPDParse(fd);
}
#else
--
2.43.0

View File

@ -0,0 +1,52 @@
From 1af80ce930b188e4410f66bdfee71ca91e38d5a3 Mon Sep 17 00:00:00 2001
Message-ID: <1af80ce930b188e4410f66bdfee71ca91e38d5a3.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 22:32:33 +0100
Subject: [PATCH] virPCIDeviceGetVPD: Handle errors in callers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Until now 'virPCIDeviceGetVPD' couldn't reallistically raise an error,
but that will change. Handle the errors by either resetting it if we'd
be ignoring it or forward it.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit e1dc851e7cbc4a525b095b0dd4fdc779a882b19c)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/conf/node_device_conf.c | 2 ++
tests/virpcitest.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index c68ac3af78..b8c91d6ecd 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -3052,6 +3052,8 @@ virNodeDeviceGetPCIVPDDynamicCap(virNodeDevCapPCIDev *devCapPCIDev)
if ((res = virPCIDeviceGetVPD(pciDev))) {
devCapPCIDev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VPD;
devCapPCIDev->vpd = g_steal_pointer(&res);
+ } else {
+ virResetLastError();
}
}
return 0;
diff --git a/tests/virpcitest.c b/tests/virpcitest.c
index d69a1b5118..017c283a44 100644
--- a/tests/virpcitest.c
+++ b/tests/virpcitest.c
@@ -344,7 +344,8 @@ testVirPCIDeviceGetVPD(const void *opaque)
if (!dev)
return -1;
- res = virPCIDeviceGetVPD(dev);
+ if (!(res = virPCIDeviceGetVPD(dev)))
+ return -1;
/* Only basic checks - full parser validation is done elsewhere. */
if (res->ro == NULL)
--
2.43.0

View File

@ -0,0 +1,52 @@
From ca12c899e642a82525e038df818ade15142de02f Mon Sep 17 00:00:00 2001
Message-ID: <ca12c899e642a82525e038df818ade15142de02f.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 16:53:27 +0100
Subject: [PATCH] virPCIDeviceHasVPD: Refactor "debug" messages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A checker function should not raise VIR_INFO or VIR_WARN messages
especially if they contain information useful only for debugging.
Turn the message into a VIR_DEBUG with universal meaning.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3ca1079318b8047a32ae05e1c6e5fb2dac9fc719)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpci.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 6c04e57038..99e6e6cbb1 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -3081,17 +3081,12 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
bool
virPCIDeviceHasVPD(virPCIDevice *dev)
{
- g_autofree char *vpdPath = NULL;
+ g_autofree char *vpdPath = virPCIFile(dev->name, "vpd");
+ bool ret = virFileIsRegular(vpdPath);
- vpdPath = virPCIFile(dev->name, "vpd");
- if (!virFileExists(vpdPath)) {
- VIR_INFO("Device VPD file does not exist %s", vpdPath);
- return false;
- } else if (!virFileIsRegular(vpdPath)) {
- VIR_WARN("VPD path does not point to a regular file %s", vpdPath);
- return false;
- }
- return true;
+ VIR_DEBUG("path='%s', exists='%d'", vpdPath, ret);
+
+ return ret;
}
/**
--
2.43.0

View File

@ -0,0 +1,101 @@
From b94d438cdd0c7a91885c204fdddece35b27bcccb Mon Sep 17 00:00:00 2001
Message-ID: <b94d438cdd0c7a91885c204fdddece35b27bcccb.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 17:12:43 +0100
Subject: [PATCH] virPCIVPDParse: Do reasonable error reporting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Remove the wannabe error reporting via 'VIR_DEBUG/VIR_INFO' in favor of
proper errors.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit f85a382a0e709afea3a4021de593b1679553a35a)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 4a440c2aea..16df468875 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -616,7 +616,7 @@ virPCIVPDParse(int vpdFileFd)
uint16_t resPos = 0, resDataLen;
uint8_t tag = 0;
- bool endResReached = false, hasReadOnly = false;
+ bool hasReadOnly = false;
g_autoptr(virPCIVPDResource) res = g_new0(virPCIVPDResource, 1);
@@ -628,9 +628,8 @@ virPCIVPDParse(int vpdFileFd)
/* 0x80 == 0b10000000 - the large resource data type flag. */
if (tag & PCI_VPD_LARGE_RESOURCE_FLAG) {
if (resPos > PCI_VPD_ADDR_MASK + 1 - 3) {
- /* Bail if the large resource starts at the position
- * where the end tag should be. */
- break;
+ /* Bail if the large resource starts at the position where the end tag should be. */
+ goto malformed;
}
/* Read the two length bytes of the large resource record. */
@@ -649,14 +648,21 @@ virPCIVPDParse(int vpdFileFd)
/* Change the position to the byte past the byte containing tag and length bits. */
resPos += 1;
}
+
if (tag == PCI_VPD_RESOURCE_END_TAG) {
/* Stop VPD traversal since the end tag was encountered. */
- endResReached = true;
- break;
+ if (!hasReadOnly) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to read the PCI VPD data: missing read-only section"));
+ return NULL;
+ }
+
+ return g_steal_pointer(&res);
}
+
if (resDataLen > PCI_VPD_ADDR_MASK + 1 - resPos) {
/* Bail if the resource is too long to fit into the VPD address space. */
- break;
+ goto malformed;
}
switch (tag) {
@@ -686,22 +692,16 @@ virPCIVPDParse(int vpdFileFd)
/* While we cannot parse unknown resource types, they can still be skipped
* based on the header and data length. */
VIR_DEBUG("Encountered an unexpected VPD resource tag: %#x", tag);
- resPos += resDataLen;
- continue;
}
/* Continue processing other resource records. */
resPos += resDataLen;
}
- if (!hasReadOnly) {
- VIR_DEBUG("Encountered an invalid VPD: does not have a VPD-R record");
- return NULL;
- } else if (!endResReached) {
- /* Does not have an end tag. */
- VIR_DEBUG("Encountered an invalid VPD");
- return NULL;
- }
- return g_steal_pointer(&res);
+
+ malformed:
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to read the PCI VPD data: malformed data"));
+ return NULL;
}
#else /* ! __linux__ */
--
2.43.0

View File

@ -0,0 +1,65 @@
From 9f0e2b76c89b692aa935c76f9d21012c50e4575d Mon Sep 17 00:00:00 2001
Message-ID: <9f0e2b76c89b692aa935c76f9d21012c50e4575d.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 30 Jan 2024 15:02:39 +0100
Subject: [PATCH] virPCIVPDParseVPDLargeResourceFields: Merge logic conditions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Merge the pre-checks with the 'switch' statement which is operating on
the same values to simplify further refactoring.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 037803a949cfe60c03824482f889cc315bb7b788)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index ddd79fa8bc..ba05014e40 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -438,23 +438,27 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
fieldKeyword = g_strndup((char *)buf, 2);
fieldFormat = virPCIVPDResourceGetFieldValueFormat(fieldKeyword);
- /* Handle special cases first */
- if (!readOnly && fieldFormat == VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RESVD) {
- VIR_INFO("Unexpected RV keyword in the read-write section.");
- return false;
- } else if (readOnly && fieldFormat == VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RDWR) {
- VIR_INFO("Unexpected RW keyword in the read-only section.");
- return false;
- }
-
/* Determine how many bytes to read per field value type. */
switch (fieldFormat) {
case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_TEXT:
- case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RDWR:
case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_BINARY:
bytesToRead = fieldDataLen;
break;
+
+ case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RDWR:
+ if (readOnly) {
+ VIR_INFO("Unexpected RW keyword in the read-only section.");
+ return false;
+ }
+
+ bytesToRead = fieldDataLen;
+ break;
+
case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RESVD:
+ if (!readOnly) {
+ VIR_INFO("Unexpected RV keyword in the read-write section.");
+ return false;
+ }
/* Only need one byte to be read and accounted towards
* the checksum calculation. */
bytesToRead = 1;
--
2.43.0

View File

@ -0,0 +1,108 @@
From 3c987a4fb4a4e96bd4a9af04e43862d96169767e Mon Sep 17 00:00:00 2001
Message-ID: <3c987a4fb4a4e96bd4a9af04e43862d96169767e.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 30 Jan 2024 15:14:49 +0100
Subject: [PATCH] virPCIVPDParseVPDLargeResourceFields: Refactor processing of
read data
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use a 'switch' statement instead of a bunch of if/elseif statements.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 378b82dac2f7bb7f20e32c4f0f8db49ff5f36851)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 66 +++++++++++++++++++++++++-------------------
1 file changed, 37 insertions(+), 29 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 25c4c2c5ec..60e520c46f 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -485,36 +485,43 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
/* Advance the position to the first byte of the next field. */
fieldPos += fieldDataLen;
- if (fieldFormat == VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_TEXT) {
- /* Trim whitespace around a retrieved value and set it to be a field's value. Cases
- * where unnecessary whitespace was present around a field value have been encountered
- * in the wild.
- */
- fieldValue = g_strstrip(g_strndup((char *)buf, fieldDataLen));
- if (!virPCIVPDResourceIsValidTextValue(fieldValue)) {
- /* Skip fields with invalid values - this is safe assuming field length is
- * correctly specified. */
- VIR_DEBUG("A value for field %s contains invalid characters", fieldKeyword);
+ switch (fieldFormat) {
+ case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_TEXT:
+ /* Trim whitespace around a retrieved value and set it to be a field's value. Cases
+ * where unnecessary whitespace was present around a field value have been encountered
+ * in the wild.
+ */
+ fieldValue = g_strstrip(g_strndup((char *)buf, fieldDataLen));
+ if (!virPCIVPDResourceIsValidTextValue(fieldValue)) {
+ /* Skip fields with invalid values - this is safe assuming field length is
+ * correctly specified. */
+ VIR_DEBUG("A value for field %s contains invalid characters", fieldKeyword);
+ continue;
+ }
+ break;
+
+ case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_BINARY:
+ fieldValue = g_malloc(fieldDataLen);
+ memcpy(fieldValue, buf, fieldDataLen);
+ break;
+
+ case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RDWR:
+ /* Skip the read-write space since it is used for indication only. */
+ hasRW = true;
+ goto done;
+
+ case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RESVD:
+ if (*csum) {
+ /* All bytes up to and including the checksum byte should add up to 0. */
+ VIR_INFO("Checksum validation has failed");
+ return false;
+ }
+ hasChecksum = true;
+ goto done;
+
+ case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_LAST:
+ /* Skip unknown fields */
continue;
- }
- } else if (fieldFormat == VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RESVD) {
- if (*csum) {
- /* All bytes up to and including the checksum byte should add up to 0. */
- VIR_INFO("Checksum validation has failed");
- return false;
- }
- hasChecksum = true;
- break;
- } else if (fieldFormat == VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RDWR) {
- /* Skip the read-write space since it is used for indication only. */
- hasRW = true;
- break;
- } else if (fieldFormat == VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_LAST) {
- /* Skip unknown fields */
- continue;
- } else {
- fieldValue = g_malloc(fieldDataLen);
- memcpy(fieldValue, buf, fieldDataLen);
}
if (readOnly) {
@@ -528,6 +535,7 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
virPCIVPDResourceUpdateKeyword(res, readOnly, fieldKeyword, fieldValue);
}
+ done:
/* May have exited the loop prematurely in case RV or RW were encountered and
* they were not the last fields in the section. */
endReached = (fieldPos >= resPos + resDataLen);
--
2.43.0

View File

@ -0,0 +1,105 @@
From 72da25da974a1fa9d995b46afb76714d56f4cb9b Mon Sep 17 00:00:00 2001
Message-ID: <72da25da974a1fa9d995b46afb76714d56f4cb9b.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 30 Jan 2024 16:45:39 +0100
Subject: [PATCH] virPCIVPDParseVPDLargeResourceFields: Refactor return logic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Rewrite the conditions after exiting the parser so that they are easier
to understand. This partially decreases the granularity of "error"
messages as they are not strictly necessary albeit for debugging.
As it was already observed in this code the logic itself often does
something else than the comment claims, thus the code logic is
preserved.
Changes:
- any case when not all data was processed is aggregated together and
gets a common "error" message
- absence of 'checksum' field is checked separately
- helper variables are removed as they are no longer needed
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit a352bcf1c64e4efaa31ff5b193ff8ff4ca9d1329)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 60e520c46f..be19f7b747 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -415,10 +415,7 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
g_autofree uint8_t *buf = g_malloc0(PCI_VPD_MAX_FIELD_SIZE + 1);
uint16_t fieldDataLen = 0, bytesToRead = 0;
uint16_t fieldPos = resPos;
-
bool hasChecksum = false;
- bool hasRW = false;
- bool endReached = false;
/* Note the equal sign - fields may have a zero length in which case they will
* just occupy 3 header bytes. In the in case of the RW field this may mean that
@@ -507,7 +504,9 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RDWR:
/* Skip the read-write space since it is used for indication only. */
- hasRW = true;
+ /* The lack of RW is allowed on purpose in the read-write section since some vendors
+ * violate the PCI/PCIe specs and do not include it, however, this does not prevent parsing
+ * of valid data. */
goto done;
case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RESVD:
@@ -531,6 +530,7 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
if (!res->rw)
res->rw = virPCIVPDResourceRWNew();
}
+
/* The field format, keyword and value are determined. Attempt to update the resource. */
virPCIVPDResourceUpdateKeyword(res, readOnly, fieldKeyword, fieldValue);
}
@@ -538,27 +538,21 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
done:
/* May have exited the loop prematurely in case RV or RW were encountered and
* they were not the last fields in the section. */
- endReached = (fieldPos >= resPos + resDataLen);
- if (readOnly && !(hasChecksum && endReached)) {
- VIR_DEBUG("VPD-R does not contain the mandatory RV field as the last field");
+ if ((fieldPos < resPos + resDataLen)) {
+ /* unparsed data still present */
+ VIR_DEBUG("PCI VPD data parsing failed");
+ return false;
+ }
+
+ if (readOnly && !hasChecksum) {
+ VIR_DEBUG("VPD-R does not contain the mandatory checksum");
return false;
- } else if (!readOnly && !endReached) {
- /* The lack of RW is allowed on purpose in the read-write section since some vendors
- * violate the PCI/PCIe specs and do not include it, however, this does not prevent parsing
- * of valid data. If the RW is present, however, we make sure it is the last field in
- * the read-write section. */
- if (hasRW) {
- VIR_DEBUG("VPD-W section parsing ended prematurely (RW is not the last field).");
- return false;
- } else {
- VIR_DEBUG("VPD-W section parsing ended prematurely.");
- return false;
- }
}
return true;
}
+
/**
* virPCIVPDParseVPDLargeResourceString:
* @vpdFileFd: A file descriptor associated with a file containing PCI device VPD.
--
2.43.0

View File

@ -0,0 +1,38 @@
From deaf496dc41a0108a77aca108d6365021e9c5ad0 Mon Sep 17 00:00:00 2001
Message-ID: <deaf496dc41a0108a77aca108d6365021e9c5ad0.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 30 Jan 2024 15:05:20 +0100
Subject: [PATCH] virPCIVPDParseVPDLargeResourceFields: Remove impossible
'default' switch case
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The 'fieldFormat' variable is guaranteed to have only the proper enum
values by virPCIVPDResourceGetFieldValueFormat.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit f1deac9635352f39fdf26e5d6bc2051f787149c9)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index ba05014e40..25c4c2c5ec 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -470,9 +470,6 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
VIR_DEBUG("Could not determine a field value format for keyword: %s", fieldKeyword);
bytesToRead = fieldDataLen;
break;
- default:
- VIR_INFO("Unexpected field value format encountered.");
- return false;
}
if (resPos + resDataLen < fieldPos + fieldDataLen) {
--
2.43.0

View File

@ -0,0 +1,189 @@
From 22f89f5d9f59e0636cc10d9d86687cf369f58627 Mon Sep 17 00:00:00 2001
Message-ID: <22f89f5d9f59e0636cc10d9d86687cf369f58627.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 30 Jan 2024 16:55:50 +0100
Subject: [PATCH] virPCIVPDParseVPDLargeResourceFields: Report proper errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The code abused 'VIR_INFO' as an attempt at error reporting. Rework the
code to return the usual 0/-1 and raise proper errors.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit dfc85658bd00323d6d006ab78dc6e346cafa5ed5)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 67 +++++++++++++++++++++++---------------------
1 file changed, 35 insertions(+), 32 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index be19f7b747..4a440c2aea 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -404,12 +404,15 @@ virPCIVPDReadVPDBytes(int vpdFileFd,
* @csum: A pointer to a 1-byte checksum.
* @res: A pointer to virPCIVPDResource.
*
- * Returns: a pointer to a VPDResource which needs to be freed by the caller or
- * NULL if getting it failed for some reason.
+ * Returns 0 if the field was parsed sucessfully; -1 on error
*/
-static bool
-virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t resDataLen,
- bool readOnly, uint8_t *csum, virPCIVPDResource *res)
+static int
+virPCIVPDParseVPDLargeResourceFields(int vpdFileFd,
+ uint16_t resPos,
+ uint16_t resDataLen,
+ bool readOnly,
+ uint8_t *csum,
+ virPCIVPDResource *res)
{
/* A buffer of up to one resource record field size (plus a zero byte) is needed. */
g_autofree uint8_t *buf = g_malloc0(PCI_VPD_MAX_FIELD_SIZE + 1);
@@ -427,7 +430,7 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
/* Keyword resources consist of keywords (2 ASCII bytes per the spec) and 1-byte length. */
if (virPCIVPDReadVPDBytes(vpdFileFd, buf, 3, fieldPos, csum) < 0)
- return false;
+ return -1;
fieldDataLen = buf[2];
/* Change the position to the field's data portion skipping the keyword and length bytes. */
@@ -444,8 +447,9 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RDWR:
if (readOnly) {
- VIR_INFO("Unexpected RW keyword in the read-only section.");
- return false;
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to read the PCI VPD data: unexpected RW keyword in read-only section"));
+ return -1;
}
bytesToRead = fieldDataLen;
@@ -453,8 +457,9 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RESVD:
if (!readOnly) {
- VIR_INFO("Unexpected RV keyword in the read-write section.");
- return false;
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to read the PCI VPD data: unexpected RV keyword in read-write section"));
+ return -1;
}
/* Only need one byte to be read and accounted towards
* the checksum calculation. */
@@ -472,12 +477,13 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
if (resPos + resDataLen < fieldPos + fieldDataLen) {
/* In this case the field cannot simply be skipped since the position of the
* next field is determined based on the length of a previous field. */
- VIR_INFO("A field data length violates the resource length boundary.");
- return false;
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to read the PCI VPD data: data field length invalid"));
+ return -1;
}
if (virPCIVPDReadVPDBytes(vpdFileFd, buf, bytesToRead, fieldPos, csum) < 0)
- return false;
+ return -1;
/* Advance the position to the first byte of the next field. */
fieldPos += fieldDataLen;
@@ -492,7 +498,6 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
if (!virPCIVPDResourceIsValidTextValue(fieldValue)) {
/* Skip fields with invalid values - this is safe assuming field length is
* correctly specified. */
- VIR_DEBUG("A value for field %s contains invalid characters", fieldKeyword);
continue;
}
break;
@@ -512,8 +517,9 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
case VIR_PCI_VPD_RESOURCE_FIELD_VALUE_FORMAT_RESVD:
if (*csum) {
/* All bytes up to and including the checksum byte should add up to 0. */
- VIR_INFO("Checksum validation has failed");
- return false;
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to read the PCI VPD data: invalid checksum"));
+ return -1;
}
hasChecksum = true;
goto done;
@@ -540,16 +546,18 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
* they were not the last fields in the section. */
if ((fieldPos < resPos + resDataLen)) {
/* unparsed data still present */
- VIR_DEBUG("PCI VPD data parsing failed");
- return false;
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to read the PCI VPD data: parsing ended prematurely"));
+ return -1;
}
if (readOnly && !hasChecksum) {
- VIR_DEBUG("VPD-R does not contain the mandatory checksum");
- return false;
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to read the PCI VPD data: missing mandatory checksum"));
+ return -1;
}
- return true;
+ return 0;
}
@@ -606,7 +614,6 @@ virPCIVPDParse(int vpdFileFd)
uint8_t csum = 0;
uint8_t headerBuf[2];
- bool isWellFormed = false;
uint16_t resPos = 0, resDataLen;
uint8_t tag = 0;
bool endResReached = false, hasReadOnly = false;
@@ -659,20 +666,21 @@ virPCIVPDParse(int vpdFileFd)
&csum, res) < 0)
return NULL;
- isWellFormed = true;
break;
/* Large resource type which is also a VPD-R: 0x80 | 0x10 == 0x90 */
case PCI_VPD_LARGE_RESOURCE_FLAG | PCI_VPD_READ_ONLY_LARGE_RESOURCE_FLAG:
- isWellFormed = virPCIVPDParseVPDLargeResourceFields(vpdFileFd, resPos,
- resDataLen, true, &csum, res);
+ if (virPCIVPDParseVPDLargeResourceFields(vpdFileFd, resPos,
+ resDataLen, true, &csum, res) < 0)
+ return NULL;
/* Encountered the VPD-R tag. The resource record parsing also validates
* the presence of the required checksum in the RV field. */
hasReadOnly = true;
break;
/* Large resource type which is also a VPD-W: 0x80 | 0x11 == 0x91 */
case PCI_VPD_LARGE_RESOURCE_FLAG | PCI_VPD_READ_WRITE_LARGE_RESOURCE_FLAG:
- isWellFormed = virPCIVPDParseVPDLargeResourceFields(vpdFileFd, resPos, resDataLen,
- false, &csum, res);
+ if (virPCIVPDParseVPDLargeResourceFields(vpdFileFd, resPos, resDataLen,
+ false, &csum, res) < 0)
+ return NULL;
break;
default:
/* While we cannot parse unknown resource types, they can still be skipped
@@ -682,11 +690,6 @@ virPCIVPDParse(int vpdFileFd)
continue;
}
- if (!isWellFormed) {
- VIR_DEBUG("Encountered an invalid VPD");
- return NULL;
- }
-
/* Continue processing other resource records. */
resPos += resDataLen;
}
--
2.43.0

View File

@ -0,0 +1,75 @@
From 135355109036f6c4e25df72de7d4fa3dc4ab40c1 Mon Sep 17 00:00:00 2001
Message-ID: <135355109036f6c4e25df72de7d4fa3dc4ab40c1.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 23:42:22 +0100
Subject: [PATCH] virPCIVPDParseVPDLargeResourceString: Properly report errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Replace VIR_INFO being used as form of error reporting with proper
virReportError and the usual return values.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit aa5e3cc44934d154714610104623f19f9f6d8bfe)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 10cabff0b9..ddd79fa8bc 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -557,10 +557,9 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
* @resDataLen: A length of the data portion of a resource.
* @csum: A pointer to a 1-byte checksum.
*
- * Returns: a pointer to a VPDResource which needs to be freed by the caller or
- * NULL if getting it failed for some reason.
+ * Returns: 0 on success -1 and an error on failure
*/
-static bool
+static int
virPCIVPDParseVPDLargeResourceString(int vpdFileFd, uint16_t resPos,
uint16_t resDataLen, uint8_t *csum, virPCIVPDResource *res)
{
@@ -570,15 +569,16 @@ virPCIVPDParseVPDLargeResourceString(int vpdFileFd, uint16_t resPos,
g_autofree char *buf = g_malloc0(resDataLen + 1);
if (virPCIVPDReadVPDBytes(vpdFileFd, (uint8_t *)buf, resDataLen, resPos, csum) < 0)
- return false;
+ return -1;
resValue = g_strdup(g_strstrip(buf));
if (!virPCIVPDResourceIsValidTextValue(resValue)) {
- VIR_INFO("The string resource has invalid characters in its value");
- return false;
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to parse PCI VPD string value with invalid characters"));
+ return -1;
}
res->name = g_steal_pointer(&resValue);
- return true;
+ return 0;
}
/**
@@ -652,8 +652,11 @@ virPCIVPDParse(int vpdFileFd)
switch (tag) {
/* Large resource type which is also a string: 0x80 | 0x02 = 0x82 */
case PCI_VPD_LARGE_RESOURCE_FLAG | PCI_VPD_STRING_RESOURCE_FLAG:
- isWellFormed = virPCIVPDParseVPDLargeResourceString(vpdFileFd, resPos, resDataLen,
- &csum, res);
+ if (virPCIVPDParseVPDLargeResourceString(vpdFileFd, resPos, resDataLen,
+ &csum, res) < 0)
+ return NULL;
+
+ isWellFormed = true;
break;
/* Large resource type which is also a VPD-R: 0x80 | 0x10 == 0x90 */
case PCI_VPD_LARGE_RESOURCE_FLAG | PCI_VPD_READ_ONLY_LARGE_RESOURCE_FLAG:
--
2.43.0

View File

@ -0,0 +1,156 @@
From 93036f97d3b6da59fadc2aab57401e42e9fc148f Mon Sep 17 00:00:00 2001
Message-ID: <93036f97d3b6da59fadc2aab57401e42e9fc148f.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 29 Jan 2024 23:33:07 +0100
Subject: [PATCH] virPCIVPDReadVPDBytes: Refactor error handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Each caller was checking that the function read as many bytes as it
expected. Move the check inside virPCIVPDReadVPDBytes and make it report
a proper error rather than just a combination of VIR_DEBUG inside the
function and a random VIR_INFO in the caller.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit c15a495902bab43454341361174c8ba3dadfcdd5)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 73 +++++++++++++++++++++++---------------------
1 file changed, 38 insertions(+), 35 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 0021a88f2d..10cabff0b9 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -361,34 +361,40 @@ virPCIVPDResourceUpdateKeyword(virPCIVPDResource *res,
* @offset: The offset at which bytes need to be read.
* @csum: A pointer to a byte containing the current checksum value. Mutated by this function.
*
- * Returns: the number of VPD bytes read from the specified file descriptor. The csum value is
+ * Returns 0 if exactly @count bytes were read from @vpdFileFd. The csum value is
* also modified as bytes are read. If an error occurs while reading data from the VPD file
- * descriptor, it is reported and -1 is returned to the caller. If EOF is occurred, 0 is returned
- * to the caller.
+ * descriptor, it is reported and -1 is returned to the caller.
*/
-static size_t
-virPCIVPDReadVPDBytes(int vpdFileFd, uint8_t *buf, size_t count, off_t offset, uint8_t *csum)
+static int
+virPCIVPDReadVPDBytes(int vpdFileFd,
+ uint8_t *buf,
+ size_t count,
+ off_t offset,
+ uint8_t *csum)
{
ssize_t numRead = pread(vpdFileFd, buf, count, offset);
- if (numRead == -1) {
- VIR_DEBUG("Unable to read %zu bytes at offset %zd from fd: %d",
- count, (ssize_t)offset, vpdFileFd);
- } else if (numRead) {
- /*
- * Update the checksum for every byte read. Per the PCI(e) specs
- * the checksum is correct if the sum of all bytes in VPD from
- * VPD address 0 up to and including the VPD-R RV field's first
- * data byte is zero.
- */
- while (count--) {
- *csum += *buf;
- buf++;
- }
+ if (numRead != count) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to read the PCI VPD data"));
+ return -1;
+ }
+
+ /*
+ * Update the checksum for every byte read. Per the PCI(e) specs
+ * the checksum is correct if the sum of all bytes in VPD from
+ * VPD address 0 up to and including the VPD-R RV field's first
+ * data byte is zero.
+ */
+ while (count--) {
+ *csum += *buf;
+ buf++;
}
- return numRead;
+
+ return 0;
}
+
/**
* virPCIVPDParseVPDLargeResourceFields:
* @vpdFileFd: A file descriptor associated with a file containing PCI device VPD.
@@ -423,12 +429,9 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
g_autofree char *fieldValue = NULL;
/* Keyword resources consist of keywords (2 ASCII bytes per the spec) and 1-byte length. */
- if (virPCIVPDReadVPDBytes(vpdFileFd, buf, 3, fieldPos, csum) != 3) {
- /* Invalid field encountered which means the resource itself is invalid too. Report
- * That VPD has invalid format and bail. */
- VIR_INFO("Could not read a resource field header - VPD has invalid format");
+ if (virPCIVPDReadVPDBytes(vpdFileFd, buf, 3, fieldPos, csum) < 0)
return false;
- }
+
fieldDataLen = buf[2];
/* Change the position to the field's data portion skipping the keyword and length bytes. */
fieldPos += 3;
@@ -474,10 +477,10 @@ virPCIVPDParseVPDLargeResourceFields(int vpdFileFd, uint16_t resPos, uint16_t re
VIR_INFO("A field data length violates the resource length boundary.");
return false;
}
- if (virPCIVPDReadVPDBytes(vpdFileFd, buf, bytesToRead, fieldPos, csum) != bytesToRead) {
- VIR_INFO("Could not parse a resource field data - VPD has invalid format");
+
+ if (virPCIVPDReadVPDBytes(vpdFileFd, buf, bytesToRead, fieldPos, csum) < 0)
return false;
- }
+
/* Advance the position to the first byte of the next field. */
fieldPos += fieldDataLen;
@@ -566,10 +569,9 @@ virPCIVPDParseVPDLargeResourceString(int vpdFileFd, uint16_t resPos,
/* The resource value is not NULL-terminated so add one more byte. */
g_autofree char *buf = g_malloc0(resDataLen + 1);
- if (virPCIVPDReadVPDBytes(vpdFileFd, (uint8_t *)buf, resDataLen, resPos, csum) != resDataLen) {
- VIR_INFO("Could not read a part of a resource - VPD has invalid format");
+ if (virPCIVPDReadVPDBytes(vpdFileFd, (uint8_t *)buf, resDataLen, resPos, csum) < 0)
return false;
- }
+
resValue = g_strdup(g_strstrip(buf));
if (!virPCIVPDResourceIsValidTextValue(resValue)) {
VIR_INFO("The string resource has invalid characters in its value");
@@ -610,8 +612,8 @@ virPCIVPDParse(int vpdFileFd)
while (resPos <= PCI_VPD_ADDR_MASK) {
/* Read the resource data type tag. */
- if (virPCIVPDReadVPDBytes(vpdFileFd, &tag, 1, resPos, &csum) != 1)
- break;
+ if (virPCIVPDReadVPDBytes(vpdFileFd, &tag, 1, resPos, &csum) < 0)
+ return NULL;
/* 0x80 == 0b10000000 - the large resource data type flag. */
if (tag & PCI_VPD_LARGE_RESOURCE_FLAG) {
@@ -620,9 +622,10 @@ virPCIVPDParse(int vpdFileFd)
* where the end tag should be. */
break;
}
+
/* Read the two length bytes of the large resource record. */
- if (virPCIVPDReadVPDBytes(vpdFileFd, headerBuf, 2, resPos + 1, &csum) != 2)
- break;
+ if (virPCIVPDReadVPDBytes(vpdFileFd, headerBuf, 2, resPos + 1, &csum) < 0)
+ return NULL;
resDataLen = headerBuf[0] + (headerBuf[1] << 8);
/* Change the position to the byte following the tag and length bytes. */
--
2.43.0

View File

@ -0,0 +1,56 @@
From c820b898998aca63d597567724011182c4fa50cd Mon Sep 17 00:00:00 2001
Message-ID: <c820b898998aca63d597567724011182c4fa50cd.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 15:13:16 +0100
Subject: [PATCH] virPCIVPDResourceGetKeywordPrefix: Fix logging
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use VIR_DEBUG instead of VIR_INFO as that's more appropriate and report
relevant information for debugging.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit ab3f4d1b0b9f29c924e928f8c6663b4076e49b38)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
src/util/virpcivpd.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index b303e161ae..67065dec46 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -61,20 +61,20 @@ virPCIVPDResourceGetKeywordPrefix(const char *keyword)
g_autofree char *key = NULL;
/* Keywords must have a length of 2 bytes. */
- if (strlen(keyword) != 2) {
- VIR_INFO("The keyword length is not 2 bytes: %s", keyword);
- return NULL;
- } else if (!(virPCIVPDResourceIsUpperOrNumber(keyword[0]) &&
- virPCIVPDResourceIsUpperOrNumber(keyword[1]))) {
- VIR_INFO("The keyword is not comprised only of uppercase ASCII letters or digits");
- return NULL;
- }
+ if (strlen(keyword) != 2 ||
+ !(virPCIVPDResourceIsUpperOrNumber(keyword[0]) &&
+ virPCIVPDResourceIsUpperOrNumber(keyword[1])))
+ goto cleanup;
+
/* Special-case the system-specific keywords since they share the "Y" prefix with "YA". */
if (virPCIVPDResourceIsSystemKeyword(keyword) || virPCIVPDResourceIsVendorKeyword(keyword))
key = g_strndup(keyword, 1);
else
key = g_strndup(keyword, 2);
+ cleanup:
+ VIR_DEBUG("keyword='%s' key='%s'", keyword, NULLSTR(key));
+
return g_steal_pointer(&key);
}
--
2.43.0

View File

@ -0,0 +1,54 @@
From 4daeb72f2eb09db6c5ac1628c35139af4ab7653e Mon Sep 17 00:00:00 2001
Message-ID: <4daeb72f2eb09db6c5ac1628c35139af4ab7653e.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 15:24:27 +0100
Subject: [PATCH] virPCIVPDResourceIsValidTextValue: Adjust comment to reflect
actual code
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function does not reject '&', '<', '>' contrary to what it actually
states. Move and adjust the comment.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 42df6cc1b4acc40d05ff6bc8e85587e4faec6cac)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
https://issues.redhat.com/browse/RHEL-22400 [9.3.z]
https://issues.redhat.com/browse/RHEL-22399 [9.2.z]
---
src/util/virpcivpd.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 39557c7347..248a9b2790 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -167,19 +167,15 @@ virPCIVPDResourceGetFieldValueFormat(const char *keyword)
* value or text field value. The expectations are based on the keywords specified
* in relevant sections of PCI(e) specifications
* ("I.3. VPD Definitions" in PCI specs, "6.28.1 VPD Format" PCIe 4.0).
+ *
+ * The PCI(e) specs mention alphanumeric characters when talking about text fields
+ * and the string resource but also include spaces and dashes in the provided example.
+ * Dots, commas, equal signs have also been observed in values used by major device vendors.
*/
bool
virPCIVPDResourceIsValidTextValue(const char *value)
{
size_t i = 0;
- /*
- * The PCI(e) specs mention alphanumeric characters when talking about text fields
- * and the string resource but also include spaces and dashes in the provided example.
- * Dots, commas, equal signs have also been observed in values used by major device vendors.
- * The specs do not specify a full set of allowed code points and for Libvirt it is important
- * to keep values in the ranges allowed within XML elements (mainly excluding less-than,
- * greater-than and ampersand).
- */
if (value == NULL)
return false;
--
2.43.0

View File

@ -0,0 +1,85 @@
From 636dbbfd795583431523972a0057ede74d110a6e Mon Sep 17 00:00:00 2001
Message-ID: <636dbbfd795583431523972a0057ede74d110a6e.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Jan 2024 17:13:51 +0100
Subject: [PATCH] virpcivpdtest: testPCIVPDResourceBasic: Remove tests for
uninitialized 'ro'/'rw' section
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is a synthetic case which tests the behaviour if the 'ro' or 'rw'
struct members are uninitialized, basically excercising only a pointless
programming-error NULL check in 'virPCIVPDResourceUpdateKeyword' as real
usage does always pass a proper pointer.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit e8f5edf556145cbe6bae53255ded3051d65f24f1)
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
---
tests/virpcivpdtest.c | 27 ---------------------------
1 file changed, 27 deletions(-)
diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c
index 8a2f337e85..20545759d5 100644
--- a/tests/virpcivpdtest.c
+++ b/tests/virpcivpdtest.c
@@ -64,11 +64,6 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED)
{.keyword = "SN", .value = "serial2", .actual = &ro->serial_number},
{.keyword = "serial_number", .value = "serial3", .actual = &ro->serial_number},
};
- const TestPCIVPDKeywordValue readWriteCases[] = {
- {.keyword = "YA", .value = "tag1", .actual = &ro->change_level},
- {.keyword = "YA", .value = "tag2", .actual = &ro->change_level},
- {.keyword = "asset_tag", .value = "tag3", .actual = &ro->change_level},
- };
const TestPCIVPDKeywordValue unsupportedFieldCases[] = {
{.keyword = "FG", .value = "42", .actual = NULL},
{.keyword = "LC", .value = "42", .actual = NULL},
@@ -77,7 +72,6 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED)
{.keyword = "EX", .value = "42", .actual = NULL},
};
size_t numROCases = G_N_ELEMENTS(readOnlyCases);
- size_t numRWCases = G_N_ELEMENTS(readWriteCases);
size_t numUnsupportedCases = G_N_ELEMENTS(unsupportedFieldCases);
g_autoptr(virPCIVPDResource) res = g_new0(virPCIVPDResource, 1);
virPCIVPDResourceCustom *custom = NULL;
@@ -85,20 +79,6 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED)
g_autofree char *val = g_strdup("testval");
res->name = g_steal_pointer(&val);
- /* RO has not been initialized - make sure updates fail. */
- for (i = 0; i < numROCases; ++i) {
- if (virPCIVPDResourceUpdateKeyword(res, true,
- readOnlyCases[i].keyword,
- readOnlyCases[i].value))
- return -1;
- }
- /* RW has not been initialized - make sure updates fail. */
- for (i = 0; i < numRWCases; ++i) {
- if (virPCIVPDResourceUpdateKeyword(res, false,
- readWriteCases[i].keyword,
- readWriteCases[i].value))
- return -1;
- }
/* Initialize RO */
res->ro = g_steal_pointer(&ro);
@@ -131,13 +111,6 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED)
return -1;
}
- /* Check that RW updates fail if RW has not been initialized. */
- if (virPCIVPDResourceUpdateKeyword(res, false, "YA", "tag1"))
- return -1;
-
- if (virPCIVPDResourceUpdateKeyword(res, false, "asset_tag", "tag1"))
- return -1;
-
/* Initialize RW */
res->rw = g_steal_pointer(&rw);
if (!virPCIVPDResourceUpdateKeyword(res, false, "YA", "tag1")
--
2.43.0

View File

@ -0,0 +1,52 @@
From 44eeb458ace773226f08d0807fda964014004301 Mon Sep 17 00:00:00 2001
Message-ID: <44eeb458ace773226f08d0807fda964014004301.1707394627.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 1 Feb 2024 10:40:41 +0100
Subject: [PATCH] virt-admin: Add warning when connection to default daemon
fails
The admin connection defaults to the system-wide 'libvirtd' daemon to
manage (libvirtd:///system). As we've now switched to modular daemons
this will not work for most users out of the box:
$ virt-admin version
error: Failed to connect to the admin server
error: no valid connection
error: Failed to connect socket to '/run/user/1000/libvirt/libvirt-admin-sock': No such file or directory
As we don't want to assume which daemon the user wants to manage in the
modular topology there's no reasonable default to pick.
Give a hint to the users to use the '-c' if the connection to the
default URI fails:
$ virt-admin version
NOTE: Connecting to default daemon. Specify daemon using '-c' (e.g. virtqemud:///system)
error: Failed to connect to the admin server
error: no valid connection
error: Failed to connect socket to '/run/user/1000/libvirt/libvirt-admin-sock': No such file or directory
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
(cherry picked from commit 442061583e9dc0e4e3bf314275979051345a4a93)
https://issues.redhat.com/browse/RHEL-23170
---
tools/virt-admin.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index 1e22a3c8a9..70b6e4916f 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -108,6 +108,9 @@ vshAdmConnect(vshControl *ctl, unsigned int flags)
priv->conn = virAdmConnectOpen(ctl->connname, flags);
if (!priv->conn) {
+ if (!ctl->connname)
+ vshPrintExtra(ctl, "%s", _("NOTE: Connecting to default daemon. Specify daemon using '-c' (e.g. virtqemud:///system)\n"));
+
if (priv->wantReconnect)
vshError(ctl, "%s", _("Failed to reconnect to the admin server"));
else
--
2.43.0

View File

@ -1,7 +1,6 @@
.ctags.d/libvirt.ctags ../.ctags
tests/virt-admin-self-test ./virsh-self-test
tests/chxml2xmlout/basic.xml ../chxml2xmlin/basic.xml
tests/genericxml2xmloutdata/device-backenddomain.xml ../genericxml2xmlindata/device-backenddomain.xml
tests/networkxml2xmlin/leasetime-hours.xml ../networkxml2confdata/leasetime-hours.xml
tests/networkxml2xmlin/leasetime-infinite.xml ../networkxml2confdata/leasetime-infinite.xml
tests/networkxml2xmlin/leasetime-minutes.xml ../networkxml2confdata/leasetime-minutes.xml
@ -60,7 +59,8 @@ tests/qemublocktestdata/imagecreate/qcow2-backing-raw-nbd.xml qcow2.xml
tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.xml qcow2.xml
tests/qemublocktestdata/imagecreate/qcow2-backing-raw.xml qcow2.xml
tests/qemublocktestdata/imagecreate/qcow2-luks-encopts-backing.xml qcow2-luks-encopts.xml
tests/qemufirmwaredata/etc/qemu/firmware/40-ovmf-sb-keys.json ../../../usr/share/qemu/firmware/50-ovmf-sb-keys.json
tests/qemufirmwaredata/etc/qemu/firmware/20-bios.json ../../../usr/share/qemu/firmware/91-bios.json
tests/qemufirmwaredata/etc/qemu/firmware/59-combined.json ../../../usr/share/qemu/firmware/90-combined.json
tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell-detach.xml qemuhotplug-base-live+ivshmem-plain.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain-detach.xml qemuhotplug-base-live.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog+watchdog-reset.xml qemuhotplug-base-live+watchdog.xml
@ -84,43 +84,53 @@ tests/qemuxml2argvdata/aarch64-gic-default-v3.xml aarch64-gic-default.xml
tests/qemuxml2argvdata/aarch64-gic-none-both.xml aarch64-gic-none.xml
tests/qemuxml2argvdata/aarch64-gic-none-v2.xml aarch64-gic-none.xml
tests/qemuxml2argvdata/aarch64-gic-none-v3.xml aarch64-gic-none-v2.xml
tests/qemuxml2argvdata/cpu-check-full.args cpu-check-none.args
tests/qemuxml2argvdata/cpu-check-partial.args cpu-check-none.args
tests/qemuxml2argvdata/cpu-check-full.x86_64-latest.args cpu-check-none.x86_64-latest.args
tests/qemuxml2argvdata/cpu-check-partial.x86_64-latest.args cpu-check-none.x86_64-latest.args
tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-latest.args disk-backing-chains-noindex.x86_64-latest.args
tests/qemuxml2argvdata/disk-cdrom-network-nbdkit.xml disk-cdrom-network.xml
tests/qemuxml2argvdata/disk-network-http-nbdkit.xml disk-network-http.xml
tests/qemuxml2argvdata/disk-network-source-curl-nbdkit.xml disk-network-source-curl.xml
tests/qemuxml2argvdata/disk-network-ssh-nbdkit.xml disk-network-ssh.xml
tests/qemuxml2argvdata/firmware-auto-efi-abi-update-aarch64.xml firmware-auto-efi-aarch64.xml
tests/qemuxml2argvdata/firmware-auto-efi-abi-update.xml firmware-auto-efi.xml
tests/qemuxml2argvdata/firmware-auto-efi-format-loader-raw-abi-update.xml firmware-auto-efi-format-loader-raw.xml
tests/qemuxml2argvdata/firmware-auto-efi-loader-secure-abi-update.xml firmware-auto-efi-loader-secure.xml
tests/qemuxml2argvdata/firmware-auto-efi-rw-abi-update.xml firmware-auto-efi-rw.xml
tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.xml memory-hotplug-nvdimm-ppc64.xml
tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.xml memory-hotplug-ppc64-nonuma.xml
tests/qemuxml2argvdata/pci-rom-disabled-invalid.args pci-rom-disabled.args
tests/qemuxml2argvdata/pci-rom-disabled-invalid.x86_64-latest.args pci-rom-disabled.x86_64-latest.args
tests/qemuxml2argvdata/ppc64-usb-controller-legacy.xml ppc64-usb-controller.xml
tests/qemuxml2argvdata/ppc64-usb-controller-qemu-xhci.xml ppc64-usb-controller.xml
tests/qemuxml2argvdata/pseries-console-native.ppc64-latest.args pseries-serial-native.ppc64-latest.args
tests/qemuxml2argvdata/pseries-serial+console-native.ppc64-latest.args pseries-serial-native.ppc64-latest.args
tests/qemuxml2argvdata/pseries-serial-compat.ppc64-latest.args pseries-serial-native.ppc64-latest.args
tests/qemuxml2argvdata/usb-controller-default-unavailable-i440fx.xml usb-controller-default-i440fx.xml
tests/qemuxml2argvdata/usb-controller-default-unavailable-q35.xml usb-controller-default-q35.xml
tests/qemuxml2argvdata/usb-controller-explicit-unavailable-q35.xml usb-controller-explicit-q35.xml
tests/qemuxml2argvdata/usb-controller-qemu-xhci-unavailable.xml usb-controller-qemu-xhci.xml
tests/qemuxml2argvdata/usb-controller-nec-xhci-unavailable.xml usb-controller-nec-xhci.xml
tests/qemuxml2xmloutdata/blkdeviotune-group-num.x86_64-latest.xml ../qemuxml2argvdata/blkdeviotune-group-num.xml
tests/qemuxml2xmloutdata/blkdeviotune-max-length.x86_64-latest.xml ../qemuxml2argvdata/blkdeviotune-max-length.xml
tests/qemuxml2xmloutdata/blkdeviotune-max.x86_64-latest.xml ../qemuxml2argvdata/blkdeviotune-max.xml
tests/qemuxml2xmloutdata/boot-floppy-q35.xml ../qemuxml2argvdata/boot-floppy-q35.xml
tests/qemuxml2xmloutdata/clock-realtime.xml ../qemuxml2argvdata/clock-realtime.xml
tests/qemuxml2xmloutdata/boot-floppy-q35.x86_64-latest.xml ../qemuxml2argvdata/boot-floppy-q35.xml
tests/qemuxml2xmloutdata/clock-realtime.x86_64-latest.xml ../qemuxml2argvdata/clock-realtime.xml
tests/qemuxml2xmloutdata/clock-timer-armvtimer.aarch64-latest.xml ../qemuxml2argvdata/clock-timer-armvtimer.xml
tests/qemuxml2xmloutdata/crypto-builtin.x86_64-latest.xml ../qemuxml2argvdata/crypto-builtin.xml
tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-inactive.x86_64-latest.xml disk-cdrom-empty-network-invalid-active.x86_64-latest.xml
tests/qemuxml2xmloutdata/disk-detect-zeroes.x86_64-latest.xml ../qemuxml2argvdata/disk-detect-zeroes.xml
tests/qemuxml2xmloutdata/disk-nvme.x86_64-latest.xml ../qemuxml2argvdata/disk-nvme.xml
tests/qemuxml2xmloutdata/disk-virtio-queues.x86_64-latest.xml ../qemuxml2argvdata/disk-virtio-queues.xml
tests/qemuxml2xmloutdata/disk-virtio-scsi-reservations.xml ../qemuxml2argvdata/disk-virtio-scsi-reservations.xml
tests/qemuxml2xmloutdata/downscript.xml ../qemuxml2argvdata/downscript.xml
tests/qemuxml2xmloutdata/disk-virtio-scsi-reservations.x86_64-latest.xml ../qemuxml2argvdata/disk-virtio-scsi-reservations.xml
tests/qemuxml2xmloutdata/downscript.x86_64-latest.xml ../qemuxml2argvdata/downscript.xml
tests/qemuxml2xmloutdata/encrypted-disk-usage.x86_64-latest.xml ../qemuxml2argvdata/encrypted-disk-usage.xml
tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.xml ../qemuxml2argvdata/fd-memory-no-numa-topology.xml
tests/qemuxml2xmloutdata/fd-memory-numa-topology.xml ../qemuxml2argvdata/fd-memory-numa-topology.xml
tests/qemuxml2xmloutdata/fd-memory-numa-topology2.xml ../qemuxml2argvdata/fd-memory-numa-topology2.xml
tests/qemuxml2xmloutdata/fd-memory-numa-topology3.xml ../qemuxml2argvdata/fd-memory-numa-topology3.xml
tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.x86_64-latest.xml ../qemuxml2argvdata/fd-memory-no-numa-topology.xml
tests/qemuxml2xmloutdata/fd-memory-numa-topology.x86_64-latest.xml ../qemuxml2argvdata/fd-memory-numa-topology.xml
tests/qemuxml2xmloutdata/fd-memory-numa-topology2.x86_64-latest.xml ../qemuxml2argvdata/fd-memory-numa-topology2.xml
tests/qemuxml2xmloutdata/fd-memory-numa-topology3.x86_64-latest.xml ../qemuxml2argvdata/fd-memory-numa-topology3.xml
tests/qemuxml2xmloutdata/fd-memory-numa-topology4.x86_64-latest.xml ../qemuxml2argvdata/fd-memory-numa-topology4.xml
tests/qemuxml2xmloutdata/graphics-dbus-address.xml ../qemuxml2argvdata/graphics-dbus-address.xml
tests/qemuxml2xmloutdata/graphics-dbus-audio.xml ../qemuxml2argvdata/graphics-dbus-audio.xml
tests/qemuxml2xmloutdata/graphics-dbus-chardev.xml ../qemuxml2argvdata/graphics-dbus-chardev.xml
tests/qemuxml2xmloutdata/graphics-dbus-p2p.xml ../qemuxml2argvdata/graphics-dbus-p2p.xml
tests/qemuxml2xmloutdata/graphics-dbus.xml ../qemuxml2argvdata/graphics-dbus.xml
tests/qemuxml2xmloutdata/graphics-dbus-address.x86_64-latest.xml ../qemuxml2argvdata/graphics-dbus-address.xml
tests/qemuxml2xmloutdata/graphics-dbus-audio.x86_64-latest.xml ../qemuxml2argvdata/graphics-dbus-audio.xml
tests/qemuxml2xmloutdata/graphics-dbus-chardev.x86_64-latest.xml ../qemuxml2argvdata/graphics-dbus-chardev.xml
tests/qemuxml2xmloutdata/graphics-dbus-p2p.x86_64-latest.xml ../qemuxml2argvdata/graphics-dbus-p2p.xml
tests/qemuxml2xmloutdata/graphics-dbus.x86_64-latest.xml ../qemuxml2argvdata/graphics-dbus.xml
tests/qemuxml2xmloutdata/hugepages-default-2M.x86_64-latest.xml ../qemuxml2argvdata/hugepages-default-2M.xml
tests/qemuxml2xmloutdata/hugepages-default-system-size.x86_64-latest.xml ../qemuxml2argvdata/hugepages-default-system-size.xml
tests/qemuxml2xmloutdata/hugepages-default.x86_64-latest.xml ../qemuxml2argvdata/hugepages-default.xml
@ -141,38 +151,37 @@ tests/qemuxml2xmloutdata/intel-iommu-device-iotlb.x86_64-latest.xml ../qemuxml2a
tests/qemuxml2xmloutdata/intel-iommu-eim.x86_64-latest.xml ../qemuxml2argvdata/intel-iommu-eim.xml
tests/qemuxml2xmloutdata/intel-iommu.x86_64-latest.xml ../qemuxml2argvdata/intel-iommu.xml
tests/qemuxml2xmloutdata/iothreads-ids-pool-sizes.x86_64-latest.xml ../qemuxml2argvdata/iothreads-ids-pool-sizes.xml
tests/qemuxml2xmloutdata/kvm-features-off.xml ../qemuxml2argvdata/kvm-features-off.xml
tests/qemuxml2xmloutdata/kvm-features.xml ../qemuxml2argvdata/kvm-features.xml
tests/qemuxml2xmloutdata/kvm-features-off.x86_64-latest.xml ../qemuxml2argvdata/kvm-features-off.xml
tests/qemuxml2xmloutdata/kvm-features.x86_64-latest.xml ../qemuxml2argvdata/kvm-features.xml
tests/qemuxml2xmloutdata/luks-disks.x86_64-latest.xml ../qemuxml2argvdata/luks-disks.xml
tests/qemuxml2xmloutdata/memfd-memory-default-hugepage.x86_64-latest.xml ../qemuxml2argvdata/memfd-memory-default-hugepage.xml
tests/qemuxml2xmloutdata/memfd-memory-numa.x86_64-latest.xml ../qemuxml2argvdata/memfd-memory-numa.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-access.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-label.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.xml ../qemuxml2argvdata/memory-hotplug-nvdimm.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.x86_64-latest.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-access.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.x86_64-latest.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.x86_64-latest.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-label.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.x86_64-latest.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.x86_64-latest.xml ../qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.x86_64-latest.xml ../qemuxml2argvdata/memory-hotplug-nvdimm.xml
tests/qemuxml2xmloutdata/memory-hotplug-virtio-mem.x86_64-latest.xml ../qemuxml2argvdata/memory-hotplug-virtio-mem.xml
tests/qemuxml2xmloutdata/memory-hotplug-virtio-pmem.x86_64-latest.xml ../qemuxml2argvdata/memory-hotplug-virtio-pmem.xml
tests/qemuxml2xmloutdata/net-mtu.xml ../qemuxml2argvdata/net-mtu.xml
tests/qemuxml2xmloutdata/net-user-addr.xml ../qemuxml2argvdata/net-user-addr.xml
tests/qemuxml2xmloutdata/net-user-passt.xml ../qemuxml2argvdata/net-user-passt.xml
tests/qemuxml2xmloutdata/net-mtu.x86_64-latest.xml ../qemuxml2argvdata/net-mtu.xml
tests/qemuxml2xmloutdata/net-user-addr.x86_64-latest.xml ../qemuxml2argvdata/net-user-addr.xml
tests/qemuxml2xmloutdata/net-virtio-rss.x86_64-latest.xml ../qemuxml2argvdata/net-virtio-rss.xml
tests/qemuxml2xmloutdata/net-virtio-teaming-hostdev.xml ../qemuxml2argvdata/net-virtio-teaming-hostdev.xml
tests/qemuxml2xmloutdata/numatune-hmat.xml ../qemuxml2argvdata/numatune-hmat.xml
tests/qemuxml2xmloutdata/net-virtio-teaming-hostdev.x86_64-latest.xml ../qemuxml2argvdata/net-virtio-teaming-hostdev.xml
tests/qemuxml2xmloutdata/numatune-hmat.x86_64-latest.xml ../qemuxml2argvdata/numatune-hmat.xml
tests/qemuxml2xmloutdata/numatune-memnode-restrictive-mode.x86_64-latest.xml ../qemuxml2argvdata/numatune-memnode-restrictive-mode.xml
tests/qemuxml2xmloutdata/numatune-no-vcpu.xml ../qemuxml2argvdata/numatune-no-vcpu.xml
tests/qemuxml2xmloutdata/numatune-no-vcpu.x86_64-latest.xml ../qemuxml2argvdata/numatune-no-vcpu.xml
tests/qemuxml2xmloutdata/pages-dimm-discard.x86_64-latest.xml ../qemuxml2argvdata/pages-dimm-discard.xml
tests/qemuxml2xmloutdata/pages-discard-hugepages.x86_64-latest.xml ../qemuxml2argvdata/pages-discard-hugepages.xml
tests/qemuxml2xmloutdata/pages-discard.xml ../qemuxml2argvdata/pages-discard.xml
tests/qemuxml2xmloutdata/pages-discard.x86_64-latest.xml ../qemuxml2argvdata/pages-discard.xml
tests/qemuxml2xmloutdata/pc-i440fx-acpi-root-hotplug-disable.x86_64-latest.xml ../qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.xml
tests/qemuxml2xmloutdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-latest.xml ../qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.xml
tests/qemuxml2xmloutdata/pseries-console-native.ppc64-latest.xml pseries-serial-native.ppc64-latest.xml
tests/qemuxml2xmloutdata/pseries-serial+console-native.ppc64-latest.xml pseries-serial-native.ppc64-latest.xml
tests/qemuxml2xmloutdata/pseries-serial-compat.ppc64-latest.xml pseries-serial-native.ppc64-latest.xml
tests/qemuxml2xmloutdata/serial-tcp-tlsx509-chardev-notls.xml ../qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.xml
tests/qemuxml2xmloutdata/serial-tcp-tlsx509-chardev-notls.x86_64-latest.xml ../qemuxml2argvdata/serial-tcp-tlsx509-chardev-notls.xml
tests/qemuxml2xmloutdata/sgx-epc.x86_64-7.0.0.xml ../qemuxml2argvdata/sgx-epc.xml
tests/qemuxml2xmloutdata/smbios-type-fwcfg.xml ../qemuxml2argvdata/smbios-type-fwcfg.xml
tests/qemuxml2xmloutdata/smbios-type-fwcfg.x86_64-latest.xml ../qemuxml2argvdata/smbios-type-fwcfg.xml
tests/qemuxml2xmloutdata/tpm-emulator-spapr.ppc64-latest.xml ../qemuxml2argvdata/tpm-emulator-spapr.xml
tests/qemuxml2xmloutdata/tpm-emulator-tpm2-enc.x86_64-latest.xml ../qemuxml2argvdata/tpm-emulator-tpm2-enc.xml
tests/qemuxml2xmloutdata/tpm-emulator-tpm2-pstate.x86_64-latest.xml ../qemuxml2argvdata/tpm-emulator-tpm2-pstate.xml
@ -188,7 +197,7 @@ tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml ../qemuxml2ar
tests/qemuxml2xmloutdata/vhost-user-fs-sock.x86_64-latest.xml ../qemuxml2argvdata/vhost-user-fs-sock.xml
tests/qemuxml2xmloutdata/vhost-vsock-ccw-iommu.s390x-latest.xml ../qemuxml2argvdata/vhost-vsock-ccw-iommu.xml
tests/qemuxml2xmloutdata/vhost-vsock.x86_64-latest.xml ../qemuxml2argvdata/vhost-vsock.xml
tests/qemuxml2xmloutdata/video-qxl-resolution.xml ../qemuxml2argvdata/video-qxl-resolution.xml
tests/qemuxml2xmloutdata/video-qxl-resolution.x86_64-latest.xml ../qemuxml2argvdata/video-qxl-resolution.xml
tests/qemuxml2xmloutdata/video-virtio-vga-gpu-gl.x86_64-latest.xml ../qemuxml2argvdata/video-virtio-vga-gpu-gl.xml
tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml ../qemuxml2argvdata/virtio-options.xml
tests/qemuxml2xmloutdata/x86_64-default-cpu-tcg-features.x86_64-latest.xml ../qemuxml2argvdata/x86_64-default-cpu-tcg-features.xml

File diff suppressed because it is too large Load Diff