mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
util: Error out if the numa nodeset is out of range
Instead of a silent warning, it's better to error out if the numa nodeset is out of range. Just like for numa node larger than NUMA_NUM_NODES.
This commit is contained in:
parent
4165ea9663
commit
148edcce66
@ -89,7 +89,6 @@ virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int maxnode = 0;
|
int maxnode = 0;
|
||||||
bool warned = false;
|
|
||||||
virBitmapPtr tmp_nodemask = NULL;
|
virBitmapPtr tmp_nodemask = NULL;
|
||||||
|
|
||||||
if (numatune.memory.placement_mode ==
|
if (numatune.memory.placement_mode ==
|
||||||
@ -113,20 +112,17 @@ virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
|
|||||||
}
|
}
|
||||||
|
|
||||||
maxnode = numa_max_node() + 1;
|
maxnode = numa_max_node() + 1;
|
||||||
|
|
||||||
/* Convert nodemask to NUMA bitmask. */
|
/* Convert nodemask to NUMA bitmask. */
|
||||||
nodemask_zero(&mask);
|
nodemask_zero(&mask);
|
||||||
i = -1;
|
i = -1;
|
||||||
while ((i = virBitmapNextSetBit(tmp_nodemask, i)) >= 0) {
|
while ((i = virBitmapNextSetBit(tmp_nodemask, i)) >= 0) {
|
||||||
if (i > NUMA_NUM_NODES) {
|
if (i > maxnode || i > NUMA_NUM_NODES) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Host cannot support NUMA node %d"), i);
|
_("Nodeset is out of range, host cannot support "
|
||||||
|
"NUMA node bigger than %d"), i);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (i > maxnode && !warned) {
|
|
||||||
VIR_WARN("nodeset is out of range, there is only %d NUMA "
|
|
||||||
"nodes on host", maxnode);
|
|
||||||
warned = true;
|
|
||||||
}
|
|
||||||
nodemask_set(&mask, i);
|
nodemask_set(&mask, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user