[libvirt] [PATCH 08/12] test: Implement virConnectSupportsFeature

Marc Hartmayer mhartmay at linux.vnet.ibm.com
Wed May 9 14:56:18 UTC 2018


Implement virConnectSupportsFeature for the test driver as this API is
used by various API functions (the functions usually use the macro
VIR_DRV_SUPPORTS_FEATURE for calling virConnectSupportsFeature). The
support for the feature VIR_DRV_FEATURE_TYPED_PARAM_STRING is needed
for the upcoming test case for the API `virDomainCreateWithParams`.

Signed-off-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk at linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
---
 src/test/test_driver.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 467587b19fa8..2a85f87684dd 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -6810,6 +6810,33 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
 }
 
 
+static int
+testConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED,
+                           int feature)
+{
+    switch (feature) {
+    case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK:
+    case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
+        return 1;
+    case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK:
+    case VIR_DRV_FEATURE_FD_PASSING:
+    case VIR_DRV_FEATURE_MIGRATION_V1:
+    case VIR_DRV_FEATURE_REMOTE:
+    case VIR_DRV_FEATURE_MIGRATION_V2:
+    case VIR_DRV_FEATURE_MIGRATION_P2P:
+    case VIR_DRV_FEATURE_MIGRATION_DIRECT:
+    case VIR_DRV_FEATURE_MIGRATION_V3:
+    case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION:
+    case VIR_DRV_FEATURE_XML_MIGRATABLE:
+    case VIR_DRV_FEATURE_MIGRATION_OFFLINE:
+    case VIR_DRV_FEATURE_MIGRATION_PARAMS:
+    case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE:
+        return 0;
+    }
+
+    return 0;
+}
+
 
 static virHypervisorDriver testHypervisorDriver = {
     .name = "Test",
@@ -6818,6 +6845,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .connectGetVersion = testConnectGetVersion, /* 0.1.1 */
     .connectGetHostname = testConnectGetHostname, /* 0.6.3 */
     .connectGetMaxVcpus = testConnectGetMaxVcpus, /* 0.3.2 */
+    .connectSupportsFeature = testConnectSupportsFeature, /* 4.4.0 */
     .nodeGetInfo = testNodeGetInfo, /* 0.1.1 */
     .nodeGetCPUStats = testNodeGetCPUStats, /* 2.3.0 */
     .nodeGetFreeMemory = testNodeGetFreeMemory, /* 2.3.0 */
-- 
2.13.4




More information about the libvir-list mailing list