[PATCH 2/3] numa_conf: Move memnode mode validation into virDomainNumaDefValidate()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux