mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
Stub out node device APIs in test driver
This commit is contained in:
parent
2a23198886
commit
8492cd2084
@ -1,3 +1,8 @@
|
||||
Thu Dec 4 21:00:41 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/test.c: Stub out node device APIs to avoid activating
|
||||
the daemon
|
||||
|
||||
Thu Dec 4 20:58:41 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/test.c: Add locking for thread safety
|
||||
|
27
src/test.c
27
src/test.c
@ -3222,6 +3222,22 @@ cleanup:
|
||||
}
|
||||
|
||||
|
||||
static virDrvOpenStatus testDevMonOpen(virConnectPtr conn,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||
int flags ATTRIBUTE_UNUSED) {
|
||||
if (STRNEQ(conn->driver->name, "Test"))
|
||||
return VIR_DRV_OPEN_DECLINED;
|
||||
|
||||
conn->devMonPrivateData = conn->privateData;
|
||||
return VIR_DRV_OPEN_SUCCESS;
|
||||
}
|
||||
|
||||
static int testDevMonClose(virConnectPtr conn) {
|
||||
conn->devMonPrivateData = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static virDriver testDriver = {
|
||||
VIR_DRV_TEST,
|
||||
"Test",
|
||||
@ -3345,6 +3361,14 @@ static virStorageDriver testStorageDriver = {
|
||||
.volGetPath = testStorageVolumeGetPath,
|
||||
};
|
||||
|
||||
static virDeviceMonitor testDevMonitor = {
|
||||
.name = "Test",
|
||||
.open = testDevMonOpen,
|
||||
.close = testDevMonClose,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* testRegister:
|
||||
*
|
||||
@ -3359,5 +3383,8 @@ testRegister(void)
|
||||
return -1;
|
||||
if (virRegisterStorageDriver(&testStorageDriver) < 0)
|
||||
return -1;
|
||||
if (virRegisterDeviceMonitor(&testDevMonitor) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user