Sync with AlmaLinux beta

This commit is contained in:
eabdullin 2024-04-30 15:19:11 +03:00
parent c10bd8cbd9
commit 46fe2f828e
131 changed files with 10125 additions and 93613 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/libvirt-9.0.0.tar.xz SOURCES/libvirt-10.0.0.tar.xz

View File

@ -1 +1 @@
43b6ebfd7dc0ff360e75a89b25012f734c76b653 SOURCES/libvirt-9.0.0.tar.xz 7a2e402bfb1ad295544de6cd527c4c04e85c5096 SOURCES/libvirt-10.0.0.tar.xz

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

@ -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,225 +0,0 @@
From e4b040f7a05e4b160a62cd0ce1bdffed7efe8dfa Mon Sep 17 00:00:00 2001
Message-Id: <e4b040f7a05e4b160a62cd0ce1bdffed7efe8dfa@dist-git>
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 11 Apr 2023 17:56:45 +0200
Subject: [PATCH] conf: Fix migration in some firmware autoselection scenarios
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Introduce a small kludge in the parser to avoid unnecessarily
blocking incoming migration from a range of recent libvirt
releases.
https://bugzilla.redhat.com/show_bug.cgi?id=2184966
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit f9ad3023355bcbfc692bbe4997fdfa774866a980)
Conflicts:
* tests/qemuxml2argvtest.c
* tests/qemuxml2xmltest.c
- missing unrelated changes to surrounding code
* tests/qemuxml2argvdata/firmware-manual-efi-features.x86_64-latest.args
* tests/qemuxml2xmloutdata/firmware-manual-efi-features.x86_64-latest.xml
- had to be regenerated to account for differences in the
input file, as well as the test code and the behavior of
the firmware selection feature. In particular, the
reference to /bad-test-used-env-home/ is caused by the
fact that qemuxml2xmltest, unlike qemuxml2argvtest,
didn't set cfg->nvramDir before e62db9ee5b..e6c1ca3d11
https://bugzilla.redhat.com/show_bug.cgi?id=2186383
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
src/conf/domain_conf.c | 39 ++++++++++++++++++-
...are-manual-efi-features.x86_64-latest.args | 35 +++++++++++++++++
tests/qemuxml2argvtest.c | 6 ++-
...ware-manual-efi-features.x86_64-latest.xml | 32 +++++++++++++++
tests/qemuxml2xmltest.c | 1 +
5 files changed, 110 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/firmware-manual-efi-features.x86_64-latest.args
create mode 100644 tests/qemuxml2xmloutdata/firmware-manual-efi-features.x86_64-latest.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 733399e6da..89637bb282 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17021,11 +17021,13 @@ virDomainDefParseBootKernelOptions(virDomainDef *def,
static int
virDomainDefParseBootFirmwareOptions(virDomainDef *def,
- xmlXPathContextPtr ctxt)
+ xmlXPathContextPtr ctxt,
+ unsigned int flags)
{
g_autofree char *firmware = virXPathString("string(./os/@firmware)", ctxt);
g_autofree xmlNodePtr *nodes = NULL;
g_autofree int *features = NULL;
+ bool abiUpdate = !!(flags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE);
int fw = 0;
int n = 0;
size_t i;
@@ -17033,6 +17035,39 @@ virDomainDefParseBootFirmwareOptions(virDomainDef *def,
if ((n = virXPathNodeSet("./os/firmware/feature", ctxt, &nodes)) < 0)
return -1;
+ /* Migration compatibility kludge.
+ *
+ * Between 8.6.0 and 9.1.0 (extremes included), the migratable
+ * XML produced when feature-based firmware autoselection was
+ * enabled looked like
+ *
+ * <os>
+ * <firmware>
+ * <feature name='foo' enabled='yes'/>
+ *
+ * Notice how there's no firmware='foo' attribute for the <os>
+ * element, meaning that firmware autoselection is disabled, and
+ * yet some <feature> elements, which are used to control the
+ * firmware autoselection process, are present. We don't consider
+ * this to be a valid combination, and want such a configuration
+ * to get rejected when submitted by users.
+ *
+ * In order to achieve that, while at the same time keeping
+ * migration coming from the libvirt versions listed above
+ * working, we can simply stop parsing early and ignore the
+ * <feature> tags when firmware autoselection is not enabled,
+ * *except* if we're defining a new domain.
+ *
+ * This is safe to do because the configuration will either come
+ * from another libvirt instance, in which case it will have a
+ * properly filled in <loader> element that contains enough
+ * information to successfully define and start the domain, or it
+ * will be a random configuration that lacks such information, in
+ * which case a different failure will be reported anyway.
+ */
+ if (n > 0 && !firmware && !abiUpdate)
+ return 0;
+
if (n > 0)
features = g_new0(int, VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_LAST);
@@ -17161,7 +17196,7 @@ virDomainDefParseBootOptions(virDomainDef *def,
case VIR_DOMAIN_OSTYPE_HVM:
virDomainDefParseBootKernelOptions(def, ctxt);
- if (virDomainDefParseBootFirmwareOptions(def, ctxt) < 0)
+ if (virDomainDefParseBootFirmwareOptions(def, ctxt, flags) < 0)
return -1;
if (virDomainDefParseBootLoaderOptions(def, ctxt, xmlopt, flags) < 0)
diff --git a/tests/qemuxml2argvdata/firmware-manual-efi-features.x86_64-latest.args b/tests/qemuxml2argvdata/firmware-manual-efi-features.x86_64-latest.args
new file mode 100644
index 0000000000..db6c6d06bc
--- /dev/null
+++ b/tests/qemuxml2argvdata/firmware-manual-efi-features.x86_64-latest.args
@@ -0,0 +1,35 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-test \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-test/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-test/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-test/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=test,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-test/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/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,usb=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
+-accel tcg \
+-cpu qemu64 \
+-m 1024 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 362d1fc1-df7d-193e-5c18-49a71bd1da66 \
+-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/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 3fb2d5dc74..99392335b6 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1130,7 +1130,11 @@ mymain(void)
QEMU_CAPS_DEVICE_ISA_SERIAL);
DO_TEST_NOCAPS("firmware-manual-efi");
DO_TEST_PARSE_ERROR_NOCAPS("firmware-manual-efi-no-path");
- DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-manual-efi-features");
+ DO_TEST_CAPS_LATEST("firmware-manual-efi-features");
+ DO_TEST_CAPS_ARCH_LATEST_FULL("firmware-manual-efi-features", "x86_64",
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
+ ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
+ ARG_END);
DO_TEST_CAPS_LATEST("firmware-manual-bios-rw");
DO_TEST_CAPS_LATEST("firmware-manual-bios-rw-implicit");
DO_TEST("firmware-manual-efi-secure",
diff --git a/tests/qemuxml2xmloutdata/firmware-manual-efi-features.x86_64-latest.xml b/tests/qemuxml2xmloutdata/firmware-manual-efi-features.x86_64-latest.xml
new file mode 100644
index 0000000000..d142be9899
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/firmware-manual-efi-features.x86_64-latest.xml
@@ -0,0 +1,32 @@
+<domain type='qemu'>
+ <name>test</name>
+ <uuid>362d1fc1-df7d-193e-5c18-49a71bd1da66</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
+ <nvram>/bad-test-used-env-home/.config/libvirt/qemu/nvram/test_VARS.fd</nvram>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ </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='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 72f724bfce..66e038558f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -936,6 +936,7 @@ mymain(void)
DO_TEST_NOCAPS("firmware-manual-bios");
DO_TEST_NOCAPS("firmware-manual-bios-stateless");
DO_TEST_NOCAPS("firmware-manual-efi");
+ DO_TEST_CAPS_LATEST("firmware-manual-efi-features");
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-network-iscsi");
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-network-nbd");
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-file");
--
2.40.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

@ -1,63 +0,0 @@
From 0c35c1c0495a953268719ad83cf2f368ab53018b Mon Sep 17 00:00:00 2001
Message-Id: <0c35c1c0495a953268719ad83cf2f368ab53018b@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 20 Jan 2023 12:56:48 +0100
Subject: [PATCH] conf: clarify some external TPM error messages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Two of the messages referred to 'backend type' when dealing
with the source type and one mentioned the 'client' attribute
from an earlier iteration of the patches, even though the attribute
was later changed to 'connect'.
https://bugzilla.redhat.com/show_bug.cgi?id=2063723
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 1c7476c8797b7f0d6e8d607f6a42c5bf43441677)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 4 ++--
src/conf/domain_validate.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 45965fa0fa..733399e6da 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10545,7 +10545,7 @@ virDomainTPMDefParseXML(virDomainXMLOption *xmlopt,
case VIR_DOMAIN_TPM_TYPE_EXTERNAL:
if (!(type = virXPathString("string(./backend/source/@type)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
- _("missing external TPM backend type"));
+ _("missing external TPM backend source type"));
goto error;
}
@@ -10555,7 +10555,7 @@ virDomainTPMDefParseXML(virDomainXMLOption *xmlopt,
def->data.external.source->type = virDomainChrTypeFromString(type);
if (def->data.external.source->type < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown backend type '%s' for external TPM"),
+ _("unknown backend source type '%s' for external TPM"),
type);
goto error;
}
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 39d924d4ed..1c13929281 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2757,7 +2757,7 @@ virDomainTPMDevValidate(const virDomainTPMDef *tpm)
}
if (tpm->data.external.source->data.nix.listen) {
virReportError(VIR_ERR_XML_ERROR, "%s",
- _("only 'client' mode is supported for external TPM device"));
+ _("only 'connect' mode is supported for external TPM device"));
return -1;
}
if (tpm->data.external.source->data.nix.path == NULL) {
--
2.39.1

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

@ -1,34 +0,0 @@
From 20187d7bb3024537b1cc3cac1b16a835a29b905e Mon Sep 17 00:00:00 2001
Message-Id: <20187d7bb3024537b1cc3cac1b16a835a29b905e@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 8 Mar 2023 11:53:37 +0100
Subject: [PATCH] docs: Document memory allocation and emulator pinning
limitation
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit c4b176567b5000da1fe22ecaa9afe4b8ad4b6837)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomain.rst | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 8fc8aeb928..e7bad33cbb 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -1107,7 +1107,9 @@ influence how virtual memory pages are backed by host pages.
Using the optional ``mode`` attribute, specify when to allocate the memory by
supplying either "immediate" or "ondemand". :since:`Since 8.2.0` it is
possible to set the number of threads that hypervisor uses to allocate
- memory via ``threads`` attribute.
+ memory via ``threads`` attribute. To speed allocation process up, when
+ pinning emulator thread it's recommended to include CPUs from desired NUMA
+ nodes so that allocation threads can have their affinity set.
``discard``
When set and supported by hypervisor the memory content is discarded just
before guest shuts down (or when DIMM module is unplugged). Please note that
--
2.40.0

View File

@ -1,135 +0,0 @@
From 00ccf9be0bbb96155131cbf199539d9ad2d5ae3d Mon Sep 17 00:00:00 2001
Message-Id: <00ccf9be0bbb96155131cbf199539d9ad2d5ae3d@dist-git>
From: Jim Fehlig <jfehlig@suse.com>
Date: Thu, 2 Feb 2023 11:00:18 -0700
Subject: [PATCH] docs: Fix examples in virt-qemu-sev-validate man page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some of the examples refer to virt-dom-sev-validate. Replace them with
the proper name.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 8eb54255ec9fb933902322c4e0ed4b21cb8a5bf4)
https://bugzilla.redhat.com/show_bug.cgi?id=2172347
---
docs/manpages/virt-qemu-sev-validate.rst | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/docs/manpages/virt-qemu-sev-validate.rst b/docs/manpages/virt-qemu-sev-validate.rst
index fcbe84b0ee..9eff387aea 100644
--- a/docs/manpages/virt-qemu-sev-validate.rst
+++ b/docs/manpages/virt-qemu-sev-validate.rst
@@ -257,7 +257,7 @@ Validate the measurement of a SEV guest with direct kernel boot:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--firmware OVMF.sev.fd \
--kernel vmlinuz-5.11.12 \
--initrd initramfs-5.11.12 \
@@ -273,7 +273,7 @@ Validate the measurement of a SEV-ES SMP guest booting from disk:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--firmware OVMF.sev.fd \
--num-cpus 2 \
--vmsa-cpu0 vmsa0.bin \
@@ -290,7 +290,7 @@ automatically constructed VMSA:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--firmware OVMF.sev.fd \
--num-cpus 2 \
--cpu-family 23 \
@@ -308,7 +308,7 @@ inject a disk password on success:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--loader OVMF.sev.fd \
--tk this-guest-tk.bin \
--measurement Zs2pf19ubFSafpZ2WKkwquXvACx9Wt/BV+eJwQ/taO8jhyIj/F8swFrybR1fZ2ID \
@@ -347,7 +347,7 @@ Validate the measurement of a SEV guest with direct kernel boot:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--connect qemu+ssh://root@some.remote.host/system \
--firmware OVMF.sev.fd \
--kernel vmlinuz-5.11.12 \
@@ -360,7 +360,7 @@ Validate the measurement of a SEV-ES SMP guest booting from disk:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--connect qemu+ssh://root@some.remote.host/system \
--firmware OVMF.sev.fd \
--num-cpus 2 \
@@ -374,7 +374,7 @@ automatically constructed VMSA:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--connect qemu+ssh://root@some.remote.host/system \
--firmware OVMF.sev.fd \
--cpu-family 23 \
@@ -388,7 +388,7 @@ inject a disk password on success:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--connect qemu+ssh://root@some.remote.host/system \
--loader OVMF.sev.fd \
--tk this-guest-tk.bin \
@@ -419,7 +419,7 @@ Validate the measurement of a SEV guest with direct kernel boot:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--insecure \
--tk this-guest-tk.bin \
--domain fedora34x86_64
@@ -428,7 +428,7 @@ Validate the measurement of a SEV-ES SMP guest booting from disk:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--insecure \
--vmsa-cpu0 vmsa0.bin \
--vmsa-cpu1 vmsa1.bin \
@@ -440,7 +440,7 @@ automatically constructed VMSA:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--insecure \
--tk this-guest-tk.bin \
--domain fedora34x86_64
@@ -450,7 +450,7 @@ inject a disk password on success:
::
- # virt-dom-sev-validate \
+ # virt-qemu-sev-validate \
--insecure \
--tk this-guest-tk.bin \
--domain fedora34x86_64 \
--
2.39.2

View File

@ -1,53 +0,0 @@
From 31f2edcd7f42cda4173eabad879bfc318c202c9e Mon Sep 17 00:00:00 2001
Message-Id: <31f2edcd7f42cda4173eabad879bfc318c202c9e@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 17 Jan 2023 10:33:22 +0100
Subject: [PATCH] docs: document correct cpu shares limits with both cgroups v1
and v2
The limits are different with cgroups v1 and v2 but our XML
documentation and virsh manpage mentioned only cgroups v1 limits without
explicitly saying it only applies to cgroups v1.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit ead6e1b00285cbd98e0f0727efb8adcb29ebc1ba)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2037998
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
docs/formatdomain.rst | 2 +-
docs/manpages/virsh.rst | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 490a954745..8fc8aeb928 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -849,7 +849,7 @@ CPU Tuning
There is no unit for the value, it's a relative measure based on the setting
of other VM, e.g. A VM configured with value 2048 will get twice as much CPU
time as a VM configured with value 1024. The value should be in range
- [2, 262144]. :since:`Since 0.9.0`
+ [2, 262144] using cgroups v1, [1, 10000] using cgroups v2. :since:`Since 0.9.0`
``period``
The optional ``period`` element specifies the enforcement interval (unit:
microseconds). Within ``period``, each vCPU of the domain will not be allowed
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 88b7fa1da8..d5b614dc03 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -4054,7 +4054,8 @@ If *--config* is specified, affect the next start of a persistent guest.
If *--current* is specified, it is equivalent to either *--live* or
*--config*, depending on the current state of the guest.
-``Note``: The cpu_shares parameter has a valid value range of 2-262144.
+``Note``: The cpu_shares parameter has a valid value range of 2-262144
+with cgroups v1, 1-10000 with cgroups v2.
``Note``: The weight and cap parameters are defined only for the
XEN_CREDIT scheduler.
--
2.39.1

View File

@ -1,47 +0,0 @@
From 33d57465bc7d0c23c281c4db27fc7eb2ed62b24a Mon Sep 17 00:00:00 2001
Message-Id: <33d57465bc7d0c23c281c4db27fc7eb2ed62b24a@dist-git>
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Thu, 16 Feb 2023 15:51:03 +0000
Subject: [PATCH] docs/kbase: fix example for SEV validation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The offline validation example needs to include the firmware path,
and is also missing line continuation markers.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 9541ce080a0896411bebb299f47e39112810a648)
https://bugzilla.redhat.com/show_bug.cgi?id=2172347
---
docs/kbase/launch_security_sev.rst | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/docs/kbase/launch_security_sev.rst b/docs/kbase/launch_security_sev.rst
index 7f692af748..f3c8695f73 100644
--- a/docs/kbase/launch_security_sev.rst
+++ b/docs/kbase/launch_security_sev.rst
@@ -465,12 +465,13 @@ scope of this document. Fortunately, libvirt provides a tool that can be used
to perform this validation::
$ virt-qemu-sev-validate \
- --measurement LMnv8i8N2QejezMPkscShF0cyPYCslgUoCxGWRqQuyt0Q0aUjVkH/T6NcmkwZkWp
- --api-major 0
- --api-minor 24
- --build-id 15
- --policy 3
- --tik ${myvmname}_tik.bin
+ --measurement LMnv8i8N2QejezMPkscShF0cyPYCslgUoCxGWRqQuyt0Q0aUjVkH/T6NcmkwZkWp \
+ --api-major 0 \
+ --api-minor 24 \
+ --build-id 15 \
+ --policy 3 \
+ --firmware /path/to/OVMF.sev.fd \
+ --tik ${myvmname}_tik.bin \
--tek ${myvmname}_tek.bin
OK: Looks good to me
--
2.39.2

View File

