render / rpms / libvirt

Forked from rpms/libvirt 4 months ago
Clone
e8e641
From 2ffa5538e4f7507a77fdb7ac23bdc8aa51e54297 Mon Sep 17 00:00:00 2001
e8e641
Message-Id: <2ffa5538e4f7507a77fdb7ac23bdc8aa51e54297@dist-git>
e8e641
From: Michal Privoznik <mprivozn@redhat.com>
e8e641
Date: Tue, 7 Mar 2023 16:06:14 +0100
e8e641
Subject: [PATCH] qemuxml2argvmock: Drop virNuma* mocks
e8e641
e8e641
Since qemuxml2argvtest is now using virnumamock, there's no need
e8e641
for qemuxml2argvmock to offer reimplementation of virNuma*()
e8e641
functions. Also, the comment about CLang and FreeBSD (introduced
e8e641
in v4.3.0-40-g77ac204d14) is no longer true. Looks like noinline
e8e641
attribute was the missing culprit.
e8e641
e8e641
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
e8e641
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
e8e641
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
e8e641
(cherry picked from commit 95ae91fdd4da33323ead8f916824b48f8506383c)
e8e641
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
e8e641
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
e8e641
---
e8e641
 src/util/virnuma.h                            |  2 +-
e8e641
 ...-unavailable-restrictive.x86_64-latest.err |  2 +-
e8e641
 ...mnode-unavailable-strict.x86_64-latest.err |  2 +-
e8e641
 ...umatune-static-nodeset-exceed-hostnode.err |  2 +-
e8e641
 tests/qemuxml2argvmock.c                      | 42 -------------------
e8e641
 5 files changed, 4 insertions(+), 46 deletions(-)
e8e641
e8e641
diff --git a/src/util/virnuma.h b/src/util/virnuma.h
e8e641
index edd701d5c8..475df96e1d 100644
e8e641
--- a/src/util/virnuma.h
e8e641
+++ b/src/util/virnuma.h
e8e641
@@ -32,7 +32,7 @@ int virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode,
e8e641
                              virBitmap *nodeset);
e8e641
 
e8e641
 virBitmap *virNumaGetHostMemoryNodeset(void);
e8e641
-bool virNumaNodesetIsAvailable(virBitmap *nodeset) G_NO_INLINE;
e8e641
+bool virNumaNodesetIsAvailable(virBitmap *nodeset);
e8e641
 bool virNumaIsAvailable(void) G_NO_INLINE;
e8e641
 int virNumaGetMaxNode(void) G_NO_INLINE;
e8e641
 bool virNumaNodeIsAvailable(int node) G_NO_INLINE;
e8e641
diff --git a/tests/qemuxml2argvdata/numatune-memnode-unavailable-restrictive.x86_64-latest.err b/tests/qemuxml2argvdata/numatune-memnode-unavailable-restrictive.x86_64-latest.err
e8e641
index a826c3cdeb..f872dd7e92 100644
e8e641
--- a/tests/qemuxml2argvdata/numatune-memnode-unavailable-restrictive.x86_64-latest.err
e8e641
+++ b/tests/qemuxml2argvdata/numatune-memnode-unavailable-restrictive.x86_64-latest.err
e8e641
@@ -1 +1 @@
e8e641
-internal error: Mock: no numa node set is available at bit 999
e8e641
+unsupported configuration: NUMA node 999 is unavailable
e8e641
diff --git a/tests/qemuxml2argvdata/numatune-memnode-unavailable-strict.x86_64-latest.err b/tests/qemuxml2argvdata/numatune-memnode-unavailable-strict.x86_64-latest.err
e8e641
index a826c3cdeb..f872dd7e92 100644
e8e641
--- a/tests/qemuxml2argvdata/numatune-memnode-unavailable-strict.x86_64-latest.err
e8e641
+++ b/tests/qemuxml2argvdata/numatune-memnode-unavailable-strict.x86_64-latest.err
e8e641
@@ -1 +1 @@
e8e641
-internal error: Mock: no numa node set is available at bit 999
e8e641
+unsupported configuration: NUMA node 999 is unavailable
e8e641
diff --git a/tests/qemuxml2argvdata/numatune-static-nodeset-exceed-hostnode.err b/tests/qemuxml2argvdata/numatune-static-nodeset-exceed-hostnode.err
e8e641
index b6b98775ee..2a33ccd791 100644
e8e641
--- a/tests/qemuxml2argvdata/numatune-static-nodeset-exceed-hostnode.err
e8e641
+++ b/tests/qemuxml2argvdata/numatune-static-nodeset-exceed-hostnode.err
e8e641
@@ -1 +1 @@
e8e641
-internal error: Mock: no numa node set is available at bit 8
e8e641
+unsupported configuration: NUMA node 4 is unavailable
e8e641
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
e8e641
index 85bd76c315..f566ec539a 100644
e8e641
--- a/tests/qemuxml2argvmock.c
e8e641
+++ b/tests/qemuxml2argvmock.c
e8e641
@@ -30,7 +30,6 @@
e8e641
 #include "virnetdevip.h"
e8e641
 #include "virnetdevtap.h"
e8e641
 #include "virnetdevopenvswitch.h"
e8e641
-#include "virnuma.h"
e8e641
 #include "virscsivhost.h"
e8e641
 #include "virtpm.h"
e8e641
 #include "virutil.h"
e8e641
@@ -56,47 +55,6 @@ GDateTime *g_date_time_new_now_local(void)
e8e641
     return g_date_time_new_from_unix_local(1234567890);
e8e641
 }
e8e641
 
e8e641
-bool
e8e641
-virNumaIsAvailable(void)
e8e641
-{
e8e641
-    return true;
e8e641
-}
e8e641
-
e8e641
-int
e8e641
-virNumaGetMaxNode(void)
e8e641
-{
e8e641
-    return 7;
e8e641
-}
e8e641
-
e8e641
-/* We shouldn't need to mock virNumaNodeIsAvailable() and *definitely* not
e8e641
- * virNumaNodesetIsAvailable(), but it seems to be the only way to get
e8e641
- * mocking to work with Clang on FreeBSD, so keep these duplicates around
e8e641
- * until we figure out a cleaner solution */
e8e641
-bool
e8e641
-virNumaNodeIsAvailable(int node)
e8e641
-{
e8e641
-    return node >= 0 && node <= virNumaGetMaxNode();
e8e641
-}
e8e641
-
e8e641
-bool
e8e641
-virNumaNodesetIsAvailable(virBitmap *nodeset)
e8e641
-{
e8e641
-    ssize_t bit = -1;
e8e641
-
e8e641
-    if (!nodeset)
e8e641
-        return true;
e8e641
-
e8e641
-    while ((bit = virBitmapNextSetBit(nodeset, bit)) >= 0) {
e8e641
-        if (virNumaNodeIsAvailable(bit))
e8e641
-            continue;
e8e641
-
e8e641
-        virReportError(VIR_ERR_INTERNAL_ERROR,
e8e641
-                       "Mock: no numa node set is available at bit %zd", bit);
e8e641
-        return false;
e8e641
-    }
e8e641
-
e8e641
-    return true;
e8e641
-}
e8e641
 
e8e641
 char *
e8e641
 virTPMCreateCancelPath(const char *devpath)
e8e641
-- 
e8e641
2.40.0