numa_conf: Move memnode mode validation into virDomainNumaDefValidate()

When parsing a <memnode/> we also check whether the @mode
argument fulfills some requirements wrt 'restrictive' mode. This
is not the right place though. There's virDomainNumaDefValidate()
which contains other checks.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Michal Privoznik 2023-05-18 10:27:52 +02:00
parent a152d856c3
commit f6ba9fc12a

View File

@ -191,14 +191,6 @@ virDomainNumatuneNodeParseXML(virDomainNuma *numa,
VIR_DOMAIN_NUMATUNE_MEM_STRICT) < 0)
return -1;
if (numa->memory.mode == VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE &&
mem_node->mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("'restrictive' mode is required in memnode element "
"when mode is 'restrictive' in memory element"));
return -1;
}
tmp = virXMLPropString(cur_node, "nodeset");
if (!tmp) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@ -1083,6 +1075,14 @@ virDomainNumaDefValidate(const virDomainNuma *def)
const virDomainNumaNode *node = &def->mem_nodes[i];
g_autoptr(virBitmap) levelsSeen = virBitmapNew(0);
if (virDomainNumatuneNodeSpecified(def, i) &&
def->memory.mode == VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE &&
node->mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("'restrictive' mode is required in memnode element when mode is 'restrictive' in memory element"));
return -1;
}
for (j = 0; j < node->ncaches; j++) {
const virNumaCache *cache = &node->caches[j];