@ -1,45 +0,0 @@
From 53d7c205d38497ffb17fcbd81bedf61897ddbc8d Mon Sep 17 00:00:00 2001
Message-Id: <53d7c205d38497ffb17fcbd81bedf61897ddbc8d@dist-git>
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Thu, 16 Feb 2023 14:55:11 +0000
Subject: [PATCH] docs: refer to --firmware instead of --loader
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The --loader syntax was left over from an earlier version of the code
before it was renamed to --firmware.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 4d3b2d77d014fe4a7a1fa8123b71cc7b41ee5beb)
https://bugzilla.redhat.com/show_bug.cgi?id=2172347
---
docs/manpages/virt-qemu-sev-validate.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/manpages/virt-qemu-sev-validate.rst b/docs/manpages/virt-qemu-sev-validate.rst
index 9eff387aea..b1392e0a50 100644
--- a/docs/manpages/virt-qemu-sev-validate.rst
+++ b/docs/manpages/virt-qemu-sev-validate.rst
@@ -309,7 +309,7 @@ inject a disk password on success:
::
# virt-qemu-sev-validate \
- --loader OVMF.sev.fd \
+ --firmware OVMF.sev.fd \
--tk this-guest-tk.bin \
--measurement Zs2pf19ubFSafpZ2WKkwquXvACx9Wt/BV+eJwQ/taO8jhyIj/F8swFrybR1fZ2ID \
--api-major 0 \
@@ -390,7 +390,7 @@ inject a disk password on success:
# virt-qemu-sev-validate \
--connect qemu+ssh://root@some.remote.host/system \
- --loader OVMF.sev.fd \
+ --firmware OVMF.sev.fd \
--tk this-guest-tk.bin \
--domain fedora34x86_64 \
--disk-password passwd.txt
--
2.39.2

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,50 +0,0 @@
From fbf5f9bce43e19f8827e5cdef0e456b74ccc2f7d Mon Sep 17 00:00:00 2001
Message-Id: <fbf5f9bce43e19f8827e5cdef0e456b74ccc2f7d@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 17 Jan 2023 10:08:08 +0100
Subject: [PATCH] domain_validate: drop cpu.shares cgroup check
This check is done when VM is defined but doesn't take into account what
cgroups version is currently used on the host system so it doesn't work
correctly.
To make proper check at this point we would have to figure out cgroups
version while defining a VM but that will still not guarantee that the
VM will start correctly in the future as the host may be rebooted with
different cgroups version.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 38af6497610075e5fe386734b87186731d4c17ac)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2037998
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/conf/domain_validate.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 5a9bf20d3f..39d924d4ed 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -1725,16 +1725,6 @@ virDomainDefOSValidate(const virDomainDef *def,
static int
virDomainDefCputuneValidate(const virDomainDef *def)
{
- if (def->cputune.shares > 0 &&
- (def->cputune.shares < VIR_CGROUP_CPU_SHARES_MIN ||
- def->cputune.shares > VIR_CGROUP_CPU_SHARES_MAX)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Value of cputune 'shares' must be in range [%llu, %llu]"),
- VIR_CGROUP_CPU_SHARES_MIN,
- VIR_CGROUP_CPU_SHARES_MAX);
- return -1;
- }
-
CPUTUNE_VALIDATE_PERIOD(period);
CPUTUNE_VALIDATE_PERIOD(global_period);
CPUTUNE_VALIDATE_PERIOD(emulator_period);
--
2.39.1

File diff suppressed because it is too large Load Diff

View File

@ -1,181 +0,0 @@
From 179240a310b8b74075f90c1580b2864aa406bf03 Mon Sep 17 00:00:00 2001
Message-Id: <179240a310b8b74075f90c1580b2864aa406bf03@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Mar 2023 12:39:47 +0100
Subject: [PATCH] qemu: Add @nodemask argument to qemuBuildThreadContextProps()
When building a thread-context object (inside of
qemuBuildThreadContextProps()) we look at given memory-backend-*
object and look for .host-nodes attribute. This works, as long as
we need to just copy the attribute value into another
thread-context attribute. But soon we will need to adjust it.
That's the point where having the value in virBitmap comes handy.
Utilize the previous commit, which made
qemuBuildMemoryBackendProps() set the argument and pass it into
qemuBuildThreadContextProps().
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 45222a83b76e05a522afc8743a77ca320feb72f2)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 38 +++++++++++++++++++++-----------------
src/qemu/qemu_command.h | 3 ++-
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 938332496f..346967f51c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3490,7 +3490,8 @@ qemuBuildMemoryCellBackendProps(virDomainDef *def,
virQEMUDriverConfig *cfg,
size_t cell,
qemuDomainObjPrivate *priv,
- virJSONValue **props)
+ virJSONValue **props,
+ virBitmap **nodemask)
{
g_autofree char *alias = NULL;
virDomainMemoryDef mem = { 0 };
@@ -3503,8 +3504,8 @@ qemuBuildMemoryCellBackendProps(virDomainDef *def,
mem.targetNode = cell;
mem.info.alias = alias;
- return qemuBuildMemoryBackendProps(props, alias, cfg, priv,
- def, &mem, false, false, NULL);
+ return qemuBuildMemoryBackendProps(props, alias, cfg, priv, def,
+ &mem, false, false, nodemask);
}
@@ -3517,6 +3518,7 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd,
{
g_autoptr(virJSONValue) props = NULL;
g_autoptr(virJSONValue) tcProps = NULL;
+ virBitmap *nodemask = NULL;
g_autofree char *alias = NULL;
if (!mem->info.alias) {
@@ -3527,11 +3529,11 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd,
alias = g_strdup_printf("mem%s", mem->info.alias);
- if (qemuBuildMemoryBackendProps(&props, alias, cfg,
- priv, def, mem, true, false, NULL) < 0)
+ if (qemuBuildMemoryBackendProps(&props, alias, cfg, priv,
+ def, mem, true, false, &nodemask) < 0)
return -1;
- if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
+ if (qemuBuildThreadContextProps(&tcProps, &props, priv, nodemask) < 0)
return -1;
if (tcProps &&
@@ -3628,11 +3630,10 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
int
qemuBuildThreadContextProps(virJSONValue **tcProps,
virJSONValue **memProps,
- qemuDomainObjPrivate *priv)
+ qemuDomainObjPrivate *priv,
+ virBitmap *nodemask)
{
g_autoptr(virJSONValue) props = NULL;
- virJSONValue *nodemask = NULL;
- g_autoptr(virJSONValue) nodemaskCopy = NULL;
g_autofree char *tcAlias = NULL;
const char *memalias = NULL;
bool prealloc = false;
@@ -3642,7 +3643,6 @@ qemuBuildThreadContextProps(virJSONValue **tcProps,
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_THREAD_CONTEXT))
return 0;
- nodemask = virJSONValueObjectGetArray(*memProps, "host-nodes");
if (!nodemask)
return 0;
@@ -3658,12 +3658,11 @@ qemuBuildThreadContextProps(virJSONValue **tcProps,
}
tcAlias = g_strdup_printf("tc-%s", memalias);
- nodemaskCopy = virJSONValueCopy(nodemask);
if (virJSONValueObjectAdd(&props,
"s:qom-type", "thread-context",
"s:id", tcAlias,
- "a:node-affinity", &nodemaskCopy,
+ "m:node-affinity", nodemask,
NULL) < 0)
return -1;
@@ -7054,17 +7053,18 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virCommand *cmd,
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
g_autoptr(virJSONValue) props = NULL;
g_autoptr(virJSONValue) tcProps = NULL;
+ virBitmap *nodemask = NULL;
virDomainMemoryDef mem = { 0 };
mem.size = virDomainDefGetMemoryInitial(def);
mem.targetNode = -1;
mem.info.alias = (char *) defaultRAMid;
- if (qemuBuildMemoryBackendProps(&props, defaultRAMid, cfg,
- priv, def, &mem, false, true, NULL) < 0)
+ if (qemuBuildMemoryBackendProps(&props, defaultRAMid, cfg, priv,
+ def, &mem, false, true, &nodemask) < 0)
return -1;
- if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
+ if (qemuBuildThreadContextProps(&tcProps, &props, priv, nodemask) < 0)
return -1;
if (tcProps &&
@@ -7335,6 +7335,7 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
virQEMUCaps *qemuCaps = priv->qemuCaps;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virJSONValue **nodeBackends = NULL;
+ g_autofree virBitmap **nodemask = NULL;
bool needBackend = false;
bool hmat = false;
int ret = -1;
@@ -7356,10 +7357,12 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
}
nodeBackends = g_new0(virJSONValue *, ncells);
+ nodemask = g_new0(virBitmap *, ncells);
for (i = 0; i < ncells; i++) {
if ((rc = qemuBuildMemoryCellBackendProps(def, cfg, i, priv,
- &nodeBackends[i])) < 0)
+ &nodeBackends[i],
+ &nodemask[i])) < 0)
goto cleanup;
if (rc == 0)
@@ -7389,7 +7392,8 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
if (needBackend) {
g_autoptr(virJSONValue) tcProps = NULL;
- if (qemuBuildThreadContextProps(&tcProps, &nodeBackends[i], priv) < 0)
+ if (qemuBuildThreadContextProps(&tcProps, &nodeBackends[i],
+ priv, nodemask[i]) < 0)
goto cleanup;
if (tcProps &&
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 9074822bc5..17f326d13b 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -153,7 +153,8 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
int
qemuBuildThreadContextProps(virJSONValue **tcProps,
virJSONValue **memProps,
- qemuDomainObjPrivate *priv);
+ qemuDomainObjPrivate *priv,
+ virBitmap *nodemask);
/* Current, best practice */
virJSONValue *
--
2.40.0

View File

@ -1,127 +0,0 @@
From b0e9d41346a272bbe33ce1da7f7dd015a58747e1 Mon Sep 17 00:00:00 2001
Message-Id: <b0e9d41346a272bbe33ce1da7f7dd015a58747e1@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Mar 2023 12:02:11 +0100
Subject: [PATCH] qemu: Add @nodemaskRet argument to
qemuBuildMemoryBackendProps()
While it's true that anybody who's interested in getting
.host-nodes attribute value can just use
virJSONValueObjectGetArray() (and that's exactly what
qemuBuildThreadContextProps() is doing, btw), if somebody is
interested in getting the actual virBitmap, they would have to
parse the JSON array.
Instead, introduce an argument to qemuBuildMemoryBackendProps()
which is set to corresponding value used when formatting the
attribute.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 9f26f6cc4bd6161a1978b8703005b9916270d382)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 14 ++++++++++----
src/qemu/qemu_command.h | 4 +++-
src/qemu/qemu_hotplug.c | 2 +-
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 436df47eaa..938332496f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3234,6 +3234,7 @@ qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg,
* @def: domain definition object
* @mem: memory definition object
* @force: forcibly use one of the backends
+ * @nodemaskRet: [out] bitmap used to format .host-nodes attribute
*
* Creates a configuration object that represents memory backend of given guest
* NUMA node (domain @def and @mem). Use @priv->autoNodeset to fine tune the
@@ -3258,7 +3259,8 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
const virDomainDef *def,
const virDomainMemoryDef *mem,
bool force,
- bool systemMemory)
+ bool systemMemory,
+ virBitmap **nodemaskRet)
{
const char *backendType = "memory-backend-file";
virDomainNumatuneMemMode mode;
@@ -3445,6 +3447,9 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
"S:policy", qemuNumaPolicyTypeToString(mode),
NULL) < 0)
return -1;
+
+ if (nodemaskRet)
+ *nodemaskRet = nodemask;
}
}
@@ -3498,7 +3503,8 @@ qemuBuildMemoryCellBackendProps(virDomainDef *def,
mem.targetNode = cell;
mem.info.alias = alias;
- return qemuBuildMemoryBackendProps(props, alias, cfg, priv, def, &mem, false, false);
+ return qemuBuildMemoryBackendProps(props, alias, cfg, priv,
+ def, &mem, false, false, NULL);
}
@@ -3522,7 +3528,7 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd,
alias = g_strdup_printf("mem%s", mem->info.alias);
if (qemuBuildMemoryBackendProps(&props, alias, cfg,
- priv, def, mem, true, false) < 0)
+ priv, def, mem, true, false, NULL) < 0)
return -1;
if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
@@ -7055,7 +7061,7 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virCommand *cmd,
mem.info.alias = (char *) defaultRAMid;
if (qemuBuildMemoryBackendProps(&props, defaultRAMid, cfg,
- priv, def, &mem, false, true) < 0)
+ priv, def, &mem, false, true, NULL) < 0)
return -1;
if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index c49096a057..9074822bc5 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -22,6 +22,7 @@
#pragma once
#include "domain_conf.h"
+#include "virbitmap.h"
#include "vircommand.h"
#include "virenum.h"
#include "qemu_block.h"
@@ -140,7 +141,8 @@ int qemuBuildMemoryBackendProps(virJSONValue **backendProps,
const virDomainDef *def,
const virDomainMemoryDef *mem,
bool force,
- bool systemMemory);
+ bool systemMemory,
+ virBitmap **nodemaskRet);
virJSONValue *
qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 2df59873db..8e72a2c431 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2284,7 +2284,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
goto cleanup;
if (qemuBuildMemoryBackendProps(&props, objalias, cfg,
- priv, vm->def, mem, true, false) < 0)
+ priv, vm->def, mem, true, false, NULL) < 0)
goto cleanup;
if (qemuProcessBuildDestroyMemoryPaths(driver, vm, mem, true) < 0)
--
2.40.0

View File

@ -1,49 +0,0 @@
From dc65b0e0895a556252f523b799a7144566ca388f Mon Sep 17 00:00:00 2001
Message-Id: <dc65b0e0895a556252f523b799a7144566ca388f@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Mar 2023 12:31:08 +0100
Subject: [PATCH] qemu: Fix qemuDomainGetEmulatorPinInfo()
The order of pinning priority (at least for emulator thread) was
set by v1.2.15-rc1~58 (for cgroup code). But later, when
automatic placement was implemented into
qemuDomainGetEmulatorPinInfo(), the priority was not honored.
Now that we have this priority code in a separate function, we
can just call that and avoid this type of error.
Fixes: 776924e37649f2d47acd805746d5fd9325212ea5
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 7feed1613df72acd6dbcb65513942163b56e6b3a)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_driver.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d00b91fe0b..fffb0a9ac5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4574,14 +4574,9 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
if (live)
autoCpuset = QEMU_DOMAIN_PRIVATE(vm)->autoCpuset;
- if (def->cputune.emulatorpin) {
- cpumask = def->cputune.emulatorpin;
- } else if (def->cpumask) {
- cpumask = def->cpumask;
- } else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO &&
- autoCpuset) {
- cpumask = autoCpuset;
- } else {
+ if (!(cpumask = qemuDomainEvaluateCPUMask(def,
+ def->cputune.emulatorpin,
+ autoCpuset))) {
if (!(bitmap = virHostCPUGetAvailableCPUsBitmap()))
goto cleanup;
cpumask = bitmap;
--
2.40.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,88 +0,0 @@
From e917c5aa46ccffb608dad2068861e555b60e10fa Mon Sep 17 00:00:00 2001
Message-Id: <e917c5aa46ccffb608dad2068861e555b60e10fa@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Mar 2023 12:27:05 +0100
Subject: [PATCH] qemu: Move cpuset preference evaluation into a separate
function
The set of if()-s that determines the preference in cpumask used
for setting things like emulatorpin, vcpupin, etc. is going to be
re-used. Separate it out into a function.
You may think that this changes behaviour, but
qemuProcessPrepareDomainNUMAPlacement() ensures that
priv->autoCpuset is set for VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit b4ccb0dc412bcdb09863b2fa1ee65d09808a2c08)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_domain.c | 18 ++++++++++++++++++
src/qemu/qemu_domain.h | 5 +++++
src/qemu/qemu_process.c | 9 ++-------
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 374b881146..443b6442ca 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12335,3 +12335,21 @@ qemuDomainStartupCleanup(virDomainObj *vm)
for (i = 0; i < vm->def->ndisks; i++)
qemuDomainCleanupStorageSourceFD(vm->def->disks[i]->src);
}
+
+
+virBitmap *
+qemuDomainEvaluateCPUMask(const virDomainDef *def,
+ virBitmap *cpumask,
+ virBitmap *autoCpuset)
+{
+ if (cpumask) {
+ return cpumask;
+ } else if (autoCpuset &&
+ def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
+ return autoCpuset;
+ } else if (def->cpumask) {
+ return def->cpumask;
+ }
+
+ return NULL;
+}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index fb9ab4c5ed..b01b394287 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1139,3 +1139,8 @@ qemuDomainSchedCoreStart(virQEMUDriverConfig *cfg,
void
qemuDomainSchedCoreStop(qemuDomainObjPrivate *priv);
+
+virBitmap *
+qemuDomainEvaluateCPUMask(const virDomainDef *def,
+ virBitmap *cpumask,
+ virBitmap *autoCpuset);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e5c438aa26..3154fa5b10 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2575,13 +2575,8 @@ qemuProcessSetupPid(virDomainObj *vm,
}
/* Infer which cpumask shall be used. */
- if (cpumask) {
- use_cpumask = cpumask;
- } else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
- use_cpumask = priv->autoCpuset;
- } else if (vm->def->cpumask) {
- use_cpumask = vm->def->cpumask;
- } else {
+ if (!(use_cpumask = qemuDomainEvaluateCPUMask(vm->def,
+ cpumask, priv->autoCpuset))) {
/* You may think this is redundant, but we can't assume libvirtd
* itself is running on all pCPUs, so we need to explicitly set
* the spawned QEMU instance to all pCPUs if no map is given in
--
2.40.0

View File

@ -1,105 +0,0 @@
From ec03aa23ac417797f9b53d51b6f999f5e966f9d7 Mon Sep 17 00:00:00 2001
Message-Id: <ec03aa23ac417797f9b53d51b6f999f5e966f9d7@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 16 Jan 2023 12:46:09 +0100
Subject: [PATCH] qemu: Provide virDomainGetCPUStats() implementation for
session connection
We have virDomainGetCPUStats() API which offers querying
statistics on host CPU usage by given guest. And it works in two
modes: getting overall stats (@start_cpu == -1, @ncpus == 1) or
getting per host CPU usage.
For the QEMU driver it is implemented by looking into values
stored in corresponding cpuacct CGroup controller. Well, this
works for system instances, where libvirt has permissions to
create CGroups and place QEMU process into them. But it does not
fly for session connection, where no CGroups are set up.
Fortunately, we can do something similar to v8.8.0-rc1~95 and use
virProcessGetStatInfo() to fill the overall stats. Unfortunately,
I haven't found any source of per host CPU usage, so we just
continue throwing an error in that case.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 8865c42771600a40eddf40663f73b458423059a4)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2148266
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_driver.c | 52 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 50 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c576c601ad..0603af6a35 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16009,6 +16009,50 @@ qemuDomainGetMetadata(virDomainPtr dom,
return ret;
}
+#define QEMU_CPU_STATS_PROC_TOTAL 3
+
+static int
+qemuDomainGetCPUStatsProc(virDomainObj *vm,
+ virTypedParameterPtr params,
+ unsigned int nparams)
+{
+ unsigned long long cpuTime = 0;
+ unsigned long long userTime = 0;
+ unsigned long long sysTime = 0;
+
+ if (nparams == 0) {
+ /* return supported number of params */
+ return QEMU_CPU_STATS_PROC_TOTAL;
+ }
+
+ if (virProcessGetStatInfo(&cpuTime, &userTime, &sysTime,
+ NULL, NULL, vm->pid, 0) < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("cannot read cputime for domain"));
+ return -1;
+ }
+
+ if (virTypedParameterAssign(&params[0], VIR_DOMAIN_CPU_STATS_CPUTIME,
+ VIR_TYPED_PARAM_ULLONG, cpuTime) < 0)
+ return -1;
+
+ if (nparams > 1 &&
+ virTypedParameterAssign(&params[1], VIR_DOMAIN_CPU_STATS_USERTIME,
+ VIR_TYPED_PARAM_ULLONG, userTime) < 0)
+ return -1;
+
+ if (nparams > 2 &&
+ virTypedParameterAssign(&params[2], VIR_DOMAIN_CPU_STATS_SYSTEMTIME,
+ VIR_TYPED_PARAM_ULLONG, sysTime) < 0)
+ return -1;
+
+ if (nparams > 3)
+ nparams = 3;
+
+ return nparams;
+}
+
+#undef QEMU_CPU_STATS_PROC_TOTAL
static int
qemuDomainGetCPUStats(virDomainPtr domain,
@@ -16037,8 +16081,12 @@ qemuDomainGetCPUStats(virDomainPtr domain,
goto cleanup;
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUACCT)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cgroup CPUACCT controller is not mounted"));
+ if (start_cpu == -1) {
+ ret = qemuDomainGetCPUStatsProc(vm, params, nparams);
+ } else {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cgroup CPUACCT controller is not mounted"));
+ }
goto cleanup;
}
--
2.39.1

View File

@ -1,77 +0,0 @@
From e0e6c7375855e09c45591d0b5ab23cddaa230ad8 Mon Sep 17 00:00:00 2001
Message-Id: <e0e6c7375855e09c45591d0b5ab23cddaa230ad8@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 19 Jan 2023 15:18:45 +0100
Subject: [PATCH] qemu: Remove 'memAliasOrderMismatch' field from VM private
data
The field is no longer used so we can remove it and the code filling it.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 5764930463eb8f450e45fa982651ef6b7a7afd7c)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2158701
---
src/qemu/qemu_domain.h | 3 ---
src/qemu/qemu_process.c | 24 ------------------------
2 files changed, 27 deletions(-)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 08430b67b9..eca5404cdc 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -177,9 +177,6 @@ struct _qemuDomainObjPrivate {
uint8_t *masterKey;
size_t masterKeyLen;
- /* note whether memory device alias does not correspond to slot number */
- bool memAliasOrderMismatch;
-
/* for migrations using TLS with a secret (not to be saved in our */
/* private XML). */
qemuDomainSecretInfo *migSecinfo;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ee9f0784d3..29716ecb19 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3896,28 +3896,6 @@ qemuDomainPerfRestart(virDomainObj *vm)
}
-static void
-qemuProcessReconnectCheckMemAliasOrderMismatch(virDomainObj *vm)
-{
- size_t i;
- int aliasidx;
- virDomainDef *def = vm->def;
- qemuDomainObjPrivate *priv = vm->privateData;
-
- if (!virDomainDefHasMemoryHotplug(def) || def->nmems == 0)
- return;
-
- for (i = 0; i < def->nmems; i++) {
- aliasidx = qemuDomainDeviceAliasIndex(&def->mems[i]->info, "dimm");
-
- if (def->mems[i]->info.addr.dimm.slot != aliasidx) {
- priv->memAliasOrderMismatch = true;
- break;
- }
- }
-}
-
-
static bool
qemuProcessDomainMemoryDefNeedHugepagesPath(const virDomainMemoryDef *mem,
const long system_pagesize)
@@ -9091,8 +9069,6 @@ qemuProcessReconnect(void *opaque)
if (qemuProcessRefreshFdsetIndex(obj) < 0)
goto error;
- qemuProcessReconnectCheckMemAliasOrderMismatch(obj);
-
if (qemuConnectAgent(driver, obj) < 0)
goto error;
--
2.39.1

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,139 +0,0 @@
From 86d2fda1a16bc6d2566acfb6a566e13d704fd25a Mon Sep 17 00:00:00 2001
Message-Id: <86d2fda1a16bc6d2566acfb6a566e13d704fd25a@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Mon, 20 Feb 2023 18:26:51 -0500
Subject: [PATCH] qemu: add reconnect=5 to passt qemu commandline options when
available
QEMU's "reconnect" option of "-netdev stream" tells QEMU to
periodically (period is given in seconds as an argument to the option)
attempt to reconnect to the same passt socket to which it had
originally connected to. This is useful in cases where the passt
process terminates, and libvirtd starts a new passt process in its
place (which doesn't happen yet, but will happen automatically after
an upcoming patch in this series).
Since there is no real hueristic for determining the "best" value of
the reconnect interval, rather than clutter up config with a knob that
nobody knows how to properly twiddle, we just set the reconnect timer
to 5 seconds.
"-netdev stream" first appeared in QEMU 7.2.0, but the reconnect
option won't be available until QEMU 8.0.0, so we need to check QEMU
capabilities just in case someone is using QEMU 7.2.0 (and thus can
support passt backend, but not reconnect)
Resolves: https://bugzilla.redhat.com/2172098
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit acd8333f763f1e45728fac4e727fef4e33141ebf)
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_passt.c | 11 ++++++
.../net-user-passt.x86_64-7.2.0.args | 37 +++++++++++++++++++
.../net-user-passt.x86_64-latest.args | 2 +-
tests/qemuxml2argvtest.c | 1 +
4 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 88b7df4453..8d28a55455 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -83,6 +83,8 @@ qemuPasstAddNetProps(virDomainObj *vm,
{
g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
g_autoptr(virJSONValue) addrprops = NULL;
+ qemuDomainObjPrivate *priv = vm->privateData;
+ virQEMUCaps *qemuCaps = priv->qemuCaps;
if (virJSONValueObjectAdd(&addrprops,
"s:type", "unix",
@@ -98,6 +100,15 @@ qemuPasstAddNetProps(virDomainObj *vm,
NULL) < 0) {
return -1;
}
+
+ /* a narrow range of QEMU releases support -netdev stream, but
+ * don't support its "reconnect" option
+ */
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM_RECONNECT) &&
+ virJSONValueObjectAdd(netprops, "u:reconnect", 5, NULL) < 0) {
+ return -1;
+ }
+
return 0;
}
diff --git a/tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args b/tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args
new file mode 100644
index 0000000000..037dabb87d
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args
@@ -0,0 +1,37 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/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":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc-i440fx-7.2,usb=off,dump-guest-core=off,memory-backend=pc.ram \
+-accel tcg \
+-cpu qemu64 \
+-m 214 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-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 \
+-no-acpi \
+-boot strict=on \
+-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}' \
+-netdev '{"type":"stream","addr":{"type":"unix","path":"/bad-test-used-env-xdg-runtime-dir/libvirt/qemu/run/passt/-1-QEMUGuest1-net0.socket"},"server":false,"id":"hostnet0"}' \
+-device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"00:11:22:33:44:55","bus":"pci.0","addr":"0x2"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/net-user-passt.x86_64-latest.args b/tests/qemuxml2argvdata/net-user-passt.x86_64-latest.args
index 48e3e8ca8b..f84bec2ec1 100644
--- a/tests/qemuxml2argvdata/net-user-passt.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/net-user-passt.x86_64-latest.args
@@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-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}' \
--netdev '{"type":"stream","addr":{"type":"unix","path":"/bad-test-used-env-xdg-runtime-dir/libvirt/qemu/run/passt/-1-QEMUGuest1-net0.socket"},"server":false,"id":"hostnet0"}' \
+-netdev '{"type":"stream","addr":{"type":"unix","path":"/bad-test-used-env-xdg-runtime-dir/libvirt/qemu/run/passt/-1-QEMUGuest1-net0.socket"},"server":false,"reconnect":5,"id":"hostnet0"}' \
-device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"00:11:22:33:44:55","bus":"pci.0","addr":"0x2"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 8c52feb83c..e23b32e96a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1471,6 +1471,7 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST_FULL("net-user", "x86_64", ARG_FLAGS, FLAG_SLIRP_HELPER);
DO_TEST_NOCAPS("net-user-addr");
DO_TEST_CAPS_LATEST("net-user-passt");
+ DO_TEST_CAPS_VER("net-user-passt", "7.2.0");
DO_TEST_NOCAPS("net-virtio");
DO_TEST_NOCAPS("net-virtio-device");
DO_TEST_NOCAPS("net-virtio-disable-offloads");
--
2.39.2

