test_driver: implement virConnectSupportsFeature

Make the test driver only support the VIR_TYPED_PARAM_STRING flag for
now.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Ilias Stamatis 2019-07-24 16:31:33 +02:00 committed by Erik Skultety
parent bfd18389d0
commit fb275b7673

29
src/test/test_driver.c Normal file → Executable file
View File

@ -1557,6 +1557,34 @@ testConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED)
return "TEST"; return "TEST";
} }
static int
testConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED,
int feature)
{
switch ((virDrvFeature) feature) {
case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
return 1;
case VIR_DRV_FEATURE_MIGRATION_V2:
case VIR_DRV_FEATURE_MIGRATION_V3:
case VIR_DRV_FEATURE_MIGRATION_P2P:
case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION:
case VIR_DRV_FEATURE_FD_PASSING:
case VIR_DRV_FEATURE_XML_MIGRATABLE:
case VIR_DRV_FEATURE_MIGRATION_OFFLINE:
case VIR_DRV_FEATURE_MIGRATION_PARAMS:
case VIR_DRV_FEATURE_MIGRATION_DIRECT:
case VIR_DRV_FEATURE_MIGRATION_V1:
case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE:
case VIR_DRV_FEATURE_REMOTE:
case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK:
case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK:
default:
return 0;
}
}
static int testConnectNumOfDomains(virConnectPtr conn) static int testConnectNumOfDomains(virConnectPtr conn)
{ {
testDriverPtr privconn = conn->privateData; testDriverPtr privconn = conn->privateData;
@ -7874,6 +7902,7 @@ static virHypervisorDriver testHypervisorDriver = {
.connectGetCapabilities = testConnectGetCapabilities, /* 0.2.1 */ .connectGetCapabilities = testConnectGetCapabilities, /* 0.2.1 */
.connectGetSysinfo = testConnectGetSysinfo, /* 2.3.0 */ .connectGetSysinfo = testConnectGetSysinfo, /* 2.3.0 */
.connectGetType = testConnectGetType, /* 2.3.0 */ .connectGetType = testConnectGetType, /* 2.3.0 */
.connectSupportsFeature = testConnectSupportsFeature, /* 5.6.0 */
.connectListDomains = testConnectListDomains, /* 0.1.1 */ .connectListDomains = testConnectListDomains, /* 0.1.1 */
.connectNumOfDomains = testConnectNumOfDomains, /* 0.1.1 */ .connectNumOfDomains = testConnectNumOfDomains, /* 0.1.1 */
.connectListAllDomains = testConnectListAllDomains, /* 0.9.13 */ .connectListAllDomains = testConnectListAllDomains, /* 0.9.13 */