mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-27 15:05:17 +00:00
numa_conf: Introduce virDomainNumaGetMaxCPUID
This function should return the greatest CPU number set in /domain/cpu/numa/cell/@cpus. The idea is that we should compare the returned value against /domain/vcpu value. Yes, there exist users who think the following is a good idea: <vcpu placement='static'>4</vcpu> <cpu mode='host-model'> <model fallback='allow'/> <numa> <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/> <cell id='1' cpus='9-10' memory='2097152' unit='KiB'/> </numa> </cpu> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> (cherry picked from commit 8f2535dec1fdd969e86aa39c8a2583c723341733)
This commit is contained in:
parent
87bacf5df2
commit
819d2168d8
@ -847,6 +847,23 @@ virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
virDomainNumaGetMaxCPUID(virDomainNumaPtr numa)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
unsigned int ret = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < numa->nmem_nodes; i++) {
|
||||||
|
int bit;
|
||||||
|
|
||||||
|
bit = virBitmapLastSetBit(virDomainNumaGetNodeCpumask(numa, i));
|
||||||
|
if (bit > ret)
|
||||||
|
ret = bit;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
virDomainNumaPtr
|
virDomainNumaPtr
|
||||||
virDomainNumaNew(void)
|
virDomainNumaNew(void)
|
||||||
|
@ -99,6 +99,9 @@ unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
|
|||||||
unsigned long long virDomainNumaGetMemorySize(virDomainNumaPtr numa)
|
unsigned long long virDomainNumaGetMemorySize(virDomainNumaPtr numa)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
virDomainNumaGetMaxCPUID(virDomainNumaPtr numa);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Formatters
|
* Formatters
|
||||||
*/
|
*/
|
||||||
|
@ -679,6 +679,7 @@ virNodeDeviceObjUnlock;
|
|||||||
virDomainNumaCheckABIStability;
|
virDomainNumaCheckABIStability;
|
||||||
virDomainNumaEquals;
|
virDomainNumaEquals;
|
||||||
virDomainNumaFree;
|
virDomainNumaFree;
|
||||||
|
virDomainNumaGetMaxCPUID;
|
||||||
virDomainNumaGetMemorySize;
|
virDomainNumaGetMemorySize;
|
||||||
virDomainNumaGetNodeCount;
|
virDomainNumaGetNodeCount;
|
||||||
virDomainNumaGetNodeCpumask;
|
virDomainNumaGetNodeCpumask;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user