mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
conf: numa: Add accessor for the NUMA node cpu mask
Add virDomainNumaGetNodeCpumask() and refactor a few places that would get the cpu mask without the helper.
This commit is contained in:
parent
be22d07315
commit
d9a779a36e
@ -771,7 +771,7 @@ virDomainNumaDefCPUFormat(virBufferPtr buf,
|
|||||||
for (i = 0; i < ncells; i++) {
|
for (i = 0; i < ncells; i++) {
|
||||||
memAccess = def->cells[i].memAccess;
|
memAccess = def->cells[i].memAccess;
|
||||||
|
|
||||||
if (!(cpustr = virBitmapFormat(def->cells[i].cpumask)))
|
if (!(cpustr = virBitmapFormat(virDomainNumaGetNodeCpumask(def, i))))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virBufferAddLit(buf, "<cell");
|
virBufferAddLit(buf, "<cell");
|
||||||
@ -799,7 +799,7 @@ virDomainNumaGetCPUCountTotal(virCPUDefPtr numa)
|
|||||||
unsigned int ret = 0;
|
unsigned int ret = 0;
|
||||||
|
|
||||||
for (i = 0; i < numa->ncells; i++)
|
for (i = 0; i < numa->ncells; i++)
|
||||||
ret += virBitmapCountBits(numa->cells[i].cpumask);
|
ret += virBitmapCountBits(virDomainNumaGetNodeCpumask(numa, i));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -824,3 +824,11 @@ virDomainNumaGetNodeCount(virCPUDefPtr numa)
|
|||||||
|
|
||||||
return numa->ncells;
|
return numa->ncells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virBitmapPtr
|
||||||
|
virDomainNumaGetNodeCpumask(virCPUDefPtr numa,
|
||||||
|
size_t node)
|
||||||
|
{
|
||||||
|
return numa->cells[node].cpumask;
|
||||||
|
}
|
||||||
|
@ -88,6 +88,9 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
|
|||||||
|
|
||||||
size_t virDomainNumaGetNodeCount(virCPUDefPtr numa)
|
size_t virDomainNumaGetNodeCount(virCPUDefPtr numa)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
virBitmapPtr virDomainNumaGetNodeCpumask(virCPUDefPtr numa,
|
||||||
|
size_t node)
|
||||||
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Formatters
|
* Formatters
|
||||||
|
@ -630,6 +630,7 @@ virNodeDeviceObjUnlock;
|
|||||||
virDomainNumaEquals;
|
virDomainNumaEquals;
|
||||||
virDomainNumaFree;
|
virDomainNumaFree;
|
||||||
virDomainNumaGetNodeCount;
|
virDomainNumaGetNodeCount;
|
||||||
|
virDomainNumaGetNodeCpumask;
|
||||||
virDomainNumaNew;
|
virDomainNumaNew;
|
||||||
virDomainNumatuneFormatNodeset;
|
virDomainNumatuneFormatNodeset;
|
||||||
virDomainNumatuneFormatXML;
|
virDomainNumatuneFormatXML;
|
||||||
|
@ -7199,7 +7199,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
|
|||||||
|
|
||||||
for (i = 0; i < ncells; i++) {
|
for (i = 0; i < ncells; i++) {
|
||||||
VIR_FREE(cpumask);
|
VIR_FREE(cpumask);
|
||||||
if (!(cpumask = virBitmapFormat(def->cpu->cells[i].cpumask)))
|
if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->cpu, i))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (strchr(cpumask, ',') &&
|
if (strchr(cpumask, ',') &&
|
||||||
|
Loading…
Reference in New Issue
Block a user