View File

@ -1,46 +0,0 @@
From 0173f19a17ac694fee1e2c0bbb4b89ba0ff85920 Mon Sep 17 00:00:00 2001
Message-Id: <0173f19a17ac694fee1e2c0bbb4b89ba0ff85920@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 1 Mar 2023 16:51:42 +0100
Subject: [PATCH] qemu: agent: Make fetching of 'can-offline' member from
'guest-query-vcpus' optional
The 'can-offline' member is optional according to agent's schema and in
fact in certain cases it's not returned. Libvirt then spams the logs
if something is polling the bulk guest stats API.
Noticed when going through oVirt logs which appears to call the bulk
stats API repeatedly.
Instead of requiring it we simply reply that the vCPU can't be offlined.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit 790ea58153b9ef1120a577d1a87a4ca2e988ee5c)
https://bugzilla.redhat.com/show_bug.cgi?id=2174446
---
src/qemu/qemu_agent.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index fa2c0bf915..72898d3fae 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -1366,12 +1366,8 @@ qemuAgentGetVCPUs(qemuAgent *agent,
return -1;
}
- if (virJSONValueObjectGetBoolean(entry, "can-offline",
- &in->offlinable) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("'can-offline' missing in reply of guest-get-vcpus"));
- return -1;
- }
+ in->offlinable = false;
+ ignore_value(virJSONValueObjectGetBoolean(entry, "can-offline", &in->offlinable));
}
return ndata;
--
2.39.2

View File

@ -1,108 +0,0 @@
From 9271efe525e9cfaf1aad931ffccf61d6d17e5273 Mon Sep 17 00:00:00 2001
Message-Id: <9271efe525e9cfaf1aad931ffccf61d6d17e5273@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 19 Jan 2023 15:16:58 +0100
Subject: [PATCH] qemu: alias: Remove 'oldAlias' argument of
qemuAssignDeviceMemoryAlias
All callers pass 'false' so we no longer need it.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 6d3f0b11b2b056313b123510c96f2924689341f9)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2158701
---
src/qemu/qemu_alias.c | 13 ++++---------
src/qemu/qemu_alias.h | 3 +--
src/qemu/qemu_hotplug.c | 2 +-
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index ef8e87ab58..0f1310a0e5 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -454,7 +454,6 @@ qemuAssignDeviceRNGAlias(virDomainDef *def,
static int
qemuDeviceMemoryGetAliasID(virDomainDef *def,
virDomainMemoryDef *mem,
- bool oldAlias,
const char *prefix)
{
size_t i;
@@ -462,8 +461,7 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
/* virtio-pmem and virtio-mem go onto PCI bus and thus DIMM address is not
* valid */
- if (!oldAlias &&
- mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM &&
+ if (mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM &&
mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM &&
mem->model != VIR_DOMAIN_MEMORY_MODEL_SGX_EPC)
return mem->info.addr.dimm.slot;
@@ -482,8 +480,6 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
* qemuAssignDeviceMemoryAlias:
* @def: domain definition. Necessary only if @oldAlias is true.
* @mem: memory device definition
- * @oldAlias: Generate the alias according to the order of the device in @def
- * rather than according to the slot number for legacy reasons.
*
* Generates alias for a memory device according to slot number if @oldAlias is
* false or according to order in @def->mems otherwise.
@@ -492,8 +488,7 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
*/
int
qemuAssignDeviceMemoryAlias(virDomainDef *def,
- virDomainMemoryDef *mem,
- bool oldAlias)
+ virDomainMemoryDef *mem)
{
const char *prefix = NULL;
int idx = 0;
@@ -525,7 +520,7 @@ qemuAssignDeviceMemoryAlias(virDomainDef *def,
break;
}
- idx = qemuDeviceMemoryGetAliasID(def, mem, oldAlias, prefix);
+ idx = qemuDeviceMemoryGetAliasID(def, mem, prefix);
mem->info.alias = g_strdup_printf("%s%d", prefix, idx);
return 0;
@@ -685,7 +680,7 @@ qemuAssignDeviceAliases(virDomainDef *def)
qemuAssignDeviceTPMAlias(def->tpms[i], i);
}
for (i = 0; i < def->nmems; i++) {
- if (qemuAssignDeviceMemoryAlias(def, def->mems[i], false) < 0)
+ if (qemuAssignDeviceMemoryAlias(def, def->mems[i]) < 0)
return -1;
}
if (def->vsock) {
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index 6433ae4cec..af9c3f62d3 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -55,8 +55,7 @@ void qemuAssignDeviceRNGAlias(virDomainDef *def,
virDomainRNGDef *rng);
int qemuAssignDeviceMemoryAlias(virDomainDef *def,
- virDomainMemoryDef *mems,
- bool oldAlias);
+ virDomainMemoryDef *mems);
void qemuAssignDeviceShmemAlias(virDomainDef *def,
virDomainShmemDef *shmem,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5840504d13..2df59873db 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2275,7 +2275,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
goto cleanup;
releaseaddr = true;
- if (qemuAssignDeviceMemoryAlias(vm->def, mem, false) < 0)
+ if (qemuAssignDeviceMemoryAlias(vm->def, mem) < 0)
goto cleanup;
objalias = g_strdup_printf("mem%s", mem->info.alias);
--
2.39.1

View File

@ -1,53 +0,0 @@
From bf15c630b7c54637220af65ac84cfd007c1c798a Mon Sep 17 00:00:00 2001
Message-Id: <bf15c630b7c54637220af65ac84cfd007c1c798a@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 31 Jan 2023 15:35:05 +0100
Subject: [PATCH] qemu: block: Properly handle FD-passed disk hot-(un-)plug
The hotplug code paths need to be able to pass the FDs to the monitor to
ensure that hotplug works.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 3b8d669d557bd2ce8874f61e83b6d6074d365ec2)
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
---
src/qemu/qemu_block.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index e865aa17f9..c218262691 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1410,6 +1410,9 @@ qemuBlockStorageSourceAttachApplyStorageDeps(qemuMonitor *mon,
qemuMonitorAddObject(mon, &data->tlsProps, &data->tlsAlias) < 0)
return -1;
+ if (qemuFDPassTransferMonitor(data->fdpass, mon) < 0)
+ return -1;
+
return 0;
}
@@ -1559,6 +1562,8 @@ qemuBlockStorageSourceAttachRollback(qemuMonitor *mon,
if (data->tlsKeySecretAlias)
ignore_value(qemuMonitorDelObject(mon, data->tlsKeySecretAlias, false));
+ qemuFDPassTransferMonitorRollback(data->fdpass, mon);
+
virErrorRestore(&orig_err);
}
@@ -1609,6 +1614,8 @@ qemuBlockStorageSourceDetachPrepare(virStorageSource *src)
if (srcpriv->tlsKeySecret)
data->tlsKeySecretAlias = g_strdup(srcpriv->tlsKeySecret->alias);
+
+ data->fdpass = srcpriv->fdpass;
}
return g_steal_pointer(&data);
--
2.39.1

View File

@ -1,117 +0,0 @@
From 11dd7c99fa96364962f81d4efae0ed220c7a7190 Mon Sep 17 00:00:00 2001
Message-Id: <11dd7c99fa96364962f81d4efae0ed220c7a7190@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 10 Feb 2023 17:16:43 +0100
Subject: [PATCH] qemu: blockjob: Handle 'pending' blockjob state only when we
need it
The 'pending' state needs to be handled by the blockjob code only when
the snapshot code requests a block-commit without auto-finalization.
If we always handle it we fail to properly remove the blockjob data for
the 'blockdev-create' job as that also transitions trhough 'pending' but
we'd never update it once it reaches 'concluded' as the code already
thinks that the job has finished and is no longer watching it.
Introduce a 'processPending' property into block job data and set it
only when we know that we need to process 'pending'.
Fixes: 90d9bc9d74a5157167548b26c00b1a016655e295
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2168769
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit c433c2434c0459df98ed3355ef615e341acd9009)
---
src/qemu/qemu_block.c | 1 +
src/qemu/qemu_blockjob.c | 19 ++++++++++---------
src/qemu/qemu_blockjob.h | 4 ++++
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index c218262691..d8ca50d618 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3374,6 +3374,7 @@ qemuBlockCommit(virDomainObj *vm,
if (!(job = qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSource,
baseSource,
flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE,
+ autofinalize,
flags)))
goto cleanup;
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index cb2d05d71d..a20cf1db62 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -274,6 +274,7 @@ qemuBlockJobDiskNewCommit(virDomainObj *vm,
virStorageSource *top,
virStorageSource *base,
bool delete_imgs,
+ virTristateBool autofinalize,
unsigned int jobflags)
{
g_autoptr(qemuBlockJobData) job = NULL;
@@ -290,6 +291,7 @@ qemuBlockJobDiskNewCommit(virDomainObj *vm,
job->data.commit.top = top;
job->data.commit.base = base;
job->data.commit.deleteCommittedImages = delete_imgs;
+ job->processPending = autofinalize == VIR_TRISTATE_BOOL_NO;
job->jobflags = jobflags;
if (qemuBlockJobRegister(job, vm, disk, true) < 0)
@@ -532,8 +534,6 @@ qemuBlockJobRefreshJobs(virDomainObj *vm)
if (job->state == QEMU_BLOCKJOB_STATE_NEW ||
job->state == QEMU_BLOCKJOB_STATE_RUNNING)
job->newstate = newstate;
- } else if (newstate == QEMU_BLOCKJOB_STATE_PENDING) {
- job->newstate = newstate;
}
/* don't update the job otherwise */
}
@@ -1568,13 +1568,14 @@ qemuBlockJobEventProcess(virQEMUDriver *driver,
case QEMU_BLOCKJOB_STATE_PENDING:
/* Similarly as for 'ready' state we should handle it only when
- * previous state was 'new' or 'running' as there are other cases
- * when it can be emitted by QEMU. Currently we need this only when
- * deleting non-active external snapshots. */
- if (job->state == QEMU_BLOCKJOB_STATE_NEW ||
- job->state == QEMU_BLOCKJOB_STATE_RUNNING) {
- job->state = job->newstate;
- qemuDomainSaveStatus(vm);
+ * previous state was 'new' or 'running' and only if the blockjob code
+ * is handling finalization of the job explicitly. */
+ if (job->processPending) {
+ if (job->state == QEMU_BLOCKJOB_STATE_NEW ||
+ job->state == QEMU_BLOCKJOB_STATE_RUNNING) {
+ job->state = job->newstate;
+ qemuDomainSaveStatus(vm);
+ }
}
job->newstate = -1;
break;
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index e9b283da20..f1ac43b4c7 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -138,6 +138,9 @@ struct _qemuBlockJobData {
int brokentype; /* the previous type of a broken blockjob qemuBlockJobType */
+ bool processPending; /* process the 'pending' state of the job, if the job
+ should not be auto-finalized */
+
bool invalidData; /* the job data (except name) is not valid */
bool reconnected; /* internal field for tracking whether job is live after reconnect to qemu */
};
@@ -175,6 +178,7 @@ qemuBlockJobDiskNewCommit(virDomainObj *vm,
virStorageSource *top,
virStorageSource *base,
bool delete_imgs,
+ virTristateBool autofinalize,
unsigned int jobflags);
qemuBlockJobData *
--
2.39.1

View File

@ -1,75 +0,0 @@
From 3bd15e7694b6ad69832e17cf03ac09b2363cba78 Mon Sep 17 00:00:00 2001
Message-Id: <3bd15e7694b6ad69832e17cf03ac09b2363cba78@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 20 Feb 2023 17:25:08 +0100
Subject: [PATCH] qemu: capabilities: Introduce
QEMU_CAPS_NETDEV_STREAM_RECONNECT
Detect that the 'stream' netdev backend supports reconnecting.
src/qemu/qemu_capabilities.c
tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml
both of these files had the usual merge conflicts caused by
unrelated caps flags added upstream but not in RHEL.
Resolves: https://bugzilla.redhat.com/2172098
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 70747222a73ffed5cdadcab492bef67fe7e49aa4)
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml | 1 +
3 files changed, 4 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 56cad891cc..61aa99dfc6 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -684,6 +684,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
/* 440 */
"machine-hpet", /* QEMU_CAPS_MACHINE_HPET */
"netdev.stream", /* QEMU_CAPS_NETDEV_STREAM */
+ "netdev.stream.reconnect", /* QEMU_CAPS_NETDEV_STREAM_RECONNECT */
);
@@ -1552,6 +1553,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
{ "nbd-server-start/arg-type/tls-creds", QEMU_CAPS_NBD_TLS },
{ "nbd-server-add/arg-type/bitmap", QEMU_CAPS_NBD_BITMAP },
{ "netdev_add/arg-type/+stream", QEMU_CAPS_NETDEV_STREAM },
+ { "netdev_add/arg-type/+stream/reconnect", QEMU_CAPS_NETDEV_STREAM_RECONNECT },
{ "netdev_add/arg-type/+vhost-vdpa", QEMU_CAPS_NETDEV_VHOST_VDPA },
/* JSON support for -netdev was introduced for the 'dgram' netdev type */
{ "netdev_add/arg-type/type/^dgram", QEMU_CAPS_NETDEV_JSON },
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 15dddd3ea9..8543af868e 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -663,6 +663,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
/* 440 */
QEMU_CAPS_MACHINE_HPET, /* the HPET timer is configured via -machine, rather than -no-hpet */
QEMU_CAPS_NETDEV_STREAM, /* -netdev stream */
+ QEMU_CAPS_NETDEV_STREAM_RECONNECT, /* -netdev stream supports reconnect */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml
index a383075d4d..6d07d07822 100644
--- a/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml
@@ -202,6 +202,7 @@
<flag name='screenshot-format-png'/>
<flag name='machine-hpet'/>
<flag name='netdev.stream'/>
+ <flag name='netdev.stream.reconnect'/>
<version>7002050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100244</microcodeVersion>
--
2.39.2

View File

@ -1,117 +0,0 @@
From 659a0e3cda2f5561abe45ccc10afc41014d1a331 Mon Sep 17 00:00:00 2001
Message-Id: <659a0e3cda2f5561abe45ccc10afc41014d1a331@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 31 Jan 2023 14:37:40 +0100
Subject: [PATCH] qemu: command: Handle FD passing commandline via
qemuBuildBlockStorageSourceAttachDataCommandline
Copy the pointer to qemuFDPass into struct qemuBlockStorageSourceAttachData
so that it can be used from qemuBuildBlockStorageSourceAttachDataCommandline
rather than looping again in qemuBuildDiskSourceCommandLineFDs.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 65f14232fb031b57fad085a2e8792da87c97173f)
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
---
src/qemu/qemu_block.h | 2 ++
src/qemu/qemu_command.c | 26 +++----------------
.../disk-source-fd.x86_64-latest.args | 6 ++---
3 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index eac986e0f0..5a61a19da2 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -99,6 +99,8 @@ struct qemuBlockStorageSourceAttachData {
char *tlsAlias;
virJSONValue *tlsKeySecretProps;
char *tlsKeySecretAlias;
+
+ qemuFDPass *fdpass;
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b96f2d33c1..5edad046d5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2119,6 +2119,8 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virCommand *cmd,
return -1;
}
+ qemuFDPassTransferCommand(data->fdpass, cmd);
+
if (data->storageProps) {
if (!(tmp = virJSONValueToString(data->storageProps, false)))
return -1;
@@ -2147,25 +2149,6 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virCommand *cmd,
}
-static int
-qemuBuildDiskSourceCommandLineFDs(virCommand *cmd,
- virDomainDiskDef *disk)
-{
- virStorageSource *n;
-
- for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
- qemuDomainStorageSourcePrivate *srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(n);
-
- if (!srcpriv || !srcpriv->fdpass)
- continue;
-
- qemuFDPassTransferCommand(srcpriv->fdpass, cmd);
- }
-
- return 0;
-}
-
-
static int
qemuBuildDiskSourceCommandLine(virCommand *cmd,
virDomainDiskDef *disk,
@@ -2183,9 +2166,6 @@ qemuBuildDiskSourceCommandLine(virCommand *cmd,
if (virStorageSourceIsEmpty(disk->src))
return 0;
- if (qemuBuildDiskSourceCommandLineFDs(cmd, disk) < 0)
- return -1;
-
if (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdev(disk->src)))
return -1;
@@ -10537,6 +10517,8 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSource *src,
tlsKeySecretAlias = srcpriv->tlsKeySecret->alias;
}
+
+ data->fdpass = srcpriv->fdpass;
}
if (src->haveTLS == VIR_TRISTATE_BOOL_YES &&
diff --git a/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args b/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args
index b4a81acfc7..a7ddd65000 100644
--- a/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args
@@ -33,13 +33,13 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-blockdev '{"driver":"file","filename":"/dev/fdset/2","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"qcow2","file":"libvirt-4-storage"}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-4-format","id":"virtio-disk4","bootindex":1}' \
--add-fd set=0,fd=704,opaque=libvirt-1-storage0 \
--add-fd set=1,fd=777,opaque=libvirt-2-storage0 \
--add-fd set=1,fd=778,opaque=libvirt-2-storage1 \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/rhel7.1484071876","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"qcow2","file":"libvirt-3-storage","backing":null}' \
+-add-fd set=1,fd=777,opaque=libvirt-2-storage0 \
+-add-fd set=1,fd=778,opaque=libvirt-2-storage1 \
-blockdev '{"driver":"file","filename":"/dev/fdset/1","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"qcow2","file":"libvirt-2-storage","backing":"libvirt-3-format"}' \
+-add-fd set=0,fd=704,opaque=libvirt-1-storage0 \
-blockdev '{"driver":"file","filename":"/dev/fdset/0","node-name":"libvirt-1-storage","read-only":false,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage","backing":"libvirt-2-format"}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-1-format","id":"virtio-disk5"}' \
--
2.39.1

View File

