conf: numa: Don't fetch XML node count in virDomainNumatuneParseXML
The code only wants to refuse cases where more than one 'numatune' element is present which can be achieved by using 'virXPathBoolean'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
136f351b0f
commit
5575187ece
@ -226,18 +226,13 @@ virDomainNumatuneParseXML(virDomainNuma *numa,
|
|||||||
{
|
{
|
||||||
g_autofree char *modestr = NULL;
|
g_autofree char *modestr = NULL;
|
||||||
int mode = -1;
|
int mode = -1;
|
||||||
int n = 0;
|
|
||||||
g_autofree char *placementstr = NULL;
|
g_autofree char *placementstr = NULL;
|
||||||
int placement = -1;
|
int placement = -1;
|
||||||
g_autofree char *nodesetstr = NULL;
|
g_autofree char *nodesetstr = NULL;
|
||||||
g_autoptr(virBitmap) nodeset = NULL;
|
g_autoptr(virBitmap) nodeset = NULL;
|
||||||
xmlNodePtr node = NULL;
|
xmlNodePtr node = NULL;
|
||||||
|
|
||||||
if (virXPathInt("count(./numatune)", ctxt, &n) < 0) {
|
if (virXPathBoolean("count(./numatune) > 1", ctxt) == 1) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
||||||
_("cannot extract numatune nodes"));
|
|
||||||
return -1;
|
|
||||||
} else if (n > 1) {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("only one numatune is supported"));
|
_("only one numatune is supported"));
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user