[libvirt] [PATCH] conf: Check for NUMA distances in validity check

Michal Privoznik mprivozn at redhat.com
Tue Feb 6 16:23:47 UTC 2018


NUMA distances are part of guest ABI (guests can read it
directly!) and therefore as such shouldn't change throughout the
lifetime of domain.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/conf/numa_conf.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index c906a53de..7d3f9e661 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -1073,7 +1073,7 @@ bool
 virDomainNumaCheckABIStability(virDomainNumaPtr src,
                                virDomainNumaPtr tgt)
 {
-    size_t i;
+    size_t i, j;
 
     if (virDomainNumaGetNodeCount(src) != virDomainNumaGetNodeCount(tgt)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -1102,6 +1102,17 @@ virDomainNumaCheckABIStability(virDomainNumaPtr src,
                              "match source"), i);
             return false;
         }
+
+        for (j = 0; j < virDomainNumaGetNodeCount(src); j++) {
+            if (virDomainNumaGetNodeDistance(src, i, j) !=
+                virDomainNumaGetNodeDistance(tgt, i, j)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("Target NUMA distance from %zu to %zu "
+                                 "doesn't match source"), i, j);
+
+                return false;
+            }
+        }
     }
 
     return true;
-- 
2.13.6




More information about the libvir-list mailing list