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; 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 int
virDomainDefMaybeAddController(virDomainDefPtr def, virDomainDefMaybeAddController(virDomainDefPtr def,

View File

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

View File

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

View File

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