Re: [PATCH 16/43] conf: numa: Don't fetch XML node count in virDomainNumatuneParseXML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Monday in 2022, Peter Krempa wrote:
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@xxxxxxxxxx>
---
src/conf/numa_conf.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 390ef49b84..688aa7b409 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -226,18 +226,13 @@ virDomainNumatuneParseXML(virDomainNuma *numa,
{
    g_autofree char *modestr = NULL;
    int mode = -1;
-    int n = 0;
    g_autofree char *placementstr = NULL;
    int placement = -1;
    g_autofree char *nodesetstr = NULL;
    g_autoptr(virBitmap) nodeset = NULL;
    xmlNodePtr node = NULL;

-    if (virXPathInt("count(./numatune)", ctxt, &n) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("cannot extract numatune nodes"));
-        return -1;
-    } else if (n > 1) {
+    if (virXPathBoolean("count(./numatune) > 1", ctxt) == 1) {

Alternatively, "boolean(./numatune[1])"

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux