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 <mpriv...@redhat.com>
---
 src/conf/numa_conf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index dd4997c759..6095139385 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -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];
 
-- 
2.39.3

Reply via email to