mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41: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++) {
|
||||
memAccess = def->cells[i].memAccess;
|
||||
|
||||
if (!(cpustr = virBitmapFormat(def->cells[i].cpumask)))
|
||||
if (!(cpustr = virBitmapFormat(virDomainNumaGetNodeCpumask(def, i))))
|
||||
return -1;
|
||||
|
||||
virBufferAddLit(buf, "<cell");
|
||||
@ -799,7 +799,7 @@ virDomainNumaGetCPUCountTotal(virCPUDefPtr numa)
|
||||
unsigned int ret = 0;
|
||||
|
||||
for (i = 0; i < numa->ncells; i++)
|
||||
ret += virBitmapCountBits(numa->cells[i].cpumask);
|
||||
ret += virBitmapCountBits(virDomainNumaGetNodeCpumask(numa, i));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -824,3 +824,11 @@ virDomainNumaGetNodeCount(virCPUDefPtr numa)
|
||||
|
||||
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)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
virBitmapPtr virDomainNumaGetNodeCpumask(virCPUDefPtr numa,
|
||||
size_t node)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/*
|
||||
* Formatters
|
||||
|
@ -630,6 +630,7 @@ virNodeDeviceObjUnlock;
|
||||
virDomainNumaEquals;
|
||||
virDomainNumaFree;
|
||||
virDomainNumaGetNodeCount;
|
||||
virDomainNumaGetNodeCpumask;
|
||||
virDomainNumaNew;
|
||||
virDomainNumatuneFormatNodeset;
|
||||
virDomainNumatuneFormatXML;
|
||||
|
@ -7199,7 +7199,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
|
||||
|
||||
for (i = 0; i < ncells; i++) {
|
||||
VIR_FREE(cpumask);
|
||||
if (!(cpumask = virBitmapFormat(def->cpu->cells[i].cpumask)))
|
||||
if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->cpu, i))))
|
||||
goto cleanup;
|
||||
|
||||
if (strchr(cpumask, ',') &&
|
||||
|
Loading…
Reference in New Issue
Block a user