1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

qemu: Fix numatune nodeset reporting

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>
This commit is contained in:
Martin Kletzander 2015-05-18 14:55:10 -07:00
parent a5b55bd931
commit 9deb96f9f0

View 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] */