Properly free vcpupin info for unplugged CPUs

Remove the pointer from def->cputune.vcpupin after unplugging
the CPU and also free the bitmap contained in the structure
by calling virDomainVcpuPinDel instead of VIR_FREE.

Introduced by commit 0df1a79.

This makes virDomainLookupVcpuPin redundant.

https://bugzilla.redhat.com/show_bug.cgi?id=1088165
This commit is contained in:
Ján Tomko 2014-04-22 14:11:54 +02:00
parent 3d5c29a17c
commit a0a8dc695e
4 changed files with 1 additions and 29 deletions

View File

@ -10966,26 +10966,6 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
goto cleanup;
}
/*
* Return the vcpupin related with the vcpu id on SUCCESS, or
* NULL on failure.
*/
virDomainVcpuPinDefPtr
virDomainLookupVcpuPin(virDomainDefPtr def,
int vcpuid)
{
size_t i;
if (!def->cputune.vcpupin)
return NULL;
for (i = 0; i < def->cputune.nvcpupin; i++) {
if (def->cputune.vcpupin[i]->vcpuid == vcpuid)
return def->cputune.vcpupin[i];
}
return NULL;
}
int
virDomainDefMaybeAddController(virDomainDefPtr def,

View File

@ -2671,9 +2671,6 @@ int virDomainObjListExport(virDomainObjListPtr doms,
virDomainObjListFilter filter,
unsigned int flags);
virDomainVcpuPinDefPtr virDomainLookupVcpuPin(virDomainDefPtr def,
int vcpuid);
int
virDomainDefMaybeAddController(virDomainDefPtr def,
int type,

View File

@ -292,7 +292,6 @@ virDomainLifecycleTypeToString;
virDomainLiveConfigHelperMethod;
virDomainLockFailureTypeFromString;
virDomainLockFailureTypeToString;
virDomainLookupVcpuPin;
virDomainMemballoonModelTypeFromString;
virDomainMemballoonModelTypeToString;
virDomainMemDumpTypeFromString;

View File

@ -4120,8 +4120,6 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
}
} else {
for (i = oldvcpus - 1; i >= nvcpus; i--) {
virDomainVcpuPinDefPtr vcpupin = NULL;
if (priv->cgroup) {
if (virCgroupNewVcpu(priv->cgroup, i, false, &cgroup_vcpu) < 0)
goto cleanup;
@ -4132,9 +4130,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
}
/* Free vcpupin setting */
if ((vcpupin = virDomainLookupVcpuPin(vm->def, i))) {
VIR_FREE(vcpupin);
}
ignore_value(virDomainVcpuPinDel(vm->def, i));
}
}