[PATCH] qemuxml2argvmock: Deduplicate some code

Michal Privoznik mprivozn at redhat.com
Thu Jul 22 13:31:10 UTC 2021


A stub implementation for virQEMUCapsGetKVMSupportsSecureGuest()
was added recently. However, the very same implementation was
added to domaincapsmock.c which is also loaded by
qemuxml2argvtest and thus one occurrence of the stub can be
dropped.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/qemuxml2argvmock.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index d7f77eabf7..9235c785b2 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -302,18 +302,3 @@ virIdentityEnsureSystemToken(void)
 {
     return g_strdup("3de80bcbf22d4833897f1638e01be9b2");
 }
-
-static bool (*real_virQEMUCapsGetKVMSupportsSecureGuest)(virQEMUCaps *qemuCaps);
-
-bool
-virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps)
-{
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT) &&
-        virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST))
-        return true;
-
-    if (!real_virQEMUCapsGetKVMSupportsSecureGuest)
-        VIR_MOCK_REAL_INIT(virQEMUCapsGetKVMSupportsSecureGuest);
-
-    return real_virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps);
-}
-- 
2.31.1




More information about the libvir-list mailing list