mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
test: implement storage lifecycle event APIs
Also includes unittests for storage pool lifecycle events API
This commit is contained in:
parent
dc7b849a0c
commit
edc1a27a5a
@ -49,6 +49,7 @@
|
|||||||
#include "snapshot_conf.h"
|
#include "snapshot_conf.h"
|
||||||
#include "fdstream.h"
|
#include "fdstream.h"
|
||||||
#include "storage_conf.h"
|
#include "storage_conf.h"
|
||||||
|
#include "storage_event.h"
|
||||||
#include "node_device_conf.h"
|
#include "node_device_conf.h"
|
||||||
#include "virxml.h"
|
#include "virxml.h"
|
||||||
#include "virthread.h"
|
#include "virthread.h"
|
||||||
@ -4114,6 +4115,7 @@ testStoragePoolCreate(virStoragePoolPtr pool,
|
|||||||
testDriverPtr privconn = pool->conn->privateData;
|
testDriverPtr privconn = pool->conn->privateData;
|
||||||
virStoragePoolObjPtr privpool;
|
virStoragePoolObjPtr privpool;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
virObjectEventPtr event = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
@ -4134,9 +4136,14 @@ testStoragePoolCreate(virStoragePoolPtr pool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
privpool->active = 1;
|
privpool->active = 1;
|
||||||
|
|
||||||
|
event = virStoragePoolEventLifecycleNew(pool->name, pool->uuid,
|
||||||
|
VIR_STORAGE_POOL_EVENT_STARTED,
|
||||||
|
0);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
testObjectEventQueue(privconn, event);
|
||||||
if (privpool)
|
if (privpool)
|
||||||
virStoragePoolObjUnlock(privpool);
|
virStoragePoolObjUnlock(privpool);
|
||||||
return ret;
|
return ret;
|
||||||
@ -4204,6 +4211,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
|
|||||||
virStoragePoolDefPtr def;
|
virStoragePoolDefPtr def;
|
||||||
virStoragePoolObjPtr pool = NULL;
|
virStoragePoolObjPtr pool = NULL;
|
||||||
virStoragePoolPtr ret = NULL;
|
virStoragePoolPtr ret = NULL;
|
||||||
|
virObjectEventPtr event = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
@ -4231,11 +4239,16 @@ testStoragePoolCreateXML(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
pool->active = 1;
|
pool->active = 1;
|
||||||
|
|
||||||
|
event = virStoragePoolEventLifecycleNew(pool->def->name, pool->def->uuid,
|
||||||
|
VIR_STORAGE_POOL_EVENT_STARTED,
|
||||||
|
0);
|
||||||
|
|
||||||
ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid,
|
ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virStoragePoolDefFree(def);
|
virStoragePoolDefFree(def);
|
||||||
|
testObjectEventQueue(privconn, event);
|
||||||
if (pool)
|
if (pool)
|
||||||
virStoragePoolObjUnlock(pool);
|
virStoragePoolObjUnlock(pool);
|
||||||
testDriverUnlock(privconn);
|
testDriverUnlock(privconn);
|
||||||
@ -4251,6 +4264,7 @@ testStoragePoolDefineXML(virConnectPtr conn,
|
|||||||
virStoragePoolDefPtr def;
|
virStoragePoolDefPtr def;
|
||||||
virStoragePoolObjPtr pool = NULL;
|
virStoragePoolObjPtr pool = NULL;
|
||||||
virStoragePoolPtr ret = NULL;
|
virStoragePoolPtr ret = NULL;
|
||||||
|
virObjectEventPtr event = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
@ -4266,6 +4280,10 @@ testStoragePoolDefineXML(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
def = NULL;
|
def = NULL;
|
||||||
|
|
||||||
|
event = virStoragePoolEventLifecycleNew(pool->def->name, pool->def->uuid,
|
||||||
|
VIR_STORAGE_POOL_EVENT_DEFINED,
|
||||||
|
0);
|
||||||
|
|
||||||
if (testStoragePoolObjSetDefaults(pool) == -1) {
|
if (testStoragePoolObjSetDefaults(pool) == -1) {
|
||||||
virStoragePoolObjRemove(&privconn->pools, pool);
|
virStoragePoolObjRemove(&privconn->pools, pool);
|
||||||
pool = NULL;
|
pool = NULL;
|
||||||
@ -4277,6 +4295,7 @@ testStoragePoolDefineXML(virConnectPtr conn,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virStoragePoolDefFree(def);
|
virStoragePoolDefFree(def);
|
||||||
|
testObjectEventQueue(privconn, event);
|
||||||
if (pool)
|
if (pool)
|
||||||
virStoragePoolObjUnlock(pool);
|
virStoragePoolObjUnlock(pool);
|
||||||
testDriverUnlock(privconn);
|
testDriverUnlock(privconn);
|
||||||
@ -4289,6 +4308,7 @@ testStoragePoolUndefine(virStoragePoolPtr pool)
|
|||||||
testDriverPtr privconn = pool->conn->privateData;
|
testDriverPtr privconn = pool->conn->privateData;
|
||||||
virStoragePoolObjPtr privpool;
|
virStoragePoolObjPtr privpool;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
virObjectEventPtr event = NULL;
|
||||||
|
|
||||||
testDriverLock(privconn);
|
testDriverLock(privconn);
|
||||||
privpool = virStoragePoolObjFindByName(&privconn->pools,
|
privpool = virStoragePoolObjFindByName(&privconn->pools,
|
||||||
@ -4305,6 +4325,10 @@ testStoragePoolUndefine(virStoragePoolPtr pool)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event = virStoragePoolEventLifecycleNew(pool->name, pool->uuid,
|
||||||
|
VIR_STORAGE_POOL_EVENT_UNDEFINED,
|
||||||
|
0);
|
||||||
|
|
||||||
virStoragePoolObjRemove(&privconn->pools, privpool);
|
virStoragePoolObjRemove(&privconn->pools, privpool);
|
||||||
privpool = NULL;
|
privpool = NULL;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -4312,6 +4336,7 @@ testStoragePoolUndefine(virStoragePoolPtr pool)
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (privpool)
|
if (privpool)
|
||||||
virStoragePoolObjUnlock(privpool);
|
virStoragePoolObjUnlock(privpool);
|
||||||
|
testObjectEventQueue(privconn, event);
|
||||||
testDriverUnlock(privconn);
|
testDriverUnlock(privconn);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -4356,6 +4381,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool)
|
|||||||
testDriverPtr privconn = pool->conn->privateData;
|
testDriverPtr privconn = pool->conn->privateData;
|
||||||
virStoragePoolObjPtr privpool;
|
virStoragePoolObjPtr privpool;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
virObjectEventPtr event = NULL;
|
||||||
|
|
||||||
testDriverLock(privconn);
|
testDriverLock(privconn);
|
||||||
privpool = virStoragePoolObjFindByName(&privconn->pools,
|
privpool = virStoragePoolObjFindByName(&privconn->pools,
|
||||||
@ -4373,6 +4399,9 @@ testStoragePoolDestroy(virStoragePoolPtr pool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
privpool->active = 0;
|
privpool->active = 0;
|
||||||
|
event = virStoragePoolEventLifecycleNew(privpool->def->name, privpool->def->uuid,
|
||||||
|
VIR_STORAGE_POOL_EVENT_STOPPED,
|
||||||
|
0);
|
||||||
|
|
||||||
if (privpool->configFile == NULL) {
|
if (privpool->configFile == NULL) {
|
||||||
virStoragePoolObjRemove(&privconn->pools, privpool);
|
virStoragePoolObjRemove(&privconn->pools, privpool);
|
||||||
@ -4381,6 +4410,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
testObjectEventQueue(privconn, event);
|
||||||
if (privpool)
|
if (privpool)
|
||||||
virStoragePoolObjUnlock(privpool);
|
virStoragePoolObjUnlock(privpool);
|
||||||
testDriverUnlock(privconn);
|
testDriverUnlock(privconn);
|
||||||
@ -4430,6 +4460,7 @@ testStoragePoolRefresh(virStoragePoolPtr pool,
|
|||||||
testDriverPtr privconn = pool->conn->privateData;
|
testDriverPtr privconn = pool->conn->privateData;
|
||||||
virStoragePoolObjPtr privpool;
|
virStoragePoolObjPtr privpool;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
virObjectEventPtr event = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
@ -4448,9 +4479,14 @@ testStoragePoolRefresh(virStoragePoolPtr pool,
|
|||||||
_("storage pool '%s' is not active"), pool->name);
|
_("storage pool '%s' is not active"), pool->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event = virStoragePoolEventLifecycleNew(pool->name, pool->uuid,
|
||||||
|
VIR_STORAGE_POOL_EVENT_REFRESHED,
|
||||||
|
0);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
testObjectEventQueue(privconn, event);
|
||||||
if (privpool)
|
if (privpool)
|
||||||
virStoragePoolObjUnlock(privpool);
|
virStoragePoolObjUnlock(privpool);
|
||||||
return ret;
|
return ret;
|
||||||
@ -5644,6 +5680,39 @@ testConnectNetworkEventDeregisterAny(virConnectPtr conn,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
testConnectStoragePoolEventRegisterAny(virConnectPtr conn,
|
||||||
|
virStoragePoolPtr pool,
|
||||||
|
int eventID,
|
||||||
|
virConnectStoragePoolEventGenericCallback callback,
|
||||||
|
void *opaque,
|
||||||
|
virFreeCallback freecb)
|
||||||
|
{
|
||||||
|
testDriverPtr driver = conn->privateData;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (virStoragePoolEventStateRegisterID(conn, driver->eventState,
|
||||||
|
pool, eventID, callback,
|
||||||
|
opaque, freecb, &ret) < 0)
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
testConnectStoragePoolEventDeregisterAny(virConnectPtr conn,
|
||||||
|
int callbackID)
|
||||||
|
{
|
||||||
|
testDriverPtr driver = conn->privateData;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (virObjectEventStateDeregisterID(conn, driver->eventState,
|
||||||
|
callbackID) < 0)
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int testConnectListAllDomains(virConnectPtr conn,
|
static int testConnectListAllDomains(virConnectPtr conn,
|
||||||
virDomainPtr **domains,
|
virDomainPtr **domains,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
@ -6751,6 +6820,8 @@ static virStorageDriver testStorageDriver = {
|
|||||||
.connectListDefinedStoragePools = testConnectListDefinedStoragePools, /* 0.5.0 */
|
.connectListDefinedStoragePools = testConnectListDefinedStoragePools, /* 0.5.0 */
|
||||||
.connectListAllStoragePools = testConnectListAllStoragePools, /* 0.10.2 */
|
.connectListAllStoragePools = testConnectListAllStoragePools, /* 0.10.2 */
|
||||||
.connectFindStoragePoolSources = testConnectFindStoragePoolSources, /* 0.5.0 */
|
.connectFindStoragePoolSources = testConnectFindStoragePoolSources, /* 0.5.0 */
|
||||||
|
.connectStoragePoolEventRegisterAny = testConnectStoragePoolEventRegisterAny, /* 2.0.0 */
|
||||||
|
.connectStoragePoolEventDeregisterAny = testConnectStoragePoolEventDeregisterAny, /* 2.0.0 */
|
||||||
.storagePoolLookupByName = testStoragePoolLookupByName, /* 0.5.0 */
|
.storagePoolLookupByName = testStoragePoolLookupByName, /* 0.5.0 */
|
||||||
.storagePoolLookupByUUID = testStoragePoolLookupByUUID, /* 0.5.0 */
|
.storagePoolLookupByUUID = testStoragePoolLookupByUUID, /* 0.5.0 */
|
||||||
.storagePoolLookupByVolume = testStoragePoolLookupByVolume, /* 0.5.0 */
|
.storagePoolLookupByVolume = testStoragePoolLookupByVolume, /* 0.5.0 */
|
||||||
|
@ -53,12 +53,21 @@ static const char networkDef[] =
|
|||||||
" </ip>\n"
|
" </ip>\n"
|
||||||
"</network>\n";
|
"</network>\n";
|
||||||
|
|
||||||
|
static const char storagePoolDef[] =
|
||||||
|
"<pool type='dir'>\n"
|
||||||
|
" <name>P</name>\n"
|
||||||
|
" <target>\n"
|
||||||
|
" <path>/target-path</path>\n"
|
||||||
|
" </target>\n"
|
||||||
|
"</pool>\n";
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int startEvents;
|
int startEvents;
|
||||||
int stopEvents;
|
int stopEvents;
|
||||||
int defineEvents;
|
int defineEvents;
|
||||||
int undefineEvents;
|
int undefineEvents;
|
||||||
int unexpectedEvents;
|
int unexpectedEvents;
|
||||||
|
int refreshEvents;
|
||||||
} lifecycleEventCounter;
|
} lifecycleEventCounter;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -69,11 +78,13 @@ lifecycleEventCounter_reset(lifecycleEventCounter *counter)
|
|||||||
counter->defineEvents = 0;
|
counter->defineEvents = 0;
|
||||||
counter->undefineEvents = 0;
|
counter->undefineEvents = 0;
|
||||||
counter->unexpectedEvents = 0;
|
counter->unexpectedEvents = 0;
|
||||||
|
counter->refreshEvents = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
virConnectPtr conn;
|
virConnectPtr conn;
|
||||||
virNetworkPtr net;
|
virNetworkPtr net;
|
||||||
|
virStoragePoolPtr pool;
|
||||||
} objecteventTest;
|
} objecteventTest;
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +136,26 @@ networkLifecycleCb(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
counter->undefineEvents++;
|
counter->undefineEvents++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
storagePoolLifecycleCb(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
|
virStoragePoolPtr pool ATTRIBUTE_UNUSED,
|
||||||
|
int event,
|
||||||
|
int detail ATTRIBUTE_UNUSED,
|
||||||
|
void* opaque)
|
||||||
|
{
|
||||||
|
lifecycleEventCounter *counter = opaque;
|
||||||
|
|
||||||
|
if (event == VIR_STORAGE_POOL_EVENT_STARTED)
|
||||||
|
counter->startEvents++;
|
||||||
|
else if (event == VIR_STORAGE_POOL_EVENT_STOPPED)
|
||||||
|
counter->stopEvents++;
|
||||||
|
else if (event == VIR_STORAGE_POOL_EVENT_DEFINED)
|
||||||
|
counter->defineEvents++;
|
||||||
|
else if (event == VIR_STORAGE_POOL_EVENT_UNDEFINED)
|
||||||
|
counter->undefineEvents++;
|
||||||
|
else if (event == VIR_STORAGE_POOL_EVENT_REFRESHED)
|
||||||
|
counter->refreshEvents++;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testDomainCreateXMLOld(const void *data)
|
testDomainCreateXMLOld(const void *data)
|
||||||
@ -523,6 +554,130 @@ testNetworkStartStopEvent(const void *data)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
testStoragePoolCreateXML(const void *data)
|
||||||
|
{
|
||||||
|
const objecteventTest *test = data;
|
||||||
|
lifecycleEventCounter counter;
|
||||||
|
virStoragePoolPtr pool;
|
||||||
|
int id;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
lifecycleEventCounter_reset(&counter);
|
||||||
|
|
||||||
|
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
||||||
|
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
||||||
|
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
||||||
|
&counter, NULL);
|
||||||
|
pool = virStoragePoolCreateXML(test->conn, storagePoolDef, 0);
|
||||||
|
|
||||||
|
if (!pool || virEventRunDefaultImpl() < 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (counter.startEvents != 1 || counter.unexpectedEvents > 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virConnectStoragePoolEventDeregisterAny(test->conn, id);
|
||||||
|
if (pool) {
|
||||||
|
virStoragePoolDestroy(pool);
|
||||||
|
virStoragePoolFree(pool);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
testStoragePoolDefine(const void *data)
|
||||||
|
{
|
||||||
|
const objecteventTest *test = data;
|
||||||
|
lifecycleEventCounter counter;
|
||||||
|
virStoragePoolPtr pool;
|
||||||
|
int id;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
lifecycleEventCounter_reset(&counter);
|
||||||
|
|
||||||
|
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
||||||
|
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
||||||
|
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
||||||
|
&counter, NULL);
|
||||||
|
|
||||||
|
/* Make sure the define event is triggered */
|
||||||
|
pool = virStoragePoolDefineXML(test->conn, storagePoolDef, 0);
|
||||||
|
|
||||||
|
if (!pool || virEventRunDefaultImpl() < 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (counter.defineEvents != 1 || counter.unexpectedEvents > 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure the undefine event is triggered */
|
||||||
|
virStoragePoolUndefine(pool);
|
||||||
|
|
||||||
|
if (virEventRunDefaultImpl() < 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (counter.undefineEvents != 1 || counter.unexpectedEvents > 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virConnectStoragePoolEventDeregisterAny(test->conn, id);
|
||||||
|
if (pool)
|
||||||
|
virStoragePoolFree(pool);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
testStoragePoolStartStopEvent(const void *data)
|
||||||
|
{
|
||||||
|
const objecteventTest *test = data;
|
||||||
|
lifecycleEventCounter counter;
|
||||||
|
int id;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (!test->pool)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
lifecycleEventCounter_reset(&counter);
|
||||||
|
|
||||||
|
id = virConnectStoragePoolEventRegisterAny(test->conn, test->pool,
|
||||||
|
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
||||||
|
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
||||||
|
&counter, NULL);
|
||||||
|
virStoragePoolCreate(test->pool, 0);
|
||||||
|
virStoragePoolRefresh(test->pool, 0);
|
||||||
|
virStoragePoolDestroy(test->pool);
|
||||||
|
|
||||||
|
if (virEventRunDefaultImpl() < 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (counter.startEvents != 1 || counter.stopEvents != 1 ||
|
||||||
|
counter.refreshEvents != 1 || counter.unexpectedEvents > 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virConnectStoragePoolEventDeregisterAny(test->conn, id);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
timeout(int id ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED)
|
timeout(int id ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
@ -581,6 +736,28 @@ mymain(void)
|
|||||||
virNetworkUndefine(test.net);
|
virNetworkUndefine(test.net);
|
||||||
virNetworkFree(test.net);
|
virNetworkFree(test.net);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Storage pool event tests */
|
||||||
|
if (virTestRun("Storage pool createXML start event ",
|
||||||
|
testStoragePoolCreateXML, &test) < 0)
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
if (virTestRun("Storage pool (un)define events",
|
||||||
|
testStoragePoolDefine, &test) < 0)
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
|
||||||
|
/* Define a test storage pool */
|
||||||
|
if (!(test.pool = virStoragePoolDefineXML(test.conn, storagePoolDef, 0)))
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
if (virTestRun("Storage pool start stop events ",
|
||||||
|
testStoragePoolStartStopEvent, &test) < 0)
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
|
||||||
|
/* Cleanup */
|
||||||
|
if (test.pool) {
|
||||||
|
virStoragePoolUndefine(test.pool);
|
||||||
|
virStoragePoolFree(test.pool);
|
||||||
|
}
|
||||||
|
|
||||||
virConnectClose(test.conn);
|
virConnectClose(test.conn);
|
||||||
virEventRemoveTimeout(timer);
|
virEventRemoveTimeout(timer);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user