[libvirt] [PATCH 7/7] qemu: Prohibit getting the numa parameters if mode is not strict

Osier Yang jyang at redhat.com
Fri May 17 11:59:37 UTC 2013


I don't see any reason to getting the numa parameters if mode is
not strict, as long as setNumaParameters doesn't allow to set
"nodeset" if the mode is not strict, and cpuset.mems only understand
"strict" mode.

Things could be changed if we support to get numa parameters with
libnuma one day, but let's prohibit it now.

---
See [1] for further discussion on the possibility to use "interleave"
and "preferred" modes for cgroup memory controller. But before
we have any conclusion yet, let's prohibit getting the values
from cpuset.mems as long as the numatune mode is not "strict"

[1] https://www.redhat.com/archives/libvir-list/2013-May/msg00643.html
---
 src/qemu/qemu_driver.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 203cc6d..8290a44 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7858,8 +7858,15 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
 
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
         if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
-            virReportError(VIR_ERR_OPERATION_INVALID,
-                           "%s", _("cgroup memory controller is not mounted"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("cgroup memory controller is not mounted"));
+            goto cleanup;
+        }
+
+        if (vm->def->numatune.memory.mode != VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("getting numa parameters of running domain is "
+                             "only valid for strict numa mode"));
             goto cleanup;
         }
     }
-- 
1.8.1.4




More information about the libvir-list mailing list