[libvirt] [PATCH] test_driver: implement virConnectCompareCPU

Ilias Stamatis posted 1 patch 13 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190815160421.2265-1-stamatis.iliass@gmail.com
src/test/test_driver.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

[libvirt] [PATCH] test_driver: implement virConnectCompareCPU

Posted by Ilias Stamatis 13 weeks ago
Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
---

Probably we need to extend the host CPU's capabilities as well along
with this patch. Currently virCPUx86Compare reports "unknown host CPU".

 src/test/test_driver.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c39eef2d4b..b1037f4eab 100755
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1529,6 +1529,26 @@ static int testConnectGetMaxVcpus(virConnectPtr conn ATTRIBUTE_UNUSED,
     return 32;
 }

+
+static int
+testConnectCompareCPU(virConnectPtr conn,
+                      const char *xmlDesc,
+                      unsigned int flags)
+{
+    testDriverPtr privconn = conn->privateData;
+    bool failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE);
+    int ret = VIR_CPU_COMPARE_ERROR;
+
+    virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE,
+                  VIR_CPU_COMPARE_ERROR);
+
+    ret = virCPUCompareXML(privconn->caps->host.arch, privconn->caps->host.cpu,
+                           xmlDesc, failIncompatible);
+
+    return ret;
+}
+
+
 static char *
 testConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
                        const char **xmlCPUs,
@@ -9510,6 +9530,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainRevertToSnapshot = testDomainRevertToSnapshot, /* 1.1.4 */
     .domainSnapshotDelete = testDomainSnapshotDelete, /* 1.1.4 */

+    .connectCompareCPU =  testConnectCompareCPU, /* 5.7.0 */
     .connectBaselineCPU = testConnectBaselineCPU, /* 1.2.0 */
     .domainCheckpointCreateXML = testDomainCheckpointCreateXML, /* 5.6.0 */
     .domainCheckpointGetXMLDesc = testDomainCheckpointGetXMLDesc, /* 5.6.0 */
--
2.22.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list