mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
conf: numa: Refactor logic in virDomainNumatuneParseXML
Shuffling around the logic will allow to simplify the code quite a bit. As an additional bonus the change in the logic now reports an error if automatic placement is selected and individual placement is configured.
This commit is contained in:
parent
67bd807c4d
commit
638e3d270f
@ -229,42 +229,31 @@ virDomainNumatuneParseXML(virDomainNumaPtr *numatunePtr,
|
|||||||
*numatunePtr = NULL;
|
*numatunePtr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node && placement_static) {
|
if (!placement_static && !node)
|
||||||
if (virDomainNumatuneNodeParseXML(numatunePtr, ncells, ctxt) < 0)
|
placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
|
||||||
|
|
||||||
|
if (node) {
|
||||||
|
if ((tmp = virXMLPropString(node, "mode")) &&
|
||||||
|
(mode = virDomainNumatuneMemModeTypeFromString(tmp)) < 0) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("Unsupported NUMA memory tuning mode '%s'"), tmp);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
return 0;
|
}
|
||||||
}
|
VIR_FREE(tmp);
|
||||||
|
|
||||||
if (!node) {
|
if ((tmp = virXMLPropString(node, "placement")) &&
|
||||||
/* We know that placement_mode is "auto" if we're here */
|
(placement = virDomainNumatunePlacementTypeFromString(tmp)) < 0) {
|
||||||
ret = virDomainNumatuneSet(numatunePtr,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
placement_static,
|
_("Unsupported NUMA memory placement mode '%s'"), tmp);
|
||||||
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO,
|
goto cleanup;
|
||||||
-1,
|
}
|
||||||
NULL);
|
VIR_FREE(tmp);
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((tmp = virXMLPropString(node, "mode")) &&
|
if ((tmp = virXMLPropString(node, "nodeset")) &&
|
||||||
(mode = virDomainNumatuneMemModeTypeFromString(tmp)) < 0) {
|
virBitmapParse(tmp, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
goto cleanup;
|
||||||
_("Unsupported NUMA memory tuning mode '%s'"), tmp);
|
VIR_FREE(tmp);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
VIR_FREE(tmp);
|
|
||||||
|
|
||||||
if ((tmp = virXMLPropString(node, "placement")) &&
|
|
||||||
(placement = virDomainNumatunePlacementTypeFromString(tmp)) < 0) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("Unsupported NUMA memory placement mode '%s'"), tmp);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
VIR_FREE(tmp);
|
|
||||||
|
|
||||||
if ((tmp = virXMLPropString(node, "nodeset")) &&
|
|
||||||
virBitmapParse(tmp, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
VIR_FREE(tmp);
|
|
||||||
|
|
||||||
if (virDomainNumatuneSet(numatunePtr,
|
if (virDomainNumatuneSet(numatunePtr,
|
||||||
placement_static,
|
placement_static,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user