@ -1,39 +0,0 @@
From d0f4b44754db733db8a180aa18c06bb17dd21b1a Mon Sep 17 00:00:00 2001
Message-Id: <d0f4b44754db733db8a180aa18c06bb17dd21b1a@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 1 Mar 2023 17:09:42 +0100
Subject: [PATCH] qemu: domain: Fix logic when tainting domain
Originally the code was skipping all repeated taints with the same taint
flag but a logic bug introduced in commit 30626ed15b239c424ae inverted
the condition. This caused that actually the first occurence was NOT
logged but any subsequent was.
This was noticed when going through oVirt logs as they use custom guest
agent commands and the logs are totally spammed with this message.
Fixes: 30626ed15b239c424ae891f096057a696eadd715
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit 9134b40d0b43a5e1a9928b0a0d948205941d9807)
https://bugzilla.redhat.com/show_bug.cgi?id=2174446
---
src/qemu/qemu_domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 26408b90a2..374b881146 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6591,7 +6591,7 @@ void qemuDomainObjTaintMsg(virQEMUDriver *driver,
const char *extrasuffix = "";
va_list args;
- if (virDomainObjTaint(obj, taint)) {
+ if (!virDomainObjTaint(obj, taint)) {
/* If an extra message was given we must always
* emit the taint warning, otherwise it is a
* one-time only warning per VM
--
2.39.2

View File

@ -1,103 +0,0 @@
From 0fe11b92a8278ffab202033a61340649b0296368 Mon Sep 17 00:00:00 2001
Message-Id: <0fe11b92a8278ffab202033a61340649b0296368@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 31 Jan 2023 15:30:51 +0100
Subject: [PATCH] qemu: domain: Store fdset ID for disks passed to qemu via FD
To ensure that we can hot-unplug the disk including the associated fdset
we need to store the fdset ID in the status XML.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit f730b1e4f203cbabe363aab246d8a1679063f756)
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
---
src/qemu/qemu_domain.c | 17 ++++++++++++++++-
tests/qemustatusxml2xmldata/modern-in.xml | 3 +++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 226d4d6dc1..247134672b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1941,6 +1941,8 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
g_autofree char *httpcookiealias = NULL;
g_autofree char *tlskeyalias = NULL;
g_autofree char *thresholdEventWithIndex = NULL;
+ bool fdsetPresent = false;
+ unsigned int fdSetID;
src->nodestorage = virXPathString("string(./nodenames/nodename[@type='storage']/@name)", ctxt);
src->nodeformat = virXPathString("string(./nodenames/nodename[@type='format']/@name)", ctxt);
@@ -1957,7 +1959,9 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
httpcookiealias = virXPathString("string(./objects/secret[@type='httpcookie']/@alias)", ctxt);
tlskeyalias = virXPathString("string(./objects/secret[@type='tlskey']/@alias)", ctxt);
- if (authalias || encalias || httpcookiealias || tlskeyalias) {
+ fdsetPresent = virXPathUInt("string(./fdsets/fdset[@type='storage']/@id)", ctxt, &fdSetID) == 0;
+
+ if (authalias || encalias || httpcookiealias || tlskeyalias || fdsetPresent) {
if (!src->privateData &&
!(src->privateData = qemuDomainStorageSourcePrivateNew()))
return -1;
@@ -1975,6 +1979,9 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
if (qemuStorageSourcePrivateDataAssignSecinfo(&priv->tlsKeySecret, &tlskeyalias) < 0)
return -1;
+
+ if (fdsetPresent)
+ priv->fdpass = qemuFDPassNewPassed(fdSetID);
}
if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0)
@@ -2008,6 +2015,7 @@ qemuStorageSourcePrivateDataFormat(virStorageSource *src,
qemuDomainStorageSourcePrivate *srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
g_auto(virBuffer) nodenamesChildBuf = VIR_BUFFER_INIT_CHILD(buf);
g_auto(virBuffer) objectsChildBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) fdsetsChildBuf = VIR_BUFFER_INIT_CHILD(buf);
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='storage' name='%s'/>\n", src->nodestorage);
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='format' name='%s'/>\n", src->nodeformat);
@@ -2025,10 +2033,15 @@ qemuStorageSourcePrivateDataFormat(virStorageSource *src,
return -1;
if (srcPriv) {
+ unsigned int fdSetID;
+
qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->secinfo, "auth");
qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->encinfo, "encryption");
qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->httpcookie, "httpcookie");
qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->tlsKeySecret, "tlskey");
+
+ if (qemuFDPassIsPassed(srcPriv->fdpass, &fdSetID))
+ virBufferAsprintf(&fdsetsChildBuf, "<fdset type='storage' id='%u'/>\n", fdSetID);
}
if (src->tlsAlias)
@@ -2036,6 +2049,8 @@ qemuStorageSourcePrivateDataFormat(virStorageSource *src,
virXMLFormatElement(buf, "objects", NULL, &objectsChildBuf);
+ virXMLFormatElement(buf, "fdsets", NULL, &fdsetsChildBuf);
+
if (src->thresholdEventWithIndex)
virBufferAddLit(buf, "<thresholdEvent indexUsed='yes'/>\n");
diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml
index 7759034f7a..f5beab722b 100644
--- a/tests/qemustatusxml2xmldata/modern-in.xml
+++ b/tests/qemustatusxml2xmldata/modern-in.xml
@@ -341,6 +341,9 @@
<secret type='tlskey' alias='tls-certificate-key-alias'/>
<TLSx509 alias='transport-alias'/>
</objects>
+ <fdsets>
+ <fdset type='storage' id='1337'/>
+ </fdsets>
<thresholdEvent indexUsed='yes'/>
</privateData>
</source>
--
2.39.1

View File

@ -1,97 +0,0 @@
From f7d193539a8a7194ee3506642b68e0e52619cdf9 Mon Sep 17 00:00:00 2001
Message-Id: <f7d193539a8a7194ee3506642b68e0e52619cdf9@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 31 Jan 2023 15:25:57 +0100
Subject: [PATCH] qemu: fd: Add helpers allowing storing FD set data in status
XML
Rollback of FD sets passed to qemu is also needed after possible restart
of libvirtd when we need to serialize the data into status XML. For this
purpose we need to access the fdset ID once it was passed to qemu and
potentially re-create a 'qemuFDPass' struct in passed state.
Introduce 'qemuFDPassNewPassed' and 'qemuFDPassIsPassed'.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 5598c10c6464887a99928de48fb2fc3e4f1696dc)
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
---
src/qemu/qemu_fd.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_fd.h | 7 +++++++
2 files changed, 48 insertions(+)
diff --git a/src/qemu/qemu_fd.c b/src/qemu/qemu_fd.c
index ebeeb65505..f5eedb88ec 100644
--- a/src/qemu/qemu_fd.c
+++ b/src/qemu/qemu_fd.c
@@ -96,6 +96,47 @@ qemuFDPassNew(const char *prefix,
}
+/**
+ * qemuFDPassNewPassed:
+ * @fdSetID: ID of an FDset which was allready passed to qemu
+ *
+ * Create qemuFDPass pointing to an already passed FD. Useful to usw with
+ * qemuFDPassTransferMonitorRollback, when restoring after restart.
+ */
+qemuFDPass *
+qemuFDPassNewPassed(unsigned int fdSetID)
+{
+ qemuFDPass *fdpass = g_new0(qemuFDPass, 1);
+
+ fdpass->fdSetID = fdSetID;
+ fdpass->passed = true;
+
+ return fdpass;
+}
+
+
+/**
+ * qemuFDPassIsPassed:
+ * @fdpass: The fd passing helper struct
+ * @id: when non-NULL filled with the fdset ID
+ *
+ * Returns true if @fdpass was passed to qemu. In such case @id is also filled
+ * with the ID of the fdset if non-NULL.
+ */
+bool
+qemuFDPassIsPassed(qemuFDPass *fdpass,
+ unsigned *id)
+{
+ if (!fdpass || !fdpass->passed)
+ return false;
+
+ if (id)
+ *id = fdpass->fdSetID;
+
+ return true;
+}
+
+
/**
* qemuFDPassAddFD:
* @fdpass: The fd passing helper struct
diff --git a/src/qemu/qemu_fd.h b/src/qemu/qemu_fd.h
index 032b9442ee..cd0ff2c690 100644
--- a/src/qemu/qemu_fd.h
+++ b/src/qemu/qemu_fd.h
@@ -31,6 +31,13 @@ qemuFDPass *
qemuFDPassNew(const char *prefix,
void *dompriv);
+qemuFDPass *
+qemuFDPassNewPassed(unsigned int fdSetID);
+
+bool
+qemuFDPassIsPassed(qemuFDPass *fdpass,
+ unsigned *id);
+
void
qemuFDPassAddFD(qemuFDPass *fdpass,
int *fd,
--
2.39.1

View File

@ -1,51 +0,0 @@
From b6eb914119af7e724cbee27951cfba0a6afb3b97 Mon Sep 17 00:00:00 2001
Message-Id: <b6eb914119af7e724cbee27951cfba0a6afb3b97@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 19 Jan 2023 15:06:11 +0100
Subject: [PATCH] qemu: hotplug: Remove legacy quirk for 'dimm' address
generation
Commit b7798a07f93 (in fall of 2016) changed the way we generate aliases
for 'dimm' memory devices as the alias itself is part of the migration
stream section naming and thus must be treated as ABI.
The code added compatibility layer for VMs with memory hotplug started
with the old scheme to prevent from generating wrong aliases. The
compatibility layer broke though later when 'nvdimm' and 'pmem' devices
were introduced as it wrongly detected them as old configuration.
Now rather than attempting to fix the legacy compat layer to treat other
devices properly we'll be better off simply removing it as it's
extremely unlikely that somebody has a VM started in 2016 running with
today's libvirt and attempts to hotplug more memory.
This fixes a corner case when a user hot-adds a 'dimm' into a VM with a
'dimm' and a 'nvdimm' after restart of libvirtd and then attempts to
migrate the VM.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2158701
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 50ce3463d514950350143f03e8421c8c31889c5d)
---
src/qemu/qemu_hotplug.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 026e1ee5ad..5840504d13 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2275,9 +2275,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
goto cleanup;
releaseaddr = true;
- /* in cases where we are using a VM with aliases generated according to the
- * index of the memory device we need to keep continue using that scheme */
- if (qemuAssignDeviceMemoryAlias(vm->def, mem, priv->memAliasOrderMismatch) < 0)
+ if (qemuAssignDeviceMemoryAlias(vm->def, mem, false) < 0)
goto cleanup;
objalias = g_strdup_printf("mem%s", mem->info.alias);
--
2.39.1

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

@ -1,308 +0,0 @@
From 8a8d77f47e838413c829ee6202eb1f64613d12e1 Mon Sep 17 00:00:00 2001
Message-Id: <8a8d77f47e838413c829ee6202eb1f64613d12e1@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Tue, 21 Feb 2023 01:16:04 -0500
Subject: [PATCH] qemu: respond to NETDEV_STREAM_DISCONNECTED event
When a QEMU netdev is of type "stream", if the socket it uses for
connectivity to the host network gets closed, then QEMU will send a
NETDEV_STREAM_DISCONNECTED event. We know that any stream netdev we've
created is backed by a passt process, and if the socket was closed,
that means the passt process has disappeared.
When we receive this event, we can respond by starting a new passt
process with the same options (including socket path) we originally
used. If we have previously created the stream netdev device with a
"reconnect" option, then QEMU will automatically reconnect to this new
passt process. (If we hadn't used "reconnect", then QEMU will never
try to reconnect to the new passt process, so there's no point in
starting it.)
Note that NETDEV_STREAM_DISCONNECTED is an event sent for the netdev
(ie "host side") of the network device, and so it sends the
"netdev-id" to specify which device was disconnected. But libvirt's
virDomainNetDef (the object used to keep track of network devices) is
the internal representation of both the host-side "netdev", and the
guest side device, and virDomainNetDef doesn't directly keep track of
the netdev-id, only of the device's "alias" (which is the "id"
parameter of the *guest* side of the device). Fortunately, by convention
libvirt always names the host-side of devices as "host" + alias, so in
order to search for the affected NetDef, all we need to do is trim the
1st 4 characters from the netdev-id and look for the NetDef having
that resulting trimmed string as its alias. (Contrast this to
NIC_RX_FILTER_CHANGED, which is an event received for the guest side
of the device, and so directly contains the device alias.)
Resolves: https://bugzilla.redhat.com/2172098
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit f62ce81b8a57d8033be4c661e071cbd12b83bf7b)
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 76 ++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor.c | 11 ++++++
src/qemu/qemu_monitor.h | 6 +++
src/qemu/qemu_monitor_json.c | 16 ++++++++
src/qemu/qemu_process.c | 18 +++++++++
7 files changed, 129 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 247134672b..26408b90a2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11165,6 +11165,7 @@ qemuProcessEventFree(struct qemuProcessEvent *event)
break;
case QEMU_PROCESS_EVENT_WATCHDOG:
case QEMU_PROCESS_EVENT_DEVICE_DELETED:
+ case QEMU_PROCESS_EVENT_NETDEV_STREAM_DISCONNECTED:
case QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED:
case QEMU_PROCESS_EVENT_SERIAL_CHANGED:
case QEMU_PROCESS_EVENT_MONITOR_EOF:
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index eca5404cdc..fb9ab4c5ed 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -442,6 +442,7 @@ typedef enum {
QEMU_PROCESS_EVENT_WATCHDOG = 0,
QEMU_PROCESS_EVENT_GUESTPANIC,
QEMU_PROCESS_EVENT_DEVICE_DELETED,
+ QEMU_PROCESS_EVENT_NETDEV_STREAM_DISCONNECTED,
QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED,
QEMU_PROCESS_EVENT_SERIAL_CHANGED,
QEMU_PROCESS_EVENT_JOB_STATUS_CHANGE,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0603af6a35..d00b91fe0b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -40,6 +40,7 @@
#include "qemu_hostdev.h"
#include "qemu_hotplug.h"
#include "qemu_monitor.h"
+#include "qemu_passt.h"
#include "qemu_process.h"
#include "qemu_migration.h"
#include "qemu_migration_params.h"
@@ -3622,6 +3623,78 @@ processDeviceDeletedEvent(virQEMUDriver *driver,
}
+static void
+processNetdevStreamDisconnectedEvent(virDomainObj *vm,
+ const char *netdevId)
+{
+ virDomainDeviceDef dev;
+ virDomainNetDef *def;
+ virQEMUCaps *qemuCaps = QEMU_DOMAIN_PRIVATE(vm)->qemuCaps;
+ const char *devAlias = STRSKIP(netdevId, "host");
+
+ /* The event sends us the "netdev-id", but we don't store the
+ * netdev-id in the NetDef and thus can't use it to find the
+ * correct NetDef. We *do* keep the device alias in the NetDef,
+ * and by convention the netdev-id is always "host" + devAlias, so
+ * we just need to remove "host" from the front of netdev-id to
+ * get the alias, which we can then use to find the proper NetDef.
+ */
+
+ if (!devAlias) {
+ VIR_WARN("Received NETDEV_STREAM_DISCONNECTED event for unrecognized netdev %s from domain %p %s",
+ netdevId, vm, vm->def->name);
+ return;
+ }
+
+ VIR_DEBUG("Received NETDEV_STREAM_DISCONNECTED event for device %s from domain %p %s",
+ devAlias, vm, vm->def->name);
+
+ if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0)
+ return;
+
+ if (!virDomainObjIsActive(vm)) {
+ VIR_DEBUG("Domain is not running");
+ goto endjob;
+ }
+
+ if (virDomainDefFindDevice(vm->def, devAlias, &dev, true) < 0) {
+ VIR_WARN("NETDEV_STREAM_DISCONNECTED event received for non-existent device %s in domain %s",
+ devAlias, vm->def->name);
+ goto endjob;
+ }
+ if (dev.type != VIR_DOMAIN_DEVICE_NET) {
+ VIR_WARN("NETDEV_STREAM_DISCONNECTED event received for non-network device %s in domain %s",
+ devAlias, vm->def->name);
+ goto endjob;
+ }
+ def = dev.data.net;
+
+ if (def->backend.type != VIR_DOMAIN_NET_BACKEND_PASST) {
+ VIR_DEBUG("ignore NETDEV_STREAM_DISCONNECTED event for non-passt network device %s in domain %s",
+ def->info.alias, vm->def->name);
+ goto endjob;
+ }
+
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM_RECONNECT)) {
+ VIR_WARN("ignore NETDEV_STREAM_DISCONNECTED event for passt network device %s in domain %s - QEMU binary does not support reconnect",
+ def->info.alias, vm->def->name);
+ goto endjob;
+ }
+
+ /* handle the event - restart the passt process with its original
+ * parameters
+ */
+ VIR_DEBUG("process NETDEV_STREAM_DISCONNECTED event for network device %s in domain %s",
+ def->info.alias, vm->def->name);
+
+ if (qemuPasstStart(vm, def) < 0)
+ goto endjob;
+
+ endjob:
+ virDomainObjEndJob(vm);
+}
+
+
static void
processNicRxFilterChangedEvent(virDomainObj *vm,
const char *devAlias)
@@ -3971,6 +4044,9 @@ static void qemuProcessEventHandler(void *data, void *opaque)
case QEMU_PROCESS_EVENT_DEVICE_DELETED:
processDeviceDeletedEvent(driver, vm, processEvent->data);
break;
+ case QEMU_PROCESS_EVENT_NETDEV_STREAM_DISCONNECTED:
+ processNetdevStreamDisconnectedEvent(vm, processEvent->data);
+ break;
case QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED:
processNicRxFilterChangedEvent(vm, processEvent->data);
break;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 38f89167e0..1fa35f03cc 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1265,6 +1265,17 @@ qemuMonitorEmitNicRxFilterChanged(qemuMonitor *mon,
}
+void
+qemuMonitorEmitNetdevStreamDisconnected(qemuMonitor *mon,
+ const char *devAlias)
+{
+ VIR_DEBUG("mon=%p", mon);
+
+ QEMU_MONITOR_CALLBACK(mon, domainNetdevStreamDisconnected,
+ mon->vm, devAlias);
+}
+
+
void
qemuMonitorEmitSerialChange(qemuMonitor *mon,
const char *devAlias,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 2d16214ba2..2fa06b99a3 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -250,6 +250,9 @@ typedef void (*qemuMonitorDomainDeviceUnplugErrCallback)(qemuMonitor *mon,
virDomainObj *vm,
const char *devPath,
const char *devAlias);
+typedef void (*qemuMonitorDomainNetdevStreamDisconnectedCallback)(qemuMonitor *mon,
+ virDomainObj *vm,
+ const char *devAlias);
typedef void (*qemuMonitorDomainNicRxFilterChangedCallback)(qemuMonitor *mon,
virDomainObj *vm,
const char *devAlias);
@@ -397,6 +400,7 @@ struct _qemuMonitorCallbacks {
qemuMonitorDomainMemoryFailureCallback domainMemoryFailure;
qemuMonitorDomainMemoryDeviceSizeChange domainMemoryDeviceSizeChange;
qemuMonitorDomainDeviceUnplugErrCallback domainDeviceUnplugError;
+ qemuMonitorDomainNetdevStreamDisconnectedCallback domainNetdevStreamDisconnected;
};
qemuMonitor *qemuMonitorOpen(virDomainObj *vm,
@@ -480,6 +484,8 @@ void qemuMonitorEmitDeviceDeleted(qemuMonitor *mon,
void qemuMonitorEmitDeviceUnplugErr(qemuMonitor *mon,
const char *devPath,
const char *devAlias);
+void qemuMonitorEmitNetdevStreamDisconnected(qemuMonitor *mon,
+ const char *devAlias);
void qemuMonitorEmitNicRxFilterChanged(qemuMonitor *mon,
const char *devAlias);
void qemuMonitorEmitSerialChange(qemuMonitor *mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index db99017555..4510d0d3c9 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -84,6 +84,7 @@ static void qemuMonitorJSONHandleRdmaGidStatusChanged(qemuMonitor *mon, virJSONV
static void qemuMonitorJSONHandleMemoryFailure(qemuMonitor *mon, virJSONValue *data);
static void qemuMonitorJSONHandleMemoryDeviceSizeChange(qemuMonitor *mon, virJSONValue *data);
static void qemuMonitorJSONHandleDeviceUnplugErr(qemuMonitor *mon, virJSONValue *data);
+static void qemuMonitorJSONHandleNetdevStreamDisconnected(qemuMonitor *mon, virJSONValue *data);
typedef struct {
const char *type;
@@ -106,6 +107,7 @@ static qemuEventHandler eventHandlers[] = {
{ "MEMORY_FAILURE", qemuMonitorJSONHandleMemoryFailure, },
{ "MIGRATION", qemuMonitorJSONHandleMigrationStatus, },
{ "MIGRATION_PASS", qemuMonitorJSONHandleMigrationPass, },
+ { "NETDEV_STREAM_DISCONNECTED", qemuMonitorJSONHandleNetdevStreamDisconnected, },
{ "NIC_RX_FILTER_CHANGED", qemuMonitorJSONHandleNicRxFilterChanged, },
{ "PR_MANAGER_STATUS_CHANGED", qemuMonitorJSONHandlePRManagerStatusChanged, },
{ "RDMA_GID_STATUS_CHANGED", qemuMonitorJSONHandleRdmaGidStatusChanged, },
@@ -1021,6 +1023,20 @@ qemuMonitorJSONHandleDeviceUnplugErr(qemuMonitor *mon, virJSONValue *data)
}
+static void
+qemuMonitorJSONHandleNetdevStreamDisconnected(qemuMonitor *mon, virJSONValue *data)
+{
+ const char *name;
+
+ if (!(name = virJSONValueObjectGetString(data, "netdev-id"))) {
+ VIR_WARN("missing device in NETDEV_STREAM_DISCONNECTED event");
+ return;
+ }
+
+ qemuMonitorEmitNetdevStreamDisconnected(mon, name);
+}
+
+
static void
qemuMonitorJSONHandleNicRxFilterChanged(qemuMonitor *mon, virJSONValue *data)
{
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7ae859d68f..298904fe2e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1360,6 +1360,23 @@ qemuProcessHandleBlockThreshold(qemuMonitor *mon G_GNUC_UNUSED,
}
+static void
+qemuProcessHandleNetdevStreamDisconnected(qemuMonitor *mon G_GNUC_UNUSED,
+ virDomainObj *vm,
+ const char *devAlias)
+{
+ virObjectLock(vm);
+
+ VIR_DEBUG("Device %s Netdev Stream Disconnected in domain %p %s",
+ devAlias, vm, vm->def->name);
+
+ qemuProcessEventSubmit(vm, QEMU_PROCESS_EVENT_NETDEV_STREAM_DISCONNECTED,
+ 0, 0, g_strdup(devAlias));
+
+ virObjectUnlock(vm);
+}
+
+
static void
qemuProcessHandleNicRxFilterChanged(qemuMonitor *mon G_GNUC_UNUSED,
virDomainObj *vm,
@@ -1801,6 +1818,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
.domainMemoryFailure = qemuProcessHandleMemoryFailure,
.domainMemoryDeviceSizeChange = qemuProcessHandleMemoryDeviceSizeChange,
.domainDeviceUnplugError = qemuProcessHandleDeviceUnplugErr,
+ .domainNetdevStreamDisconnected = qemuProcessHandleNetdevStreamDisconnected,
};
static void
--
2.39.2

View File

@ -1,48 +0,0 @@
From accd96c210d9c45ec9bae0d9259cf713eb574d52 Mon Sep 17 00:00:00 2001
Message-Id: <accd96c210d9c45ec9bae0d9259cf713eb574d52@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Wed, 1 Mar 2023 15:58:24 -0500
Subject: [PATCH] qemu: set SELinux label of passt process to its own binary's
label
set useBinarySpecificLabel = true when calling qemuSecurityCommandRun
for the passt process, so that the new process context will include
the binary-specific label that should be used for passt (passt_t)
rather than svirt_t (as would happen if useBinarySpecificLabel was
false). (The MCS part of the label, which is common to all child
processes related to a particular qemu domain instance, is also set).
Resolves: https://bugzilla.redhat.com/2172267
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8419dd3b69cfada783a2e6df315e45dd294b0d18)
Conflicts:
src/qemu/qemu_passt.c
Another conflict caused by upstream-only change to arglist of
qemuSecurityCommandRun().
https://bugzilla.redhat.com/2172267
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_passt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index ed7b518212..ecf1c8cb6c 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -285,7 +285,7 @@ qemuPasstStart(virDomainObj *vm,
if (qemuExtDeviceLogCommand(driver, vm, cmd, "passt") < 0)
return -1;
- if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, false,
+ if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, true,
&exitstatus, &cmdret) < 0) {
goto error;
}
--
2.40.0

View File

@ -1,119 +0,0 @@
From a0dbc4911d7012f7ac6295998c4ea2439cf34f39 Mon Sep 17 00:00:00 2001
Message-Id: <a0dbc4911d7012f7ac6295998c4ea2439cf34f39@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 6 Mar 2023 15:38:15 +0100
Subject: [PATCH] qemu: validate: Fix logic for validating presence of the HPET
timer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit 24cc9cda826 switched over to use -machine hpet, but one of the
steps it did was to clear the QEMU_CAPS_NO_HPET capability.
The validation check still uses the old capability though which means
that for configs which would explicitly enable HPET we'd report an error.
Since HPET is an x86(_64) platform specific device, convert the
validation check to an architecture check as all supported qemu versions
actually support it.
Modify a test case to request HPET to catch posible future problems.
Fixes: 24cc9cda826
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 4ee4809907e63e83db032b5f90261f51ec864aa9)
https://bugzilla.redhat.com/show_bug.cgi?id=2175813
Conflicts:
tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
- retirement of '-no-acpi' wasn't backported
---
src/qemu/qemu_validate.c | 14 +++++++-------
.../q35-virt-manager-basic.x86_64-4.2.0.args | 1 -
.../q35-virt-manager-basic.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/q35-virt-manager-basic.xml | 2 +-
.../q35-virt-manager-basic.x86_64-latest.xml | 2 +-
5 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 6e04b22da4..fa088d6bcf 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -608,13 +608,13 @@ qemuValidateDomainDefClockTimers(const virDomainDef *def,
break;
case VIR_DOMAIN_TIMER_NAME_HPET:
- /* no hpet timer available. The only possible action
- is to raise an error if present="yes" */
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_HPET) &&
- timer->present == VIR_TRISTATE_BOOL_YES) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s", _("hpet timer is not supported"));
- return -1;
+ if (timer->present == VIR_TRISTATE_BOOL_YES) {
+ if (def->os.arch != VIR_ARCH_I686 &&
+ def->os.arch != VIR_ARCH_X86_64) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("hpet timer is not supported by this architecture"));
+ return -1;
+ }
}
break;
diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args
index 14093a3f80..f09d01a7cb 100644
--- a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args
+++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-4.2.0.args
@@ -23,7 +23,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-virt-manager-basic/.config \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay \
--no-hpet \
-no-shutdown \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
index 8446abdb6e..ecfbf3d0a5 100644
--- a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args
@@ -10,7 +10,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-virt-manager-basic/.config \
-name guest=virt-manager-basic,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-virt-manager-basic/master-key.aes"}' \
--machine q35,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=off \
+-machine q35,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=on \
-accel kvm \
-cpu qemu64 \
-m 4096 \
diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.xml b/tests/qemuxml2argvdata/q35-virt-manager-basic.xml
index c2d82c2c47..75075d0ab4 100644
--- a/tests/qemuxml2argvdata/q35-virt-manager-basic.xml
+++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.xml
@@ -16,7 +16,7 @@
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
- <timer name='hpet' present='no'/>
+ <timer name='hpet' present='yes'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
diff --git a/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml b/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml
index 62289d4800..997b42370a 100644
--- a/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/q35-virt-manager-basic.x86_64-latest.xml
@@ -19,7 +19,7 @@
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
- <timer name='hpet' present='no'/>
+ <timer name='hpet' present='yes'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
--
2.39.2

View File

@ -1,60 +0,0 @@
From 328cc56c14284fa7c026fd0fc4e4ab5d80bed9dd Mon Sep 17 00:00:00 2001
Message-Id: <328cc56c14284fa7c026fd0fc4e4ab5d80bed9dd@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 14 Mar 2023 17:19:27 +0100
Subject: [PATCH] qemuBuildMemoryBackendProps: Join two conditions
There are two compound conditions in
qemuBuildMemoryBackendProps() and each one checks for nodemask
for NULL first. Join them into one bigger block.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 450d932cd9a604d1e7d25c9f239cad08ca5e375c)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5edad046d5..436df47eaa 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3431,19 +3431,21 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
return -1;
}
- /* Make sure the requested nodeset is sensible */
- if (nodemask && !virNumaNodesetIsAvailable(nodemask))
- return -1;
-
- /* If mode is "restrictive", we should only use cgroups setting allowed memory
- * nodes, and skip passing the host-nodes and policy parameters to QEMU command
- * line which means we will use system default memory policy. */
- if (nodemask && mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
- if (virJSONValueObjectAdd(&props,
- "m:host-nodes", nodemask,
- "S:policy", qemuNumaPolicyTypeToString(mode),
- NULL) < 0)
+ if (nodemask) {
+ /* Make sure the requested nodeset is sensible */
+ if (!virNumaNodesetIsAvailable(nodemask))
return -1;
+
+ /* If mode is "restrictive", we should only use cgroups setting allowed memory
+ * nodes, and skip passing the host-nodes and policy parameters to QEMU command
+ * line which means we will use system default memory policy. */
+ if (mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
+ if (virJSONValueObjectAdd(&props,
+ "m:host-nodes", nodemask,
+ "S:policy", qemuNumaPolicyTypeToString(mode),
+ NULL) < 0)
+ return -1;
+ }
}
/* If none of the following is requested... */
--
2.40.0

View File

@ -1,138 +0,0 @@
From 45a585374500f4e4f1684c9dafe89269344c79b1 Mon Sep 17 00:00:00 2001
Message-Id: <45a585374500f4e4f1684c9dafe89269344c79b1@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Mar 2023 14:05:54 +0100
Subject: [PATCH] qemuBuildThreadContextProps: Prune .node-affinity wrt
<emulatorpin/>
When a thread-context object is specified on the cmd line, then
QEMU spawns a thread and sets its affinity to the list of NUMA
nodes specified in .node-affinity attribute. And this works just
fine, until the main QEMU thread itself is not restricted.
Because of v5.3.0-rc1~18 we restrict the main emulator thread
even before QEMU is executed and thus then it tries to set
affinity of a thread-context thread, it inevitably fails with:
Setting CPU affinity failed: Invalid argument
Now, we could lift the pinning temporarily, let QEMU spawn all
thread-context threads, and enforce pinning again, but that would
require some form of communication with QEMU (maybe -preconfig?).
But that would still be wrong, because it would circumvent
<emulatorpin/>.
Technically speaking, thread-context is an internal
implementation detail of QEMU, and if it weren't for it, the main
emulator thread would be doing the allocation. Therefore, we
should honor the pinning and prune the list of node so that
inaccessible ones are dropped.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2154750
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit df2ef2e706ec5960761bdbf619ea33be99482a15)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 25 ++++++++++++++++---
src/qemu/qemu_command.h | 1 +
...emory-hotplug-dimm-addr.x86_64-latest.args | 2 +-
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 346967f51c..b36005d248 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3533,7 +3533,7 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd,
def, mem, true, false, &nodemask) < 0)
return -1;
- if (qemuBuildThreadContextProps(&tcProps, &props, priv, nodemask) < 0)
+ if (qemuBuildThreadContextProps(&tcProps, &props, def, priv, nodemask) < 0)
return -1;
if (tcProps &&
@@ -3630,10 +3630,13 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
int
qemuBuildThreadContextProps(virJSONValue **tcProps,
virJSONValue **memProps,
+ const virDomainDef *def,
qemuDomainObjPrivate *priv,
virBitmap *nodemask)
{
g_autoptr(virJSONValue) props = NULL;
+ virBitmap *emulatorpin = NULL;
+ g_autoptr(virBitmap) emulatorNodes = NULL;
g_autofree char *tcAlias = NULL;
const char *memalias = NULL;
bool prealloc = false;
@@ -3650,6 +3653,22 @@ qemuBuildThreadContextProps(virJSONValue **tcProps,
!prealloc)
return 0;
+ emulatorpin = qemuDomainEvaluateCPUMask(def,
+ def->cputune.emulatorpin,
+ priv->autoNodeset);
+
+ if (emulatorpin && virNumaIsAvailable()) {
+ if (virNumaCPUSetToNodeset(emulatorpin, &emulatorNodes) < 0)
+ return -1;
+
+ virBitmapIntersect(emulatorNodes, nodemask);
+
+ if (virBitmapIsAllClear(emulatorNodes))
+ return 0;
+
+ nodemask = emulatorNodes;
+ }
+
memalias = virJSONValueObjectGetString(*memProps, "id");
if (!memalias) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -7064,7 +7083,7 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virCommand *cmd,
def, &mem, false, true, &nodemask) < 0)
return -1;
- if (qemuBuildThreadContextProps(&tcProps, &props, priv, nodemask) < 0)
+ if (qemuBuildThreadContextProps(&tcProps, &props, def, priv, nodemask) < 0)
return -1;
if (tcProps &&
@@ -7393,7 +7412,7 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
g_autoptr(virJSONValue) tcProps = NULL;
if (qemuBuildThreadContextProps(&tcProps, &nodeBackends[i],
- priv, nodemask[i]) < 0)
+ def, priv, nodemask[i]) < 0)
goto cleanup;
if (tcProps &&
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 17f326d13b..5fdb138030 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -153,6 +153,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
int
qemuBuildThreadContextProps(virJSONValue **tcProps,
virJSONValue **memProps,
+ const virDomainDef *def,
qemuDomainObjPrivate *priv,
virBitmap *nodemask);
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 4e9bbde448..bbfb0f9a9e 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args
@@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-no-acpi \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
--object '{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[1,2,3]}' \
+-object '{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[1,2]}' \
-object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","prealloc":true,"size":536870912,"host-nodes":[1,2,3],"policy":"bind","prealloc-context":"tc-memdimm0"}' \
-device '{"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","slot":0,"addr":4294967296}' \
-object '{"qom-type":"memory-backend-ram","id":"memdimm2","size":536870912}' \
--
2.40.0

View File

@ -1,51 +0,0 @@
From 01d7e15c8c4a33a379e8297182dc474bb2046d2a Mon Sep 17 00:00:00 2001
Message-Id: <01d7e15c8c4a33a379e8297182dc474bb2046d2a@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 27 Jan 2023 10:46:55 +0100
Subject: [PATCH] qemuExtTPMStop: Restore TPM state label more often
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When stopping swtpm we can restore the label either on just the
swtpm's domain specific logfile (/var/log/swtpm/libvirt/qemu/...),
or on the logfile and the state too (/var/lib/libvirt/swtpm/...).
The deciding factor is whether the guest is stopped because of
outgoing migration OR the state is on a shared filesystem.
But this is not correct condition, because for instance saving the
guest into a file (virsh save) is also an outgoing migration.
Alternatively, when the swtpm state is stored on a shared
filesystem, but the guest is destroyed (virsh destroy), i.e.
stopped because of different reason than migration, we want to
restore the seclabels.
The correct condition is: skip restoring the state on outgoing
migration AND shared filesystem.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2161557
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 794fddf866676ef4119b3acf43b5547a9e868bb9)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_tpm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index b2748eb6a4..5831ffc32e 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -1142,7 +1142,7 @@ qemuExtTPMStop(virQEMUDriver *driver,
return;
qemuTPMEmulatorStop(cfg->swtpmStateDir, shortName);
- if (outgoingMigration || qemuTPMHasSharedStorage(vm->def))
+ if (outgoingMigration && qemuTPMHasSharedStorage(vm->def))
restoreTPMStateLabel = false;
if (qemuSecurityRestoreTPMLabels(driver, vm, restoreTPMStateLabel) < 0)
--
2.39.1

View File

@ -1,38 +0,0 @@
From d96dc2b87c220298d4de031cff72fd9a458dad74 Mon Sep 17 00:00:00 2001
Message-Id: <d96dc2b87c220298d4de031cff72fd9a458dad74@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 31 Jan 2023 17:26:43 +0100
Subject: [PATCH] qemuFDPassTransferCommand: Mark that FD was passed
Until now the code didn't expect that we'd want to rollback/detach a FD
passed on the commandline, but whith disk backend FD passing this can
happen.
Properly mark the 'qemuFDPass' object as passed to qemu even when it was
done on the commandline.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 3b7b201b95f2facc01bd9f8a42aed0fad96789fa)
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
---
src/qemu/qemu_fd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/qemu/qemu_fd.c b/src/qemu/qemu_fd.c
index 51a8133fde..ebeeb65505 100644
--- a/src/qemu/qemu_fd.c
+++ b/src/qemu/qemu_fd.c
@@ -151,6 +151,8 @@ qemuFDPassTransferCommand(qemuFDPass *fdpass,
fdpass->fds[i].fd = -1;
virCommandAddArgList(cmd, "-add-fd", arg, NULL);
}
+
+ fdpass->passed = true;
}
--
2.39.1

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

