]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Fix numatune nodeset reporting
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 18 May 2015 21:55:10 +0000 (14:55 -0700)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 18 May 2015 22:22:23 +0000 (15:22 -0700)
Since af2a1f0587d88656f2c14265a63fbc11ecbd924e,
qemuDomainGetNumaParameters() returns invalid value for a running
guest.  The problem is that it is getting the information from cgroups,
but the parent cgroup is being left alone since the mentioned commit.
Since the running guest's XML is in sync with cgroups, there is no need
to look into cgroups (unless someone changes the configuration behind
libvirt's back).  Returning the info from the definition fixes a bug and
is also a cleanup.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1221047
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_driver.c

index 8c00cdcb55fe16294c52d3aa7ef3f2d31db0dca4..0cc0a29fb2d2c736d54cc5fb41f0353bc71f8afc 100644 (file)
@@ -10523,7 +10523,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
     char *nodeset = NULL;
     int ret = -1;
     virCapsPtr caps = NULL;
-    qemuDomainObjPrivatePtr priv;
+    virDomainDefPtr def = NULL;
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG |
@@ -10537,8 +10537,6 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
     if (!(vm = qemuDomObjFromDomain(dom)))
         return -1;
 
-    priv = vm->privateData;
-
     if (virDomainGetNumaParametersEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
@@ -10555,6 +10553,11 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
         goto cleanup;
     }
 
+    if (flags & VIR_DOMAIN_AFFECT_CONFIG)
+        def = persistentDef;
+    else
+        def = vm->def;
+
     for (i = 0; i < QEMU_NB_NUMA_PARAM && i < *nparams; i++) {
         virMemoryParameterPtr param = &params[i];
 
@@ -10564,35 +10567,17 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
                                         VIR_TYPED_PARAM_INT, 0) < 0)
                 goto cleanup;
 
-            if (flags & VIR_DOMAIN_AFFECT_CONFIG)
-                param->value.i = virDomainNumatuneGetMode(persistentDef->numa, -1);
-            else
-                param->value.i = virDomainNumatuneGetMode(vm->def->numa, -1);
+            param->value.i = virDomainNumatuneGetMode(def->numa, -1);
             break;
 
         case 1: /* fill numa nodeset here */
-            if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
-                nodeset = virDomainNumatuneFormatNodeset(persistentDef->numa,
-                                                         NULL, -1);
-                if (!nodeset)
-                    goto cleanup;
-            } else {
-                if (!virCgroupHasController(priv->cgroup,
-                                            VIR_CGROUP_CONTROLLER_CPUSET) ||
-                    virCgroupGetCpusetMems(priv->cgroup, &nodeset) < 0) {
-                    nodeset = virDomainNumatuneFormatNodeset(vm->def->numa,
-                                                             NULL, -1);
-                    if (!nodeset)
-                        goto cleanup;
-                }
-            }
-
-            if (virTypedParameterAssign(param, VIR_DOMAIN_NUMA_NODESET,
+            nodeset = virDomainNumatuneFormatNodeset(def->numa, NULL, -1);
+            if (!nodeset ||
+                virTypedParameterAssign(param, VIR_DOMAIN_NUMA_NODESET,
                                         VIR_TYPED_PARAM_STRING, nodeset) < 0)
                 goto cleanup;
 
             nodeset = NULL;
-
             break;
 
         /* coverity[dead_error_begin] */