conf: numa: Check ABI stability of NUMA configuration

Add helper to compare initial sizes of indivitual NUMA nodes and the map
of belonging vCPUs. Other configuration is not ABI.
This commit is contained in:
Peter Krempa 2015-02-16 20:34:37 +01:00
parent e431c3c092
commit b98596a717
4 changed files with 46 additions and 0 deletions

View File

@ -15970,6 +15970,9 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
goto error; goto error;
} }
if (!virDomainNumaCheckABIStability(src->numa, dst->numa))
goto error;
if (src->vcpus != dst->vcpus) { if (src->vcpus != dst->vcpus) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target domain vCPU count %d does not match source %d"), _("Target domain vCPU count %d does not match source %d"),

View File

@ -814,6 +814,45 @@ virDomainNumaNew(void)
} }
bool
virDomainNumaCheckABIStability(virDomainNumaPtr src,
virDomainNumaPtr tgt)
{
size_t i;
if (virDomainNumaGetNodeCount(src) != virDomainNumaGetNodeCount(tgt)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target NUMA node count '%zu' doesn't match "
"source '%zu'"),
virDomainNumaGetNodeCount(tgt),
virDomainNumaGetNodeCount(src));
return false;
}
for (i = 0; i < virDomainNumaGetNodeCount(src); i++) {
if (virDomainNumaGetNodeMemorySize(src, i) !=
virDomainNumaGetNodeMemorySize(tgt, i)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Size of target NUMA node %zu (%llu) doesn't "
"match source (%llu)"), i,
virDomainNumaGetNodeMemorySize(tgt, i),
virDomainNumaGetNodeMemorySize(src, i));
return false;
}
if (!virBitmapEqual(virDomainNumaGetNodeCpumask(src, i),
virDomainNumaGetNodeCpumask(tgt, i))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Processor mask of target NUMA node %zu doesn't "
"match source"), i);
return false;
}
}
return true;
}
size_t size_t
virDomainNumaGetNodeCount(virDomainNumaPtr numa) virDomainNumaGetNodeCount(virDomainNumaPtr numa)
{ {

View File

@ -129,6 +129,9 @@ void virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa,
bool virDomainNumaEquals(virDomainNumaPtr n1, bool virDomainNumaEquals(virDomainNumaPtr n1,
virDomainNumaPtr n2); virDomainNumaPtr n2);
bool virDomainNumaCheckABIStability(virDomainNumaPtr src,
virDomainNumaPtr tgt);
bool virDomainNumatuneHasPlacementAuto(virDomainNumaPtr numatune); bool virDomainNumatuneHasPlacementAuto(virDomainNumaPtr numatune);
bool virDomainNumatuneHasPerNodeBinding(virDomainNumaPtr numatune); bool virDomainNumatuneHasPerNodeBinding(virDomainNumaPtr numatune);

View File

@ -627,6 +627,7 @@ virNodeDeviceObjUnlock;
# conf/numa_conf.h # conf/numa_conf.h
virDomainNumaCheckABIStability;
virDomainNumaEquals; virDomainNumaEquals;
virDomainNumaFree; virDomainNumaFree;
virDomainNumaGetNodeCount; virDomainNumaGetNodeCount;