@ -1,69 +0,0 @@
From dd64ec40a29739464cfe886818588bb9946b8d8d Mon Sep 17 00:00:00 2001
Message-Id: <dd64ec40a29739464cfe886818588bb9946b8d8d@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 27 Jan 2023 13:59:08 +0100
Subject: [PATCH] qemuProcessLaunch: Tighten rules for external devices wrt
incoming migration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When starting a guest, helper processes are started first. But
they need a bit of special handling. Just consider a regular cold
boot and an incoming migration. For instance, in case of swtpm
with its state on a shared volume, we want to set label on the
state for the cold boot case, but don't want to touch the label
in case of incoming migration (because the source very
specifically did not restore it either).
Until now, these two cases were differentiated by testing
@incoming against NULL. And while that makes sense for other
aspects of domain startup, for external devices we need a bit
more, because a restore from a save file is also 'incoming
migration'.
Now, there is a difference between regular migration and restore
from a save file. In the former case we do not want to set
seclabels in the save state. BUT, in the latter case we do need
to set them, because the code that saves the machine restored
seclabels.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2161557
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 5c4007ddc6c29632b5cc96ab4ef81ebb7797d1bb)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_process.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2de87211fb..1217fb1856 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7620,6 +7620,7 @@ qemuProcessLaunch(virConnectPtr conn,
size_t nnicindexes = 0;
g_autofree int *nicindexes = NULL;
unsigned long long maxMemLock = 0;
+ bool incomingMigrationExtDevices = false;
VIR_DEBUG("conn=%p driver=%p vm=%p name=%s id=%d asyncJob=%d "
"incoming.uri=%s "
@@ -7674,7 +7675,13 @@ qemuProcessLaunch(virConnectPtr conn,
if (qemuDomainSchedCoreStart(cfg, vm) < 0)
goto cleanup;
- if (qemuExtDevicesStart(driver, vm, incoming != NULL) < 0)
+ /* For external devices the rules of incoming migration are a bit stricter,
+ * than plain @incoming != NULL. They need to differentiate between
+ * incoming migration and restore from a save file. */
+ incomingMigrationExtDevices = incoming &&
+ vmop == VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START;
+
+ if (qemuExtDevicesStart(driver, vm, incomingMigrationExtDevices) < 0)
goto cleanup;
if (!(cmd = qemuBuildCommandLine(vm,
--
2.39.1

View File

@ -1,62 +0,0 @@
From b53d7b7150f81ee6f014815fa7ee3f1106c491d5 Mon Sep 17 00:00:00 2001
Message-Id: <b53d7b7150f81ee6f014815fa7ee3f1106c491d5@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 9 Feb 2023 09:40:32 +0100
Subject: [PATCH] qemuProcessRefreshDisks: Don't skip filling of disk
information if tray state didn't change
Commit 5ef2582646eb98 added emitting of even when refreshign disk state,
where it wanted to avoid sending the event if disk state didn't change.
This was achieved by using 'continue' in the loop filling the
information. Unfortunately this skips extraction of whether the device
has a tray which is propagated into internal structures, which in turn
broke cdrom media change as the code thought there's no tray for the
device.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2166411
Fixes: 5ef2582646eb98af208ce37355f82bdef39931fa
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
(cherry picked from commit 86cfe93ef7fdc2d665a2fc88b79af89e7978ba78)
---
src/qemu/qemu_process.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 32083de563..7ae859d68f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8713,16 +8713,13 @@ qemuProcessRefreshDisks(virDomainObj *vm,
continue;
if (info->removable) {
- virObjectEvent *event = NULL;
+ bool emitEvent = info->tray_open != disk->tray_status;
int reason;
if (info->empty)
virDomainDiskEmptySource(disk);
if (info->tray) {
- if (info->tray_open == disk->tray_status)
- continue;
-
if (info->tray_open) {
reason = VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN;
disk->tray_status = VIR_DOMAIN_DISK_TRAY_OPEN;
@@ -8731,8 +8728,10 @@ qemuProcessRefreshDisks(virDomainObj *vm,
disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
}
- event = virDomainEventTrayChangeNewFromObj(vm, disk->info.alias, reason);
- virObjectEventStateQueue(driver->domainEventState, event);
+ if (emitEvent) {
+ virObjectEvent *event = virDomainEventTrayChangeNewFromObj(vm, disk->info.alias, reason);
+ virObjectEventStateQueue(driver->domainEventState, event);
+ }
}
}
--
2.39.1

View File

@ -1,46 +0,0 @@
From 102efebe3cd2bfebace026744a7835309cf124fa Mon Sep 17 00:00:00 2001
Message-Id: <102efebe3cd2bfebace026744a7835309cf124fa@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 27 Jan 2023 10:45:50 +0100
Subject: [PATCH] qemuProcessStop: Fix detection of outgoing migration for
external devices
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When cleaning up host in qemuProcessStop(), our external helper
processes (e.g. swtpm) want to know whether the domain is being
migrated out or not (so that they restore seclabels on a device
state that's on a shared storage).
This fact is reflected in the @outgoingMigration variable which
is set to true if asyncJob is anything but
VIR_ASYNC_JOB_MIGRATION_IN. Well, we have a specific job for
outgoing migration (VIR_ASYNC_JOB_MIGRATION_OUT) and thus we
should check for that.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 88f0fbf63851c6ae80ad03b2a05a966d8a2f296c)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2161557
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 29716ecb19..2de87211fb 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8397,7 +8397,7 @@ void qemuProcessStop(virQEMUDriver *driver,
qemuDomainCleanupRun(driver, vm);
outgoingMigration = (flags & VIR_QEMU_PROCESS_STOP_MIGRATED) &&
- (asyncJob != VIR_ASYNC_JOB_MIGRATION_IN);
+ (asyncJob == VIR_ASYNC_JOB_MIGRATION_OUT);
qemuExtDevicesStop(driver, vm, outgoingMigration);
qemuDBusStop(driver, vm);
--
2.39.1

View File

@ -1,59 +0,0 @@
From deb6aad4f6bcfd95235d3149e9d69b95fe011294 Mon Sep 17 00:00:00 2001
Message-Id: <deb6aad4f6bcfd95235d3149e9d69b95fe011294@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 31 Jan 2023 15:19:58 +0100
Subject: [PATCH] qemuStorageSourcePrivateDataFormat: Rename 'tmp' to
'objectsChildBuf'
Be consistent with other children buffer variable naming scheme.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 531adf32743b6045f44964ec5e1f8bdb9c913797)
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
---
src/qemu/qemu_domain.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2eb5653254..226d4d6dc1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2005,9 +2005,9 @@ static int
qemuStorageSourcePrivateDataFormat(virStorageSource *src,
virBuffer *buf)
{
- g_auto(virBuffer) tmp = VIR_BUFFER_INIT_CHILD(buf);
qemuDomainStorageSourcePrivate *srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
g_auto(virBuffer) nodenamesChildBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) objectsChildBuf = VIR_BUFFER_INIT_CHILD(buf);
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='storage' name='%s'/>\n", src->nodestorage);
virBufferEscapeString(&nodenamesChildBuf, "<nodename type='format' name='%s'/>\n", src->nodeformat);
@@ -2025,16 +2025,16 @@ qemuStorageSourcePrivateDataFormat(virStorageSource *src,
return -1;
if (srcPriv) {
- qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->secinfo, "auth");
- qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->encinfo, "encryption");
- qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->httpcookie, "httpcookie");
- qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->tlsKeySecret, "tlskey");
+ qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->secinfo, "auth");
+ qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->encinfo, "encryption");
+ qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->httpcookie, "httpcookie");
+ qemuStorageSourcePrivateDataFormatSecinfo(&objectsChildBuf, srcPriv->tlsKeySecret, "tlskey");
}
if (src->tlsAlias)
- virBufferAsprintf(&tmp, "<TLSx509 alias='%s'/>\n", src->tlsAlias);
+ virBufferAsprintf(&objectsChildBuf, "<TLSx509 alias='%s'/>\n", src->tlsAlias);
- virXMLFormatElement(buf, "objects", NULL, &tmp);
+ virXMLFormatElement(buf, "objects", NULL, &objectsChildBuf);
if (src->thresholdEventWithIndex)
virBufferAddLit(buf, "<thresholdEvent indexUsed='yes'/>\n");
--
2.39.1

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

@ -1,44 +0,0 @@
From d78fc22fb96e0050a419623bf27639c63624c998 Mon Sep 17 00:00:00 2001
Message-Id: <d78fc22fb96e0050a419623bf27639c63624c998@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 10 Feb 2023 09:47:05 +0100
Subject: [PATCH] qemu_extdevice: Do cleanup host only for
VIR_DOMAIN_TPM_TYPE_EMULATOR
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We only set up host for VIR_DOMAIN_TPM_TYPE_EMULATOR and thus
similarly, we should do cleanup for the same type. This also
fixes a crasher, in which qemuTPMEmulatorCleanupHost() accesses
tpm->data.emulator.storagepath which is NULL for
VIR_DOMAIN_TPM_TYPE_EXTERNAL.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2168762
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 03f76e577d66f8eea6aa7cc513e75026527b4cda)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_extdevice.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
index f7b2e2e653..fdefe59215 100644
--- a/src/qemu/qemu_extdevice.c
+++ b/src/qemu/qemu_extdevice.c
@@ -162,7 +162,10 @@ qemuExtDevicesCleanupHost(virQEMUDriver *driver,
return;
for (i = 0; i < def->ntpms; i++) {
- qemuExtTPMCleanupHost(def->tpms[i], flags, outgoingMigration);
+ virDomainTPMDef *tpm = def->tpms[i];
+
+ if (tpm->type == VIR_DOMAIN_TPM_TYPE_EMULATOR)
+ qemuExtTPMCleanupHost(tpm, flags, outgoingMigration);
}
}
--
2.39.1

View File

@ -1,34 +0,0 @@
From bf949f570a232423c7cf01831dfbe7034a4f49d8 Mon Sep 17 00:00:00 2001
Message-Id: <bf949f570a232423c7cf01831dfbe7034a4f49d8@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 31 Jan 2023 15:23:54 +0100
Subject: [PATCH] qemu_fd: Remove declaration for 'qemuFDPassNewDirect'
The function doesn't exist any more.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 51dc38fe31beb252cc0fa2780210cdedc698f57f)
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
---
src/qemu/qemu_fd.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/qemu/qemu_fd.h b/src/qemu/qemu_fd.h
index 6f165b6be9..032b9442ee 100644
--- a/src/qemu/qemu_fd.h
+++ b/src/qemu/qemu_fd.h
@@ -30,9 +30,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuFDPass, qemuFDPassFree);
qemuFDPass *
qemuFDPassNew(const char *prefix,
void *dompriv);
-qemuFDPass *
-qemuFDPassNewDirect(const char *prefix,
- void *dompriv);
void
qemuFDPassAddFD(qemuFDPass *fdpass,
--
2.39.1

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

@ -1,56 +0,0 @@
From 25de0ead0194159a6d9a769f34ec5b092e9b718c Mon Sep 17 00:00:00 2001
Message-Id: <25de0ead0194159a6d9a769f34ec5b092e9b718c@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 23 Jan 2023 11:42:18 +0100
Subject: [PATCH] qemu_interface: Fix managed='no' case when creating an
ethernet interface
In a recent commit of v9.0.0-rc1~192 I've tried to forbid case
where a TAP device already exists, but at the same time it's
managed by Libvirt (<interface type='ethernet'> <target
dev='tap0' managed='yes'/> </interface>). NB, if @managed
attribute is missing then it's assumed to be managed by Libvirt.
Anyway, I've mistakenly put setting of
VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING flag into managed='yes'
branch instead of managed='no' branch in
qemuInterfaceEthernetConnect().
Move the setting of the flag into the correct branch.
Fixes: a2ae3d299cf9c5ada8aa42ec4271748eb479dc27
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit d6a8b9eef70887e01fa5fd292580e14ca5eab08c)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2144738
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_interface.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index b6895cedde..ed2c209167 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -443,6 +443,9 @@ qemuInterfaceEthernetConnect(virDomainDef *def,
_("target managed='no' but specified dev doesn't exist"));
goto cleanup;
}
+
+ tap_create_flags |= VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING;
+
if (virNetDevMacVLanIsMacvtap(net->ifname)) {
auditdev = net->ifname;
if (virNetDevMacVLanTapOpen(net->ifname, tapfd, tapfdSize) < 0)
@@ -461,8 +464,6 @@ qemuInterfaceEthernetConnect(virDomainDef *def,
if (!net->ifname)
template_ifname = true;
- tap_create_flags |= VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING;
-
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
tap_create_flags) < 0) {
goto cleanup;
--
2.39.1

View File

@ -1,59 +0,0 @@
From fd06fc3affcda0d7af1721c26915b8d87e0b2614 Mon Sep 17 00:00:00 2001
Message-Id: <fd06fc3affcda0d7af1721c26915b8d87e0b2614@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Feb 2023 15:06:32 +0100
Subject: [PATCH] qemu_namespace: Deal with nested mounts when umount()-ing
/dev
In one of recent commits (v9.0.0-rc1~106) I've made our QEMU
namespace code umount the original /dev. One of the reasons was
enhanced security, because previously we just mounted a tmpfs
over the original /dev. Thus a malicious QEMU could just
umount("/dev") and it would get to the original /dev with all
nodes.
Now, on some systems this introduced a regression:
failed to umount devfs on /dev: Device or resource busy
But how this could be? We've moved all file systems mounted under
/dev to a temporary location. Or have we? As it turns out, not
quite. If there are two file systems mounted on the same target,
e.g. like this:
mount -t tmpfs tmpfs /dev/shm/ && mount -t tmpfs tmpfs /dev/shm/
then only the top most (i.e. the last one) is moved. See
qemuDomainUnshareNamespace() for more info.
Now, we could enhance our code to deal with these "doubled" mount
points. Or, since it is the top most file system that is
accessible anyways (and this one is preserved), we can
umount("/dev") in a recursive fashion.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2167302
Fixes: 379c0ce4bfed8733dfbde557c359eecc5474ce38
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit 5155ab4b2a704285505dfea6ffee8b980fdaa29e)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index 5769a4dfe0..5fc043bd62 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -777,7 +777,7 @@ qemuDomainUnshareNamespace(virQEMUDriverConfig *cfg,
}
#if defined(__linux__)
- if (umount("/dev") < 0) {
+ if (umount2("/dev", MNT_DETACH) < 0) {
virReportSystemError(errno, "%s", _("failed to umount devfs on /dev"));
return -1;
}
--
2.39.1

View File

@ -1,35 +0,0 @@
From 47a82ef5bef2e549b9d6f7d20ad369b272e2c060 Mon Sep 17 00:00:00 2001
Message-Id: <47a82ef5bef2e549b9d6f7d20ad369b272e2c060@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 16 Feb 2023 12:00:58 +0100
Subject: [PATCH] qemu_passt: Avoid double daemonizing passt
When passt is started, it daemonizes itself by default. There's
no point in having our virCommand module daemonize it too.
Resolves: https://bugzilla.redhat.com/2169244
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit c0efdbdb9f66ab5a7334fd1dc75cdfdc28a7393d)
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_passt.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 78830fdc26..adc69fc052 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -156,7 +156,6 @@ qemuPasstStart(virDomainObj *vm,
virCommandClearCaps(cmd);
virCommandSetPidFile(cmd, pidfile);
virCommandSetErrorFD(cmd, &errfd);
- virCommandDaemonize(cmd);
virCommandAddArgList(cmd,
"--one-off",
--
2.39.2

View File

@ -1,84 +0,0 @@
From 42803b023873d2e416a58b4663c4679006f03253 Mon Sep 17 00:00:00 2001
Message-Id: <42803b023873d2e416a58b4663c4679006f03253@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 16 Feb 2023 12:07:42 +0100
Subject: [PATCH] qemu_passt: Deduplicate passt killing code
There are two places where we kill passt:
1) qemuPasstStop() - called transitively from qemuProcessStop(),
2) qemuPasstStart() - after failed start.
Now, the code from 2) lack error preservation (so if there's
another error during cleanup we might overwrite the original
error). Therefore, move the internals of qemuPasstStop() into a
separate function and call it from both places.
Resolves: https://bugzilla.redhat.com/2169244
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit e5bfc661bc181a36fa70250470554b20002fb84d)
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_passt.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index c082c149cd..2733f8e03f 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -102,11 +102,9 @@ qemuPasstAddNetProps(virDomainObj *vm,
}
-void
-qemuPasstStop(virDomainObj *vm,
- virDomainNetDef *net)
+static void
+qemuPasstKill(const char *pidfile)
{
- g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
virErrorPtr orig_err;
virErrorPreserveLast(&orig_err);
@@ -118,6 +116,16 @@ qemuPasstStop(virDomainObj *vm,
}
+void
+qemuPasstStop(virDomainObj *vm,
+ virDomainNetDef *net)
+{
+ g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
+
+ qemuPasstKill(pidfile);
+}
+
+
int
qemuPasstSetupCgroup(virDomainObj *vm,
virDomainNetDef *net,
@@ -147,7 +155,6 @@ qemuPasstStart(virDomainObj *vm,
g_autofree char *errbuf = NULL;
char macaddr[VIR_MAC_STRING_BUFLEN];
size_t i;
- pid_t pid = (pid_t) -1;
int exitstatus = 0;
int cmdret = 0;
@@ -273,10 +280,6 @@ qemuPasstStart(virDomainObj *vm,
return 0;
error:
- ignore_value(virPidFileReadPathIfLocked(pidfile, &pid));
- if (pid != -1)
- virProcessKillPainfully(pid, true);
- unlink(pidfile);
-
+ qemuPasstKill(pidfile);
return -1;
}
--
2.39.2

View File

@ -1,81 +0,0 @@
From 23c8e64cbbd9fe642f47808b19aba6cd5177fdd2 Mon Sep 17 00:00:00 2001
Message-Id: <23c8e64cbbd9fe642f47808b19aba6cd5177fdd2@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 16 Feb 2023 11:46:55 +0100
Subject: [PATCH] qemu_passt: Let passt write the PID file
The way we start passt currently is: we use
virCommandSetPidFile() to use our virCommand machinery to acquire
the PID file and leak opened FD into passt. Then, we use
virPidFile*() APIs to read the PID file (which is needed when
placing it into CGroups or killing it). But this does not fly
really because passt daemonizes itself. Thus the process we
started dies soon and thus the PID file is closed and unlocked.
We could work around this by passing '--foreground' argument, but
that weakens passt as it can't create new PID namespace (because
it doesn't fork()).
The solution is to let passt write the PID file, but since it
does not lock the file and closes it as soon as it is written, we
have to switch to those virPidFile APIs which don't expect PID
file to be locked.
Resolves: https://bugzilla.redhat.com/2169244
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit 029a892abdb2fe508f3fb77af00a14464b98b824)
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_passt.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 2733f8e03f..1217a6a087 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -72,7 +72,7 @@ qemuPasstGetPid(virDomainObj *vm,
{
g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
- return virPidFileReadPathIfLocked(pidfile, pid);
+ return virPidFileReadPath(pidfile, pid);
}
@@ -106,11 +106,14 @@ static void
qemuPasstKill(const char *pidfile)
{
virErrorPtr orig_err;
+ pid_t pid = 0;
virErrorPreserveLast(&orig_err);
- if (virPidFileForceCleanupPath(pidfile) < 0)
- VIR_WARN("Unable to kill passt process");
+ ignore_value(virPidFileReadPath(pidfile, &pid));
+ if (pid != 0)
+ virProcessKillPainfully(pid, true);
+ unlink(pidfile);
virErrorRestore(&orig_err);
}
@@ -161,13 +164,13 @@ qemuPasstStart(virDomainObj *vm,
cmd = virCommandNew(PASST);
virCommandClearCaps(cmd);
- virCommandSetPidFile(cmd, pidfile);
virCommandSetErrorBuffer(cmd, &errbuf);
virCommandAddArgList(cmd,
"--one-off",
"--socket", passtSocketName,
"--mac-addr", virMacAddrFormat(&net->mac, macaddr),
+ "--pid", pidfile,
NULL);
if (net->mtu) {
--
2.39.2

View File

@ -1,67 +0,0 @@
From 0c6f42b53f9b8f9ee60fd35d787528d0604d0bbb Mon Sep 17 00:00:00 2001
Message-Id: <0c6f42b53f9b8f9ee60fd35d787528d0604d0bbb@dist-git>
From: Stefano Brivio <sbrivio@redhat.com>
Date: Tue, 21 Feb 2023 20:19:07 +0100
Subject: [PATCH] qemu_passt: Remove passt socket file on exit
Just like it can't remove its own PID files, passt can't unlink its
own socket upon exit (unless the initialisation fails), because it
has no access to the filesystem at runtime.
Remove the socket file in qemuPasstKill().
Resolves: https://bugzilla.redhat.com/2169244
Fixes: a56f0168d576 ("qemu: hook up passt config to qemu domains")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit b7a18787de7c193dc68640668cc176ef9d887bc1)
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_passt.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 1217a6a087..88b7df4453 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -103,7 +103,7 @@ qemuPasstAddNetProps(virDomainObj *vm,
static void
-qemuPasstKill(const char *pidfile)
+qemuPasstKill(const char *pidfile, const char *passtSocketName)
{
virErrorPtr orig_err;
pid_t pid = 0;
@@ -115,6 +115,8 @@ qemuPasstKill(const char *pidfile)
virProcessKillPainfully(pid, true);
unlink(pidfile);
+ unlink(passtSocketName);
+
virErrorRestore(&orig_err);
}
@@ -124,8 +126,9 @@ qemuPasstStop(virDomainObj *vm,
virDomainNetDef *net)
{
g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
+ g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
- qemuPasstKill(pidfile);
+ qemuPasstKill(pidfile, passtSocketName);
}
@@ -283,6 +286,6 @@ qemuPasstStart(virDomainObj *vm,
return 0;
error:
- qemuPasstKill(pidfile);
+ qemuPasstKill(pidfile, passtSocketName);
return -1;
}
--
2.39.2

View File

@ -1,40 +0,0 @@
From 8e1bca7aacacedb0aa34eef1723f1d2d13958c10 Mon Sep 17 00:00:00 2001
Message-Id: <8e1bca7aacacedb0aa34eef1723f1d2d13958c10@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 13 Feb 2023 16:05:04 +0100
Subject: [PATCH] qemu_passt: Report error when getting passt PID failed
If qemuPasstGetPid() fails, or the passt's PID is -1 then
qemuPasstSetupCgroup() returns early without any error message
set. Report an appropriate error.
Resolves: https://bugzilla.redhat.com/2169244
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit 598a73335d70b4ef70b84f9730d708c116f88b15)
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_passt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 0f09bf3db8..78830fdc26 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -125,8 +125,11 @@ qemuPasstSetupCgroup(virDomainObj *vm,
{
pid_t pid = (pid_t) -1;
- if (qemuPasstGetPid(vm, net, &pid) < 0 || pid <= 0)
+ if (qemuPasstGetPid(vm, net, &pid) < 0 || pid <= 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not get process ID of passt"));
return -1;
+ }
return virCgroupAddProcess(cgroup, pid);
}
--
2.39.2

View File

@ -1,63 +0,0 @@
From 78a9316063050d84b39324470102330a89a1f76b Mon Sep 17 00:00:00 2001
Message-Id: <78a9316063050d84b39324470102330a89a1f76b@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 16 Feb 2023 12:19:26 +0100
Subject: [PATCH] qemu_passt: Report passt's error on failed start
When starting passt, it may write something onto its stderr
(convincing it to print even more is addressed later). Pass this
string we read to user.
Since we're not daemonizing passt anymore (see previous commit),
we can let virCommand module do all the heavy lifting and switch
to virCommandSetErrorBuffer() instead of reading error from an
FD.
Resolves: https://bugzilla.redhat.com/2169244
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit 02355840ced2af18df1aa9ba387a6137a515eede)
Signed-off-by: Laine Stump <laine@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 adc69fc052..c082c149cd 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -144,18 +144,18 @@ qemuPasstStart(virDomainObj *vm,
g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
g_autoptr(virCommand) cmd = NULL;
g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
+ g_autofree char *errbuf = NULL;
char macaddr[VIR_MAC_STRING_BUFLEN];
size_t i;
pid_t pid = (pid_t) -1;
int exitstatus = 0;
int cmdret = 0;
- VIR_AUTOCLOSE errfd = -1;
cmd = virCommandNew(PASST);
virCommandClearCaps(cmd);
virCommandSetPidFile(cmd, pidfile);
- virCommandSetErrorFD(cmd, &errfd);
+ virCommandSetErrorBuffer(cmd, &errbuf);
virCommandAddArgList(cmd,
"--one-off",
@@ -266,7 +266,7 @@ qemuPasstStart(virDomainObj *vm,
if (cmdret < 0 || exitstatus != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not start 'passt'. exitstatus: %d"), exitstatus);
+ _("Could not start 'passt': %s"), NULLSTR(errbuf));
goto error;
}
--
2.39.2

View File

@ -1,64 +0,0 @@
From 99f69000a1ecacc2f064043993ece8ddba366976 Mon Sep 17 00:00:00 2001
Message-Id: <99f69000a1ecacc2f064043993ece8ddba366976@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Feb 2023 10:34:40 +0100
Subject: [PATCH] qemu_process: Produce better debug message wrt domain
namespaces
When going through debug log of a domain startup process, one can
meet the following line:
debug : qemuProcessLaunch:7668 : Building mount namespace
But this is in fact wrong. Firstly, domain namespaces are just
enabled in domain's privateData. Secondly, the debug message says
nothing about actual state of namespace - whether it was enabled
or not.
Therefore, move the debug printing into
qemuProcessEnableDomainNamespaces() and tweak it so that the
actual value is reflected.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit 697c16e39ae9a9e18ce7cad0729bf2293b12a307)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2167302
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_process.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1217fb1856..32083de563 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7377,11 +7377,17 @@ qemuProcessEnableDomainNamespaces(virQEMUDriver *driver,
virDomainObj *vm)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
+ const char *state = "disabled";
if (virBitmapIsBitSet(cfg->namespaces, QEMU_DOMAIN_NS_MOUNT) &&
qemuDomainEnableNamespace(vm, QEMU_DOMAIN_NS_MOUNT) < 0)
return -1;
+ if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
+ state = "enabled";
+
+ VIR_DEBUG("Mount namespace for domain name=%s is %s",
+ vm->def->name, state);
return 0;
}
@@ -7705,8 +7711,6 @@ qemuProcessLaunch(virConnectPtr conn,
qemuDomainLogContextMarkPosition(logCtxt);
- VIR_DEBUG("Building mount namespace");
-
if (qemuProcessEnableDomainNamespaces(driver, vm) < 0)
goto cleanup;
--
2.39.1

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

@ -1,141 +0,0 @@
From 7289999ecc435bcc65881c64b49efba9746a9571 Mon Sep 17 00:00:00 2001
Message-Id: <7289999ecc435bcc65881c64b49efba9746a9571@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 21 Feb 2023 16:52:28 +0100
Subject: [PATCH] qemu_snapshot: refactor qemuSnapshotDeleteExternalPrepare
When user creates external snapshot with making only memory snapshot
without any disks deleting that snapshot failed without reporting any
meaningful error.
The issue is that the qemuSnapshotDeleteExternalPrepare function
returns NULL because the returned list is empty. This will not change
so to make it clear if the function fails or not return int instead and
have another parameter where we can pass the list.
With the fixed memory snapshot deletion it will now correctly delete
memory only snapshot as well.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2170826
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit e3957c22462bc52c37c94ca4d6fe3d26f8202119)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/qemu/qemu_snapshot.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 5cdcbc6290..cfa531edef 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -2301,9 +2301,10 @@ qemuSnapshotFindParentSnapForDisk(virDomainMomentObj *snap,
}
-static GSList*
+static int
qemuSnapshotDeleteExternalPrepare(virDomainObj *vm,
- virDomainMomentObj *snap)
+ virDomainMomentObj *snap,
+ GSList **externalData)
{
ssize_t i;
virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
@@ -2320,7 +2321,7 @@ qemuSnapshotDeleteExternalPrepare(virDomainObj *vm,
virReportError(VIR_ERR_OPERATION_INVALID,
_("snapshot disk '%s' was target of not completed snapshot delete"),
snapDisk->name);
- return NULL;
+ return -1;
}
data = g_new0(qemuSnapshotDeleteExternalData, 1);
@@ -2328,18 +2329,18 @@ qemuSnapshotDeleteExternalPrepare(virDomainObj *vm,
data->domDisk = qemuDomainDiskByName(vm->def, snapDisk->name);
if (!data->domDisk)
- return NULL;
+ return -1;
data->diskSrc = virStorageSourceChainLookupBySource(data->domDisk->src,
data->snapDisk->src,
&data->prevDiskSrc);
if (!data->diskSrc)
- return NULL;
+ return -1;
if (!virStorageSourceIsSameLocation(data->diskSrc, data->snapDisk->src)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("VM disk source and snapshot disk source are not the same"));
- return NULL;
+ return -1;
}
data->parentDomDisk = virDomainDiskByTarget(snapdef->parent.dom,
@@ -2348,7 +2349,7 @@ qemuSnapshotDeleteExternalPrepare(virDomainObj *vm,
virReportError(VIR_ERR_OPERATION_FAILED,
_("failed to find disk '%s' in snapshot VM XML"),
snapDisk->name);
- return NULL;
+ return -1;
}
if (virDomainObjIsActive(vm)) {
@@ -2356,13 +2357,13 @@ qemuSnapshotDeleteExternalPrepare(virDomainObj *vm,
if (!virStorageSourceIsBacking(data->parentDiskSrc)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("failed to find parent disk source in backing chain"));
- return NULL;
+ return -1;
}
if (!virStorageSourceIsSameLocation(data->parentDiskSrc, data->parentDomDisk->src)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("snapshot VM disk source and parent disk source are not the same"));
- return NULL;
+ return -1;
}
}
@@ -2371,15 +2372,16 @@ qemuSnapshotDeleteExternalPrepare(virDomainObj *vm,
if (data->parentSnap && !virDomainSnapshotIsExternal(data->parentSnap)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("deleting external snapshot that has internal snapshot as parent not supported"));
- return NULL;
+ return -1;
}
ret = g_slist_prepend(ret, g_steal_pointer(&data));
}
ret = g_slist_reverse(ret);
+ *externalData = g_steal_pointer(&ret);
- return g_steal_pointer(&ret);
+ return 0;
}
@@ -3159,7 +3161,7 @@ qemuSnapshotDelete(virDomainObj *vm,
g_autoslist(qemuSnapshotDeleteExternalData) tmpData = NULL;
/* this also serves as validation whether the snapshot can be deleted */
- if (!(tmpData = qemuSnapshotDeleteExternalPrepare(vm, snap)))
+ if (qemuSnapshotDeleteExternalPrepare(vm, snap, &tmpData) < 0)
goto endjob;
if (!virDomainObjIsActive(vm)) {
@@ -3174,7 +3176,7 @@ qemuSnapshotDelete(virDomainObj *vm,
/* Call the prepare again as some data require that the VM is
* running to get everything we need. */
- if (!(externalData = qemuSnapshotDeleteExternalPrepare(vm, snap)))
+ if (qemuSnapshotDeleteExternalPrepare(vm, snap, &externalData) < 0)
goto endjob;
} else {
qemuDomainJobPrivate *jobPriv = vm->job->privateData;
--
2.39.1

View File

@ -1,73 +0,0 @@
From 3ef43d47b0a5a49b0896b1725476b4b6ec0629b0 Mon Sep 17 00:00:00 2001
Message-Id: <3ef43d47b0a5a49b0896b1725476b4b6ec0629b0@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 21 Feb 2023 16:10:56 +0100
Subject: [PATCH] qemu_snapshot: remove memory snapshot when deleting external
snapshot
When deleting external snapshot we should remove the memory snapshot
file as well.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 356e227208ec66fff178b91ed4b1197c7e6cf974)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2170826
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/qemu/qemu_snapshot.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index b8416808b3..5cdcbc6290 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -2684,9 +2684,11 @@ qemuSnapshotSetInvalid(virDomainObj *vm,
static int
qemuSnapshotDiscardExternal(virDomainObj *vm,
+ virDomainMomentObj *snap,
GSList *externalData)
{
GSList *cur = NULL;
+ virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
for (cur = externalData; cur; cur = g_slist_next(cur)) {
qemuSnapshotDeleteExternalData *data = cur->data;
@@ -2756,6 +2758,14 @@ qemuSnapshotDiscardExternal(virDomainObj *vm,
goto error;
}
+ if (snapdef->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL &&
+ snapdef->memorysnapshotfile) {
+ if (unlink(snapdef->memorysnapshotfile) < 0) {
+ VIR_WARN("failed to remove memory snapshot '%s'",
+ snapdef->memorysnapshotfile);
+ }
+ }
+
return 0;
error:
@@ -2886,7 +2896,7 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver,
}
if (virDomainSnapshotIsExternal(snap)) {
- if (qemuSnapshotDiscardExternal(vm, externalData) < 0)
+ if (qemuSnapshotDiscardExternal(vm, snap, externalData) < 0)
return -1;
} else {
if (qemuDomainSnapshotForEachQcow2(driver, def, snap, "-d", true) < 0)
@@ -2894,7 +2904,7 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver,
}
} else {
if (virDomainSnapshotIsExternal(snap)) {
- if (qemuSnapshotDiscardExternal(vm, externalData) < 0)
+ if (qemuSnapshotDiscardExternal(vm, snap, externalData) < 0)
return -1;
} else {
/* Similarly as internal snapshot creation we would use a regular job
--
2.39.1

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

@ -1,157 +0,0 @@
From 340bb04ed8b9a455880b0cbac7228bb17a9679d8 Mon Sep 17 00:00:00 2001
Message-Id: <340bb04ed8b9a455880b0cbac7228bb17a9679d8@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Mar 2023 16:06:03 +0100
Subject: [PATCH] qemuxml2argvdata: Adjust maximum NUMA node used
We have couple of qemuxml2argvtest cases where up to 8 NUMA nodes
are assumed. These are used to check whether disjoint ranges of
host-nodes= is generated properly. Without prejudice to the
generality, we can rewrite corresponding XML files to use up to 4
NUMA nodes and still have disjoint ranges.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit d91ca262fba8c942449cb5f705f309fcf4baf05a)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
tests/qemuxml2argvdata/migrate-numa-unaligned.args | 4 ++--
tests/qemuxml2argvdata/migrate-numa-unaligned.xml | 4 ++--
tests/qemuxml2argvdata/numatune-memnode-restrictive-mode.xml | 4 ++--
tests/qemuxml2argvdata/numatune-memnode.args | 4 ++--
tests/qemuxml2argvdata/numatune-memnode.x86_64-5.2.0.args | 4 ++--
tests/qemuxml2argvdata/numatune-memnode.x86_64-latest.args | 4 ++--
tests/qemuxml2argvdata/numatune-memnode.xml | 4 ++--
tests/qemuxml2xmloutdata/numatune-memnode.xml | 4 ++--
8 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/tests/qemuxml2argvdata/migrate-numa-unaligned.args b/tests/qemuxml2argvdata/migrate-numa-unaligned.args
index b50d93a12f..4786045358 100644
--- a/tests/qemuxml2argvdata/migrate-numa-unaligned.args
+++ b/tests/qemuxml2argvdata/migrate-numa-unaligned.args
@@ -17,9 +17,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest/.config \
-smp 32,sockets=32,cores=1,threads=1 \
-object memory-backend-ram,id=ram-node0,size=20482048,host-nodes=3,policy=preferred \
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
--object memory-backend-ram,id=ram-node1,size=675907584,host-nodes=0-7,policy=bind \
+-object memory-backend-ram,id=ram-node1,size=675907584,host-nodes=0-3,policy=bind \
-numa node,nodeid=1,cpus=1-27,cpus=29,memdev=ram-node1 \
--object memory-backend-ram,id=ram-node2,size=24578457600,host-nodes=1-2,host-nodes=5,host-nodes=7,policy=bind \
+-object memory-backend-ram,id=ram-node2,size=24578457600,host-nodes=0,host-nodes=2,policy=bind \
-numa node,nodeid=2,cpus=28,cpus=30-31,memdev=ram-node2 \
-uuid 9f4b6512-e73a-4a25-93e8-5307802821ce \
-display none \
diff --git a/tests/qemuxml2argvdata/migrate-numa-unaligned.xml b/tests/qemuxml2argvdata/migrate-numa-unaligned.xml
index e46b723acb..c060852297 100644
--- a/tests/qemuxml2argvdata/migrate-numa-unaligned.xml
+++ b/tests/qemuxml2argvdata/migrate-numa-unaligned.xml
@@ -6,8 +6,8 @@
<vcpu placement='static'>32</vcpu>
<numatune>
<memnode cellid='0' mode='preferred' nodeset='3'/>
- <memory mode='strict' nodeset='0-7'/>
- <memnode cellid='2' mode='strict' nodeset='1-2,5-7,^6'/>
+ <memory mode='strict' nodeset='0-3'/>
+ <memnode cellid='2' mode='strict' nodeset='0-2,^1'/>
</numatune>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
diff --git a/tests/qemuxml2argvdata/numatune-memnode-restrictive-mode.xml b/tests/qemuxml2argvdata/numatune-memnode-restrictive-mode.xml
index 012c526460..2a640f5501 100644
--- a/tests/qemuxml2argvdata/numatune-memnode-restrictive-mode.xml
+++ b/tests/qemuxml2argvdata/numatune-memnode-restrictive-mode.xml
@@ -5,9 +5,9 @@
<currentMemory unit='KiB'>24682468</currentMemory>
<vcpu placement='static'>32</vcpu>
<numatune>
- <memory mode='restrictive' nodeset='0-7'/>
+ <memory mode='restrictive' nodeset='0-3'/>
<memnode cellid='0' mode='restrictive' nodeset='3'/>
- <memnode cellid='2' mode='restrictive' nodeset='1-2,5,7'/>
+ <memnode cellid='2' mode='restrictive' nodeset='1-2'/>
</numatune>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
diff --git a/tests/qemuxml2argvdata/numatune-memnode.args b/tests/qemuxml2argvdata/numatune-memnode.args
index 1564a0ddd6..dd0fea62e6 100644
--- a/tests/qemuxml2argvdata/numatune-memnode.args
+++ b/tests/qemuxml2argvdata/numatune-memnode.args
@@ -17,9 +17,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest/.config \
-smp 32,sockets=32,cores=1,threads=1 \
-object memory-backend-ram,id=ram-node0,size=20971520,host-nodes=3,policy=preferred \
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
--object memory-backend-ram,id=ram-node1,size=676331520,host-nodes=0-7,policy=bind \
+-object memory-backend-ram,id=ram-node1,size=676331520,host-nodes=0-3,policy=bind \
-numa node,nodeid=1,cpus=1-27,cpus=29,memdev=ram-node1 \
--object memory-backend-ram,id=ram-node2,size=24578621440,host-nodes=1-2,host-nodes=5,host-nodes=7,policy=bind \
+-object memory-backend-ram,id=ram-node2,size=24578621440,host-nodes=0,host-nodes=2,policy=bind \
-numa node,nodeid=2,cpus=28,cpus=30-31,memdev=ram-node2 \
-uuid 9f4b6512-e73a-4a25-93e8-5307802821ce \
-display none \
diff --git a/tests/qemuxml2argvdata/numatune-memnode.x86_64-5.2.0.args b/tests/qemuxml2argvdata/numatune-memnode.x86_64-5.2.0.args
index 81913e0e18..85f083efc9 100644
--- a/tests/qemuxml2argvdata/numatune-memnode.x86_64-5.2.0.args
+++ b/tests/qemuxml2argvdata/numatune-memnode.x86_64-5.2.0.args
@@ -18,9 +18,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest/.config \
-smp 32,sockets=32,cores=1,threads=1 \
-object memory-backend-ram,id=ram-node0,size=20971520,host-nodes=3,policy=preferred \
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
--object memory-backend-ram,id=ram-node1,size=676331520,host-nodes=0-7,policy=bind \
+-object memory-backend-ram,id=ram-node1,size=676331520,host-nodes=0-3,policy=bind \
-numa node,nodeid=1,cpus=1-27,cpus=29,memdev=ram-node1 \
--object memory-backend-ram,id=ram-node2,size=24578621440,host-nodes=1-2,host-nodes=5,host-nodes=7,policy=bind \
+-object memory-backend-ram,id=ram-node2,size=24578621440,host-nodes=0,host-nodes=2,policy=bind \
-numa node,nodeid=2,cpus=28,cpus=30-31,memdev=ram-node2 \
-uuid 9f4b6512-e73a-4a25-93e8-5307802821ce \
-display none \
diff --git a/tests/qemuxml2argvdata/numatune-memnode.x86_64-latest.args b/tests/qemuxml2argvdata/numatune-memnode.x86_64-latest.args
index 7cb7e659a4..6d4baebc83 100644
--- a/tests/qemuxml2argvdata/numatune-memnode.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/numatune-memnode.x86_64-latest.args
@@ -18,9 +18,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest/.config \
-smp 32,sockets=32,cores=1,threads=1 \
-object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":20971520,"host-nodes":[3],"policy":"preferred"}' \
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
--object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":676331520,"host-nodes":[0,1,2,3,4,5,6,7],"policy":"bind"}' \
+-object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":676331520,"host-nodes":[0,1,2,3],"policy":"bind"}' \
-numa node,nodeid=1,cpus=1-27,cpus=29,memdev=ram-node1 \
--object '{"qom-type":"memory-backend-ram","id":"ram-node2","size":24578621440,"host-nodes":[1,2,5,7],"policy":"bind"}' \
+-object '{"qom-type":"memory-backend-ram","id":"ram-node2","size":24578621440,"host-nodes":[0,2],"policy":"bind"}' \
-numa node,nodeid=2,cpus=28,cpus=30-31,memdev=ram-node2 \
-uuid 9f4b6512-e73a-4a25-93e8-5307802821ce \
-display none \
diff --git a/tests/qemuxml2argvdata/numatune-memnode.xml b/tests/qemuxml2argvdata/numatune-memnode.xml
index dd653c5d3b..9640eeb945 100644
--- a/tests/qemuxml2argvdata/numatune-memnode.xml
+++ b/tests/qemuxml2argvdata/numatune-memnode.xml
@@ -6,8 +6,8 @@
<vcpu placement='static'>32</vcpu>
<numatune>
<memnode cellid='0' mode='preferred' nodeset='3'/>
- <memory mode='strict' nodeset='0-7'/>
- <memnode cellid='2' mode='strict' nodeset='1-2,5-7,^6'/>
+ <memory mode='strict' nodeset='0-3'/>
+ <memnode cellid='2' mode='strict' nodeset='0-2,^1'/>
</numatune>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
diff --git a/tests/qemuxml2xmloutdata/numatune-memnode.xml b/tests/qemuxml2xmloutdata/numatune-memnode.xml
index 104d2e6d4c..a117745bfb 100644
--- a/tests/qemuxml2xmloutdata/numatune-memnode.xml
+++ b/tests/qemuxml2xmloutdata/numatune-memnode.xml
@@ -5,9 +5,9 @@
<currentMemory unit='KiB'>24682468</currentMemory>
<vcpu placement='static'>32</vcpu>
<numatune>
- <memory mode='strict' nodeset='0-7'/>
+ <memory mode='strict' nodeset='0-3'/>
<memnode cellid='0' mode='preferred' nodeset='3'/>
- <memnode cellid='2' mode='strict' nodeset='1-2,5,7'/>
+ <memnode cellid='2' mode='strict' nodeset='0,2'/>
</numatune>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
--
2.40.0

View File

@ -1,53 +0,0 @@
From 04203191c0261c6a12475865c7053e62b79756ee Mon Sep 17 00:00:00 2001
Message-Id: <04203191c0261c6a12475865c7053e62b79756ee@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Mar 2023 15:36:47 +0100
Subject: [PATCH] qemuxml2argvdata: Extend vCPUs placement in
memory-hotplug-dimm-addr.xml
So far, the memory-hotplug-dimm-addr.xml test case pins its vCPUs
onto CPUs 0-1 which correspond to NUMA node #0 (per
tests/vircaps2xmldata/linux-basic/system/node/node0). Place vCPUs
onto nodes #1 and #2 too so that DIMM <memory/> device can
continue using thread-context after future patches. This
configuration, as-is currently, would make QEMU error out anyway.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit c4c90063a5955bca9f5afb5fe03502d3503241c3)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
tests/qemuxml2argvdata/memory-hotplug-dimm-addr.xml | 2 +-
.../memory-hotplug-dimm-addr.x86_64-latest.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.xml b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.xml
index 92ea679bbe..47486dda0c 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.xml
@@ -4,7 +4,7 @@
<maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
<memory unit='KiB'>7434230</memory>
<currentMemory unit='KiB'>7434230</currentMemory>
- <vcpu placement='static' cpuset='0-1'>2</vcpu>
+ <vcpu placement='static' cpuset='0-1,4-5,9'>2</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
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 ef671fcfa3..0a32d5491a 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml
@@ -4,7 +4,7 @@
<maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
<memory unit='KiB'>7434230</memory>
<currentMemory unit='KiB'>7434230</currentMemory>
- <vcpu placement='static' cpuset='0-1'>2</vcpu>
+ <vcpu placement='static' cpuset='0-1,4-5,9'>2</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
--
2.40.0

View File

@ -1,122 +0,0 @@
From 2ffa5538e4f7507a77fdb7ac23bdc8aa51e54297 Mon Sep 17 00:00:00 2001
Message-Id: <2ffa5538e4f7507a77fdb7ac23bdc8aa51e54297@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Mar 2023 16:06:14 +0100
Subject: [PATCH] qemuxml2argvmock: Drop virNuma* mocks
Since qemuxml2argvtest is now using virnumamock, there's no need
for qemuxml2argvmock to offer reimplementation of virNuma*()
functions. Also, the comment about CLang and FreeBSD (introduced
in v4.3.0-40-g77ac204d14) is no longer true. Looks like noinline
attribute was the missing culprit.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 95ae91fdd4da33323ead8f916824b48f8506383c)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/util/virnuma.h | 2 +-
...-unavailable-restrictive.x86_64-latest.err | 2 +-
...mnode-unavailable-strict.x86_64-latest.err | 2 +-
...umatune-static-nodeset-exceed-hostnode.err | 2 +-
tests/qemuxml2argvmock.c | 42 -------------------
5 files changed, 4 insertions(+), 46 deletions(-)
diff --git a/src/util/virnuma.h b/src/util/virnuma.h
index edd701d5c8..475df96e1d 100644
--- a/src/util/virnuma.h
+++ b/src/util/virnuma.h
@@ -32,7 +32,7 @@ int virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode,
virBitmap *nodeset);
virBitmap *virNumaGetHostMemoryNodeset(void);
-bool virNumaNodesetIsAvailable(virBitmap *nodeset) G_NO_INLINE;
+bool virNumaNodesetIsAvailable(virBitmap *nodeset);
bool virNumaIsAvailable(void) G_NO_INLINE;
int virNumaGetMaxNode(void) G_NO_INLINE;
bool virNumaNodeIsAvailable(int node) G_NO_INLINE;
diff --git a/tests/qemuxml2argvdata/numatune-memnode-unavailable-restrictive.x86_64-latest.err b/tests/qemuxml2argvdata/numatune-memnode-unavailable-restrictive.x86_64-latest.err
index a826c3cdeb..f872dd7e92 100644
--- a/tests/qemuxml2argvdata/numatune-memnode-unavailable-restrictive.x86_64-latest.err
+++ b/tests/qemuxml2argvdata/numatune-memnode-unavailable-restrictive.x86_64-latest.err
@@ -1 +1 @@
-internal error: Mock: no numa node set is available at bit 999
+unsupported configuration: NUMA node 999 is unavailable
diff --git a/tests/qemuxml2argvdata/numatune-memnode-unavailable-strict.x86_64-latest.err b/tests/qemuxml2argvdata/numatune-memnode-unavailable-strict.x86_64-latest.err
index a826c3cdeb..f872dd7e92 100644
--- a/tests/qemuxml2argvdata/numatune-memnode-unavailable-strict.x86_64-latest.err
+++ b/tests/qemuxml2argvdata/numatune-memnode-unavailable-strict.x86_64-latest.err
@@ -1 +1 @@
-internal error: Mock: no numa node set is available at bit 999
+unsupported configuration: NUMA node 999 is unavailable
diff --git a/tests/qemuxml2argvdata/numatune-static-nodeset-exceed-hostnode.err b/tests/qemuxml2argvdata/numatune-static-nodeset-exceed-hostnode.err
index b6b98775ee..2a33ccd791 100644
--- a/tests/qemuxml2argvdata/numatune-static-nodeset-exceed-hostnode.err
+++ b/tests/qemuxml2argvdata/numatune-static-nodeset-exceed-hostnode.err
@@ -1 +1 @@
-internal error: Mock: no numa node set is available at bit 8
+unsupported configuration: NUMA node 4 is unavailable
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index 85bd76c315..f566ec539a 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -30,7 +30,6 @@
#include "virnetdevip.h"
#include "virnetdevtap.h"
#include "virnetdevopenvswitch.h"
-#include "virnuma.h"
#include "virscsivhost.h"
#include "virtpm.h"
#include "virutil.h"
@@ -56,47 +55,6 @@ GDateTime *g_date_time_new_now_local(void)
return g_date_time_new_from_unix_local(1234567890);
}
-bool
-virNumaIsAvailable(void)
-{
- return true;
-}
-
-int
-virNumaGetMaxNode(void)
-{
- return 7;
-}
-
-/* We shouldn't need to mock virNumaNodeIsAvailable() and *definitely* not
- * virNumaNodesetIsAvailable(), but it seems to be the only way to get
- * mocking to work with Clang on FreeBSD, so keep these duplicates around
- * until we figure out a cleaner solution */
-bool
-virNumaNodeIsAvailable(int node)
-{
- return node >= 0 && node <= virNumaGetMaxNode();
-}
-
-bool
-virNumaNodesetIsAvailable(virBitmap *nodeset)
-{
- ssize_t bit = -1;
-
- if (!nodeset)
- return true;
-
- while ((bit = virBitmapNextSetBit(nodeset, bit)) >= 0) {
- if (virNumaNodeIsAvailable(bit))
- continue;
-
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "Mock: no numa node set is available at bit %zd", bit);
- return false;
- }
-
- return true;
-}
char *
virTPMCreateCancelPath(const char *devpath)
--
2.40.0

View File

@ -1,78 +0,0 @@
From 2349387743e56e658fb56fcdadd522e6df9f42f2 Mon Sep 17 00:00:00 2001
Message-Id: <2349387743e56e658fb56fcdadd522e6df9f42f2@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 7 Mar 2023 15:36:35 +0100
Subject: [PATCH] qemuxml2argvtest: Use virnuma mock
While no part of cmd line building process currently depends on a
host NUMA configuration, this will change soon. Use freshly
changed virnumamock from qemuxml2argvtest and make the mock read
NUMA data from vircaps2xmldata which seems to have the most rich
NUMA configuration.
This also means, we have to start building virnumamock
unconditionally. But this is not a problem, since nothing inside
of the mock relies on Linux specificity. The whole mock is merely
just reading files and parsing them.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 28ec9d86b3db4bd9ea29891350366ffa6895d4e9)
Conflicts:
- tests/qemuxml2argvtest.c: Context, some cleanup patches (e.g.
v9.2.0-rc1~191) are not backported.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
tests/meson.build | 2 +-
tests/qemuxml2argvtest.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tests/meson.build b/tests/meson.build
index 3365dce307..6d0e62c02f 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -84,6 +84,7 @@ mock_libs = [
{ 'name': 'virnetdaemonmock' },
{ 'name': 'virnetdevmock' },
{ 'name': 'virnetserverclientmock' },
+ { 'name': 'virnumamock' },
{ 'name': 'virpcimock' },
{ 'name': 'virportallocatormock' },
{ 'name': 'virprocessmock' },
@@ -94,7 +95,6 @@ if host_machine.system() == 'linux'
mock_libs += [
{ 'name': 'virfilemock' },
{ 'name': 'virnetdevbandwidthmock' },
- { 'name': 'virnumamock' },
{ 'name': 'virtestmock' },
{ 'name': 'virusbmock' },
]
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index e23b32e96a..3fb2d5dc74 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -872,6 +872,8 @@ mymain(void)
VIR_FREE(driver.config->nvramDir);
driver.config->nvramDir = g_strdup("/var/lib/libvirt/qemu/nvram");
+ virFileWrapperAddPrefix("/sys/devices/system",
+ abs_srcdir "/vircaps2xmldata/linux-basic/system");
virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware",
abs_srcdir "/qemufirmwaredata/etc/qemu/firmware");
virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware",
@@ -2999,7 +3001,8 @@ VIR_TEST_MAIN_PRELOAD(mymain,
VIR_TEST_MOCK("domaincaps"),
VIR_TEST_MOCK("virrandom"),
VIR_TEST_MOCK("qemucpu"),
- VIR_TEST_MOCK("virpci"))
+ VIR_TEST_MOCK("virpci"),
+ VIR_TEST_MOCK("virnuma"))
#else
--
2.40.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

@ -1,55 +0,0 @@
From 64dbfdfe3ed2fc8f252ce138f6213b529edb2407 Mon Sep 17 00:00:00 2001
Message-Id: <64dbfdfe3ed2fc8f252ce138f6213b529edb2407@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 15 Feb 2023 10:48:31 +0100
Subject: [PATCH] rpc: Don't warn about "max_client_requests" in
single-threaded daemons
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The warning about max_client_requests is hit inside virtlogd every time
a VM starts which spams the logs.
Emit the warning only when the client request limit is not 1 and add a
warning into the daemon config to not configure it too low instead.
Fixes: 031878c2364
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2145188
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit b3f8e072fe08a6beaf3ec3d27e02efee4358b2ca)
---
src/remote/libvirtd.conf.in | 1 +
src/rpc/virnetserverclient.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/remote/libvirtd.conf.in b/src/remote/libvirtd.conf.in
index 80a98b1529..32a680317a 100644
--- a/src/remote/libvirtd.conf.in
+++ b/src/remote/libvirtd.conf.in
@@ -374,6 +374,7 @@
# connection. To avoid one client monopolizing the server
# this should be a small fraction of the global max_workers
# parameter.
+# Setting this too low may cause keepalive timeouts.
#max_client_requests = 5
# Same processing controls, but this time for the admin interface.
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index b5c764b1b0..bdb3552c5d 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1261,7 +1261,8 @@ static virNetMessage *virNetServerClientDispatchRead(virNetServerClient *client)
client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;
client->rx->buffer = g_new0(char, client->rx->bufferLength);
client->nrequests++;
- } else if (!client->nrequests_warning) {
+ } else if (!client->nrequests_warning &&
+ client->nrequests_max > 1) {
client->nrequests_warning = true;
VIR_WARN("Client hit max requests limit %zd. This may result "
"in keep-alive timeouts. Consider tuning the "
--
2.39.1

View File

@ -1,43 +0,0 @@
From f26e30ecb3d0e25d5cf648755e2b4e1db0476b52 Mon Sep 17 00:00:00 2001
Message-Id: <f26e30ecb3d0e25d5cf648755e2b4e1db0476b52@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Tue, 24 Jan 2023 13:45:09 +0100
Subject: [PATCH] rpc: Fix error message in virNetServerSetClientLimits
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit f007940cb25a tried to change the error message so that it is unified
later in 35afa1d2d6c1, but various rewrites missed this particular error message
which does not make sense. Fix it so that it is the same as the other two
messages checking the same thing in this file.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2033879
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 1e2605c934b80c3e9c30e929834d38fee86f184e)
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
src/rpc/virnetserver.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index bf0fda04ee..e97dfe8136 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -1127,9 +1127,8 @@ virNetServerSetClientLimits(virNetServer *srv,
if (max < max_unauth) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("The overall maximum number of clients waiting "
- "for authentication must not be less than the overall "
- "maximum number of clients"));
+ _("The overall maximum number of clients must not be less "
+ "than the number of clients waiting for authentication"));
return -1;
}
--
2.39.1

View File

@ -1,45 +0,0 @@
From c07df2b480134357e6ecb53f61eb1d8295b2b406 Mon Sep 17 00:00:00 2001
Message-Id: <c07df2b480134357e6ecb53f61eb1d8295b2b406@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 15 Feb 2023 10:43:53 +0100
Subject: [PATCH] rpc: client: Don't check return value of virNetMessageNew
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
virNetServerClientDispatchRead checked the return value but it's not
necessary any more as it can't return NULL nowadays.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 761cb8a0876d32445951791030c77afa147c0de1)
https://bugzilla.redhat.com/show_bug.cgi?id=2145188
---
src/rpc/virnetserverclient.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index c9a4eb521e..b5c764b1b0 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1257,13 +1257,10 @@ static virNetMessage *virNetServerClientDispatchRead(virNetServerClient *client)
/* Possibly need to create another receive buffer */
if (client->nrequests < client->nrequests_max) {
- if (!(client->rx = virNetMessageNew(true))) {
- client->wantClose = true;
- } else {
- client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;
- client->rx->buffer = g_new0(char, client->rx->bufferLength);
- client->nrequests++;
- }
+ client->rx = virNetMessageNew(true);
+ client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;
+ client->rx->buffer = g_new0(char, client->rx->bufferLength);
+ client->nrequests++;
} else if (!client->nrequests_warning) {
client->nrequests_warning = true;
VIR_WARN("Client hit max requests limit %zd. This may result "
--
2.39.1

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,39 +0,0 @@
From d1aa4fb37896b2abb92b4d0e0409459820e726a4 Mon Sep 17 00:00:00 2001
Message-Id: <d1aa4fb37896b2abb92b4d0e0409459820e726a4@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Wed, 8 Mar 2023 12:50:38 -0500
Subject: [PATCH] security: make args to virSecuritySELinuxContextAddRange()
const
Neither of these are modified anywhere in the function, and the
function will soon be called with an arg that actually is a const.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 60afe39576abc9b26f5f8c1dfed39bbc783fb78c)
https://bugzilla.redhat.com/2172267
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/security/security_selinux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 4d4a1705e6..a0b3a5e147 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -523,8 +523,8 @@ virSecuritySELinuxMCSGetProcessRange(char **sens,
}
static char *
-virSecuritySELinuxContextAddRange(char *src,
- char *dst)
+virSecuritySELinuxContextAddRange(const char *src,
+ const char *dst)
{
const char *str = NULL;
char *ret = NULL;
--
2.40.0

View File

@ -1,412 +0,0 @@
From 75c9ad56f08bfa0d86737f8872ea7cf7a5426bad Mon Sep 17 00:00:00 2001
Message-Id: <75c9ad56f08bfa0d86737f8872ea7cf7a5426bad@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Wed, 1 Mar 2023 15:34:32 -0500
Subject: [PATCH] security: make it possible to set SELinux label of child
process from its binary
Normally when a child process is started by libvirt, the SELinux label
of that process is set to virtd_t (plus an MCS range). In at least one
case (passt) we need for the SELinux label of a child process label to
match the label that the binary would have transitioned to
automatically if it had been run standalone (in the case of passt,
that label is passt_t).
This patch modifies virSecuritySELinuxSetChildProcessLabel() (and all
the functions above it in the call chain) so that the toplevel
function can set a new argument "useBinarySpecificLabel" to true. If
it is true, then virSecuritySELinuxSetChildProcessLabel() will call
the new function virSecuritySELinuxContextSetFromFile(), which uses
the selinux library function security_compute_create() to determine
what would be the label of the new process if it had been run
standalone (rather than being run by libvirt) - the MCS range from the
normally-used label is added to this newly derived label, and that is
what is used for the new process rather than whatever is in the
domain's security label (which will usually be virtd_t).
In order to easily verify that nothing was broken by these changes to
the call chain, all callers currently set useBinarySpecificPath =
false, so all behavior should be completely unchanged. (The next
patch will set it to true only for the case of running passt.)
https://bugzilla.redhat.com/2172267
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 75056f61f12d6efec51f699f2b901f8d02cd075c)
Conflicts:
src/qemu/qemu_dbus.c
src/qemu/qemu_passt.c
src/qemu/qemu_security.c
src/qemu/qemu_security.h
src/qemu/qemu_slirp.c
src/qemu/qemu_tpm.c
src/qemu/qemu_vhost_user_gpu.c
The argument list for qemuSecurityCommandRun changed upstream to
remove one of the arguments, but that changeset has not been
backported to the rhel-9.2.0 branch. (see the 4 commits starting at
upstream commit 0634d640)
https://bugzilla.redhat.com/2172267
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/qemu/qemu_dbus.c | 5 ++-
src/qemu/qemu_passt.c | 4 +-
src/qemu/qemu_process.c | 2 +-
src/qemu/qemu_security.c | 5 ++-
src/qemu/qemu_security.h | 1 +
src/qemu/qemu_slirp.c | 4 +-
src/qemu/qemu_tpm.c | 3 +-
src/qemu/qemu_vhost_user_gpu.c | 4 +-
src/security/security_apparmor.c | 1 +
src/security/security_dac.c | 1 +
src/security/security_driver.h | 1 +
src/security/security_manager.c | 8 +++-
src/security/security_manager.h | 1 +
src/security/security_nop.c | 1 +
src/security/security_selinux.c | 73 +++++++++++++++++++++++++++++++-
src/security/security_stack.c | 5 ++-
16 files changed, 107 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_dbus.c b/src/qemu/qemu_dbus.c
index cb2694795e..f13c792956 100644
--- a/src/qemu/qemu_dbus.c
+++ b/src/qemu/qemu_dbus.c
@@ -219,9 +219,10 @@ qemuDBusStart(virQEMUDriver *driver,
virCommandDaemonize(cmd);
virCommandAddArgFormat(cmd, "--config-file=%s", configfile);
- if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1,
- &exitstatus, &cmdret) < 0)
+ if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, false,
+ &exitstatus, &cmdret) < 0) {
goto cleanup;
+ }
if (cmdret < 0 || exitstatus != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 8d28a55455..ed7b518212 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -285,8 +285,10 @@ qemuPasstStart(virDomainObj *vm,
if (qemuExtDeviceLogCommand(driver, vm, cmd, "passt") < 0)
return -1;
- if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus, &cmdret) < 0)
+ if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, false,
+ &exitstatus, &cmdret) < 0) {
goto error;
+ }
if (cmdret < 0 || exitstatus != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 298904fe2e..e5c438aa26 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7764,7 +7764,7 @@ qemuProcessLaunch(virConnectPtr conn,
VIR_DEBUG("Setting up security labelling");
if (qemuSecuritySetChildProcessLabel(driver->securityManager,
- vm->def, cmd) < 0)
+ vm->def, false, cmd) < 0)
goto cleanup;
virCommandSetOutputFD(cmd, &logfile);
diff --git a/src/qemu/qemu_security.c b/src/qemu/qemu_security.c
index beada669f7..a5c05b86a9 100644
--- a/src/qemu/qemu_security.c
+++ b/src/qemu/qemu_security.c
@@ -637,6 +637,7 @@ qemuSecurityCommandRun(virQEMUDriver *driver,
virCommand *cmd,
uid_t uid,
gid_t gid,
+ bool useBinarySpecificLabel,
int *exitstatus,
int *cmdret)
{
@@ -644,8 +645,10 @@ qemuSecurityCommandRun(virQEMUDriver *driver,
qemuDomainObjPrivate *priv = vm->privateData;
if (virSecurityManagerSetChildProcessLabel(driver->securityManager,
- vm->def, cmd) < 0)
+ vm->def, useBinarySpecificLabel,
+ cmd) < 0) {
return -1;
+ }
if (uid != (uid_t) -1)
virCommandSetUID(cmd, uid);
diff --git a/src/qemu/qemu_security.h b/src/qemu/qemu_security.h
index 8d1c6b38c3..a7ba16e076 100644
--- a/src/qemu/qemu_security.h
+++ b/src/qemu/qemu_security.h
@@ -115,6 +115,7 @@ int qemuSecurityCommandRun(virQEMUDriver *driver,
virCommand *cmd,
uid_t uid,
gid_t gid,
+ bool useBinarySpecificLabel,
int *exitstatus,
int *cmdret);
diff --git a/src/qemu/qemu_slirp.c b/src/qemu/qemu_slirp.c
index 3f83db03bf..e22d86b521 100644
--- a/src/qemu/qemu_slirp.c
+++ b/src/qemu/qemu_slirp.c
@@ -329,8 +329,10 @@ qemuSlirpStart(virDomainObj *vm,
if (qemuExtDeviceLogCommand(driver, vm, cmd, "slirp") < 0)
goto error;
- if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus, &cmdret) < 0)
+ if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, false,
+ &exitstatus, &cmdret) < 0) {
goto error;
+ }
if (cmdret < 0 || exitstatus != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 5831ffc32e..d4a87921d3 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -963,8 +963,9 @@ qemuTPMEmulatorStart(virQEMUDriver *driver,
return -1;
if (qemuSecurityCommandRun(driver, vm, cmd, cfg->swtpm_user,
- cfg->swtpm_group, NULL, &cmdret) < 0)
+ cfg->swtpm_group, false, NULL, &cmdret) < 0) {
goto error;
+ }
if (cmdret < 0) {
/* virCommandRun() hidden in qemuSecurityCommandRun()
diff --git a/src/qemu/qemu_vhost_user_gpu.c b/src/qemu/qemu_vhost_user_gpu.c
index bc5a1dc3ec..7909fffe64 100644
--- a/src/qemu/qemu_vhost_user_gpu.c
+++ b/src/qemu/qemu_vhost_user_gpu.c
@@ -153,8 +153,10 @@ int qemuExtVhostUserGPUStart(virQEMUDriver *driver,
virCommandAddArgFormat(cmd, "--render-node=%s", video->accel->rendernode);
}
- if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus, &cmdret) < 0)
+ if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, false,
+ &exitstatus, &cmdret) < 0) {
goto error;
+ }
if (cmdret < 0 || exitstatus != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index b63b248975..b5642c9a28 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -570,6 +570,7 @@ AppArmorSetSecurityProcessLabel(virSecurityManager *mgr G_GNUC_UNUSED,
static int
AppArmorSetSecurityChildProcessLabel(virSecurityManager *mgr G_GNUC_UNUSED,
virDomainDef *def,
+ bool useBinarySpecificLabel G_GNUC_UNUSED,
virCommand *cmd)
{
g_autofree char *profile_name = NULL;
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 9be8f458d1..ca3f4d2dc5 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -2273,6 +2273,7 @@ virSecurityDACSetProcessLabel(virSecurityManager *mgr,
static int
virSecurityDACSetChildProcessLabel(virSecurityManager *mgr,
virDomainDef *def,
+ bool useBinarySpecificLabel G_GNUC_UNUSED,
virCommand *cmd)
{
virSecurityDACData *priv = virSecurityManagerGetPrivateData(mgr);
diff --git a/src/security/security_driver.h b/src/security/security_driver.h
index fe6982ceca..aa1fb2125d 100644
--- a/src/security/security_driver.h
+++ b/src/security/security_driver.h
@@ -96,6 +96,7 @@ typedef int (*virSecurityDomainSetProcessLabel) (virSecurityManager *mgr,
virDomainDef *def);
typedef int (*virSecurityDomainSetChildProcessLabel) (virSecurityManager *mgr,
virDomainDef *def,
+ bool useBinarySpecificLabel,
virCommand *cmd);
typedef int (*virSecurityDomainSecurityVerify) (virSecurityManager *mgr,
virDomainDef *def);
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 2f8e89cb04..b0578d7209 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -885,10 +885,14 @@ virSecurityManagerSetProcessLabel(virSecurityManager *mgr,
int
virSecurityManagerSetChildProcessLabel(virSecurityManager *mgr,
virDomainDef *vm,
+ bool useBinarySpecificLabel,
virCommand *cmd)
{
- if (mgr->drv->domainSetSecurityChildProcessLabel)
- return mgr->drv->domainSetSecurityChildProcessLabel(mgr, vm, cmd);
+ if (mgr->drv->domainSetSecurityChildProcessLabel) {
+ return mgr->drv->domainSetSecurityChildProcessLabel(mgr, vm,
+ useBinarySpecificLabel,
+ cmd);
+ }
virReportUnsupportedError();
return -1;
diff --git a/src/security/security_manager.h b/src/security/security_manager.h
index 4afdcc167b..97add3294d 100644
--- a/src/security/security_manager.h
+++ b/src/security/security_manager.h
@@ -145,6 +145,7 @@ int virSecurityManagerSetProcessLabel(virSecurityManager *mgr,
virDomainDef *def);
int virSecurityManagerSetChildProcessLabel(virSecurityManager *mgr,
virDomainDef *def,
+ bool useBinarySpecificLabel,
virCommand *cmd);
int virSecurityManagerVerify(virSecurityManager *mgr,
virDomainDef *def);
diff --git a/src/security/security_nop.c b/src/security/security_nop.c
index 0dbc547feb..1413f43d57 100644
--- a/src/security/security_nop.c
+++ b/src/security/security_nop.c
@@ -152,6 +152,7 @@ virSecurityDomainSetProcessLabelNop(virSecurityManager *mgr G_GNUC_UNUSED,
static int
virSecurityDomainSetChildProcessLabelNop(virSecurityManager *mgr G_GNUC_UNUSED,
virDomainDef *vm G_GNUC_UNUSED,
+ bool useBinarySpecificLabel G_GNUC_UNUSED,
virCommand *cmd G_GNUC_UNUSED)
{
return 0;
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index a0b3a5e147..7ea4ff5c1a 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -560,6 +560,52 @@ virSecuritySELinuxContextAddRange(const char *src,
return ret;
}
+
+static char *
+virSecuritySELinuxContextSetFromFile(const char *origLabel,
+ const char *binaryPath)
+{
+ g_autofree char *currentCon = NULL;
+ g_autofree char *binaryCon = NULL;
+ g_autofree char *naturalLabel = NULL;
+ g_autofree char *updatedLabel = NULL;
+
+ /* First learn what would be the context set
+ * if binaryPath was exec'ed from this process.
+ */
+ if (getcon(&currentCon) < 0) {
+ virReportSystemError(errno, "%s",
+ _("unable to get SELinux context for current process"));
+ return NULL;
+ }
+
+ if (getfilecon(binaryPath, &binaryCon) < 0) {
+ virReportSystemError(errno, _("unable to get SELinux context for '%s'"),
+ binaryPath);
+ return NULL;
+ }
+
+ if (security_compute_create(currentCon, binaryCon,
+ string_to_security_class("process"),
+ &naturalLabel) < 0) {
+ virReportSystemError(errno,
+ _("unable create new SELinux label based on label '%s' and file '%s'"),
+ origLabel, binaryPath);
+ return NULL;
+ }
+
+ /* now get the type from the original label
+ * (which already has proper MCS set) and add it to
+ * the new label
+ */
+ updatedLabel = virSecuritySELinuxContextAddRange(origLabel, naturalLabel);
+
+ VIR_DEBUG("original label: '%s' binary: '%s' binary-specific label: '%s'",
+ origLabel, binaryPath, NULLSTR(updatedLabel));
+ return g_steal_pointer(&updatedLabel);
+}
+
+
static char *
virSecuritySELinuxGenNewContext(const char *basecontext,
const char *mcs,
@@ -2984,10 +3030,13 @@ virSecuritySELinuxSetProcessLabel(virSecurityManager *mgr G_GNUC_UNUSED,
static int
virSecuritySELinuxSetChildProcessLabel(virSecurityManager *mgr G_GNUC_UNUSED,
virDomainDef *def,
+ bool useBinarySpecificLabel G_GNUC_UNUSED,
virCommand *cmd)
{
/* TODO: verify DOI */
virSecurityLabelDef *secdef;
+ g_autofree char *tmpLabel = NULL;
+ const char *label = NULL;
secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME);
if (!secdef || !secdef->label)
@@ -3004,8 +3053,30 @@ virSecuritySELinuxSetChildProcessLabel(virSecurityManager *mgr G_GNUC_UNUSED,
return -1;
}
+ /* pick either the common label used by most binaries exec'ed by
+ * libvirt, or the specific label of this binary.
+ */
+ if (useBinarySpecificLabel) {
+ const char *binaryPath = virCommandGetBinaryPath(cmd);
+
+ if (!binaryPath)
+ return -1; /* error was already logged */
+
+ tmpLabel = virSecuritySELinuxContextSetFromFile(secdef->label,
+ binaryPath);
+ if (!tmpLabel)
+ return -1;
+
+ label = tmpLabel;
+
+ } else {
+
+ label = secdef->label;
+
+ }
+
/* save in cmd to be set after fork/before child process is exec'ed */
- virCommandSetSELinuxLabel(cmd, secdef->label);
+ virCommandSetSELinuxLabel(cmd, label);
return 0;
}
diff --git a/src/security/security_stack.c b/src/security/security_stack.c
index 560f797030..369b5dd3a6 100644
--- a/src/security/security_stack.c
+++ b/src/security/security_stack.c
@@ -458,6 +458,7 @@ virSecurityStackSetProcessLabel(virSecurityManager *mgr,
static int
virSecurityStackSetChildProcessLabel(virSecurityManager *mgr,
virDomainDef *vm,
+ bool useBinarySpecificLabel,
virCommand *cmd)
{
virSecurityStackData *priv = virSecurityManagerGetPrivateData(mgr);
@@ -465,8 +466,10 @@ virSecurityStackSetChildProcessLabel(virSecurityManager *mgr,
int rc = 0;
for (; item; item = item->next) {
- if (virSecurityManagerSetChildProcessLabel(item->securityManager, vm, cmd) < 0)
+ if (virSecurityManagerSetChildProcessLabel(item->securityManager, vm,
+ useBinarySpecificLabel, cmd) < 0) {
rc = -1;
+ }
}
return rc;
--
2.40.0

View File

@ -1,61 +0,0 @@
From a967747fcdf7d78425d218625ddb42606451c2ab Mon Sep 17 00:00:00 2001
Message-Id: <a967747fcdf7d78425d218625ddb42606451c2ab@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 18 Jan 2023 09:03:29 +0100
Subject: [PATCH] src: Don't use virReportSystemError() on
virProcessGetStatInfo() failure
Firstly, the virProcessGetStatInfo() does not fail really. But
even if it did, it sets correct errno only sometimes (and even
that is done in a helper it's calling - virProcessGetStat() and
even there it's the case only in very few error paths).
Therefore, using virReportSystemError() to report errors is very
misleading. Use plain virReportError() instead. Luckily, there
are only two places where the former was used:
chDomainHelperGetVcpus() and qemuDomainHelperGetVcpus() (not a
big surprise since CH driver is heavily inspired by QEMU driver).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 818c9717c53446ca7abbaa7b3fd7925e1c5ab663)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2148266
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/ch/ch_driver.c | 4 ++--
src/qemu/qemu_driver.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index db2a66d131..12fbe31c24 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -1079,8 +1079,8 @@ chDomainHelperGetVcpus(virDomainObj *vm,
NULL, NULL,
&vcpuinfo->cpu, NULL,
vm->pid, vcpupid) < 0) {
- virReportSystemError(errno, "%s",
- _("cannot get vCPU placement & pCPU time"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot get vCPU placement & pCPU time"));
return -1;
}
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d6879175fe..c576c601ad 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1355,8 +1355,8 @@ qemuDomainHelperGetVcpus(virDomainObj *vm,
NULL, NULL,
&vcpuinfo->cpu, NULL,
vm->pid, vcpupid) < 0) {
- virReportSystemError(errno, "%s",
- _("cannot get vCPU placement & pCPU time"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot get vCPU placement & pCPU time"));
return -1;
}
}
--
2.39.1

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

@ -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

@ -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

@ -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

@ -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

@ -1,150 +0,0 @@
From 54806234834ab5f2a1ada02afc5ad5ef6a789dc9 Mon Sep 17 00:00:00 2001
Message-Id: <54806234834ab5f2a1ada02afc5ad5ef6a789dc9@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Wed, 1 Mar 2023 11:34:24 -0500
Subject: [PATCH] util: add an API to retrieve the resolved path to a
virCommand's binary
The binary to be exec'ed by virExec() is stored in
virCommand::args[0], and is resolved to a full absolute path (stored
in a local of virExec() just prior to execve().
Since we will have another use for the full absolute path, lets make
an API to resolve/retrieve the absolute path, and cache it in
virCommand::binaryPath so we only have to do the resolution once.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit a53c1d6f842ba0f516bbacff8250ba0d7a10074a)
https://bugzilla.redhat.com/2172267
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/vircommand.c | 51 +++++++++++++++++++++++++++++++---------
src/util/vircommand.h | 1 +
3 files changed, 42 insertions(+), 11 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 576ec8f95f..e20421e7cd 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2076,6 +2076,7 @@ virCommandDryRunTokenNew;
virCommandExec;
virCommandFree;
virCommandGetArgList;
+virCommandGetBinaryPath;
virCommandGetGID;
virCommandGetUID;
virCommandHandshakeNotify;
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 0917bc9cfb..a31509e977 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -88,6 +88,7 @@ struct _virCommandSendBuffer {
struct _virCommand {
int has_error; /* 0 on success, -1 on error */
+ char *binaryPath; /* only valid if args[0] isn't absolute path */
char **args;
size_t nargs;
size_t maxargs;
@@ -630,6 +631,7 @@ virCommandMassClose(virCommand *cmd,
# endif /* ! __FreeBSD__ */
+
/*
* virExec:
* @cmd virCommand * containing all information about the program to
@@ -646,22 +648,13 @@ virExec(virCommand *cmd)
int childin = cmd->infd;
int childout = -1;
int childerr = -1;
- g_autofree char *binarystr = NULL;
const char *binary = NULL;
int ret;
g_autofree gid_t *groups = NULL;
int ngroups;
- if (!g_path_is_absolute(cmd->args[0])) {
- if (!(binary = binarystr = virFindFileInPath(cmd->args[0]))) {
- virReportSystemError(ENOENT,
- _("Cannot find '%s' in path"),
- cmd->args[0]);
- return -1;
- }
- } else {
- binary = cmd->args[0];
- }
+ if (!(binary = virCommandGetBinaryPath(cmd)))
+ return -1;
if (childin < 0) {
if (getDevNull(&null) < 0)
@@ -2164,6 +2157,40 @@ virCommandGetArgList(virCommand *cmd,
}
+/*
+ * virCommandGetBinaryPath:
+ * @cmd: virCommand* containing all information about the program
+ *
+ * If args[0] is an absolute path, return that. If not, then resolve
+ * args[0] to a full absolute path, cache that in binaryPath, and
+ * return a pointer to this resolved string. binaryPath is only set by
+ * calling this function, so even other virCommand functions should
+ * access binaryPath via this function.
+ *
+ * returns const char* with the full path of the binary to be
+ * executed, or NULL on failure.
+ */
+const char *
+virCommandGetBinaryPath(virCommand *cmd)
+{
+
+ if (cmd->binaryPath)
+ return cmd->binaryPath;
+
+ if (g_path_is_absolute(cmd->args[0]))
+ return cmd->args[0];
+
+ if (!(cmd->binaryPath = virFindFileInPath(cmd->args[0]))) {
+ virReportSystemError(ENOENT,
+ _("Cannot find '%s' in path"),
+ cmd->args[0]);
+ return NULL;
+ }
+
+ return cmd->binaryPath;
+}
+
+
#ifndef WIN32
/*
* Manage input and output to the child process.
@@ -3015,6 +3042,8 @@ virCommandFree(virCommand *cmd)
VIR_FORCE_CLOSE(cmd->outfd);
VIR_FORCE_CLOSE(cmd->errfd);
+ g_free(cmd->binaryPath);
+
for (i = 0; i < cmd->nargs; i++)
g_free(cmd->args[i]);
g_free(cmd->args);
diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index e0002103b6..d51449ac90 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -170,6 +170,7 @@ int virCommandToStringBuf(virCommand *cmd,
bool linebreaks,
bool stripCommandPath);
+const char *virCommandGetBinaryPath(virCommand *cmd);
int virCommandGetArgList(virCommand *cmd, char ***args);
int virCommandExec(virCommand *cmd, gid_t *groups, int ngroups) G_GNUC_WARN_UNUSED_RESULT;
--
2.40.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

Some files were not shown because too many files have changed in this diff Show More