提交 0e145a4f 编写于 作者: A Anya Harter 提交者: Ján Tomko

events: remove testObjectEventQueue wrapper func

And replace all calls with virObjectEventStateQueue such that:

    testObjectEventQueue(privconn, event);

becomes:

    virObjectEventStateQueue(privconn->eventState, event);
Signed-off-by: NAnya Harter <aharter@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 9f1b1194
...@@ -174,12 +174,6 @@ static void testDriverUnlock(testDriverPtr driver) ...@@ -174,12 +174,6 @@ static void testDriverUnlock(testDriverPtr driver)
virMutexUnlock(&driver->lock); virMutexUnlock(&driver->lock);
} }
static void testObjectEventQueue(testDriverPtr driver,
virObjectEventPtr event)
{
virObjectEventStateQueue(driver->eventState, event);
}
#define TEST_NAMESPACE_HREF "http://libvirt.org/schemas/domain/test/1.0" #define TEST_NAMESPACE_HREF "http://libvirt.org/schemas/domain/test/1.0"
typedef struct _testDomainNamespaceDef testDomainNamespaceDef; typedef struct _testDomainNamespaceDef testDomainNamespaceDef;
...@@ -1692,7 +1686,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml, ...@@ -1692,7 +1686,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
cleanup: cleanup:
virDomainObjEndAPI(&dom); virDomainObjEndAPI(&dom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virDomainDefFree(def); virDomainDefFree(def);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return ret; return ret;
...@@ -1791,7 +1785,7 @@ static int testDomainDestroyFlags(virDomainPtr domain, ...@@ -1791,7 +1785,7 @@ static int testDomainDestroyFlags(virDomainPtr domain,
ret = 0; ret = 0;
cleanup: cleanup:
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -1825,7 +1819,7 @@ static int testDomainResume(virDomainPtr domain) ...@@ -1825,7 +1819,7 @@ static int testDomainResume(virDomainPtr domain)
cleanup: cleanup:
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -1855,7 +1849,7 @@ static int testDomainSuspend(virDomainPtr domain) ...@@ -1855,7 +1849,7 @@ static int testDomainSuspend(virDomainPtr domain)
cleanup: cleanup:
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -1890,7 +1884,7 @@ static int testDomainShutdownFlags(virDomainPtr domain, ...@@ -1890,7 +1884,7 @@ static int testDomainShutdownFlags(virDomainPtr domain,
ret = 0; ret = 0;
cleanup: cleanup:
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -1958,7 +1952,7 @@ static int testDomainReboot(virDomainPtr domain, ...@@ -1958,7 +1952,7 @@ static int testDomainReboot(virDomainPtr domain,
ret = 0; ret = 0;
cleanup: cleanup:
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -2102,7 +2096,7 @@ testDomainSaveFlags(virDomainPtr domain, const char *path, ...@@ -2102,7 +2096,7 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
unlink(path); unlink(path);
} }
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -2205,7 +2199,7 @@ testDomainRestoreFlags(virConnectPtr conn, ...@@ -2205,7 +2199,7 @@ testDomainRestoreFlags(virConnectPtr conn,
VIR_FREE(xml); VIR_FREE(xml);
VIR_FORCE_CLOSE(fd); VIR_FORCE_CLOSE(fd);
virDomainObjEndAPI(&dom); virDomainObjEndAPI(&dom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -2275,7 +2269,7 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain, ...@@ -2275,7 +2269,7 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain,
cleanup: cleanup:
VIR_FORCE_CLOSE(fd); VIR_FORCE_CLOSE(fd);
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -2649,8 +2643,8 @@ testDomainRenameCallback(virDomainObjPtr privdom, ...@@ -2649,8 +2643,8 @@ testDomainRenameCallback(virDomainObjPtr privdom,
cleanup: cleanup:
VIR_FREE(old_dom_name); VIR_FREE(old_dom_name);
VIR_FREE(new_dom_name); VIR_FREE(new_dom_name);
testObjectEventQueue(driver, event_old); virObjectEventStateQueue(driver->eventState, event_old);
testObjectEventQueue(driver, event_new); virObjectEventStateQueue(driver->eventState, event_new);
return ret; return ret;
} }
...@@ -2786,7 +2780,7 @@ static virDomainPtr testDomainDefineXMLFlags(virConnectPtr conn, ...@@ -2786,7 +2780,7 @@ static virDomainPtr testDomainDefineXMLFlags(virConnectPtr conn,
virDomainDefFree(def); virDomainDefFree(def);
virDomainDefFree(oldDef); virDomainDefFree(oldDef);
virDomainObjEndAPI(&dom); virDomainObjEndAPI(&dom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -2840,7 +2834,7 @@ static int testDomainSetMetadata(virDomainPtr dom, ...@@ -2840,7 +2834,7 @@ static int testDomainSetMetadata(virDomainPtr dom,
if (ret == 0) { if (ret == 0) {
virObjectEventPtr ev = NULL; virObjectEventPtr ev = NULL;
ev = virDomainEventMetadataChangeNewFromObj(privdom, type, uri); ev = virDomainEventMetadataChangeNewFromObj(privdom, type, uri);
testObjectEventQueue(privconn, ev); virObjectEventStateQueue(privconn->eventState, ev);
} }
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
...@@ -2995,7 +2989,7 @@ static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) ...@@ -2995,7 +2989,7 @@ static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
cleanup: cleanup:
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return ret; return ret;
} }
...@@ -3061,7 +3055,7 @@ static int testDomainUndefineFlags(virDomainPtr domain, ...@@ -3061,7 +3055,7 @@ static int testDomainUndefineFlags(virDomainPtr domain,
cleanup: cleanup:
virDomainObjEndAPI(&privdom); virDomainObjEndAPI(&privdom);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -3486,7 +3480,7 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml) ...@@ -3486,7 +3480,7 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml)
cleanup: cleanup:
virNetworkDefFree(newDef); virNetworkDefFree(newDef);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virNetworkObjEndAPI(&obj); virNetworkObjEndAPI(&obj);
return net; return net;
} }
...@@ -3519,7 +3513,7 @@ testNetworkDefineXML(virConnectPtr conn, ...@@ -3519,7 +3513,7 @@ testNetworkDefineXML(virConnectPtr conn,
cleanup: cleanup:
virNetworkDefFree(newDef); virNetworkDefFree(newDef);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virNetworkObjEndAPI(&obj); virNetworkObjEndAPI(&obj);
return net; return net;
} }
...@@ -3550,7 +3544,7 @@ testNetworkUndefine(virNetworkPtr net) ...@@ -3550,7 +3544,7 @@ testNetworkUndefine(virNetworkPtr net)
ret = 0; ret = 0;
cleanup: cleanup:
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virNetworkObjEndAPI(&obj); virNetworkObjEndAPI(&obj);
return ret; return ret;
} }
...@@ -3625,7 +3619,7 @@ testNetworkCreate(virNetworkPtr net) ...@@ -3625,7 +3619,7 @@ testNetworkCreate(virNetworkPtr net)
ret = 0; ret = 0;
cleanup: cleanup:
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virNetworkObjEndAPI(&obj); virNetworkObjEndAPI(&obj);
return ret; return ret;
} }
...@@ -3654,7 +3648,7 @@ testNetworkDestroy(virNetworkPtr net) ...@@ -3654,7 +3648,7 @@ testNetworkDestroy(virNetworkPtr net)
ret = 0; ret = 0;
cleanup: cleanup:
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virNetworkObjEndAPI(&obj); virNetworkObjEndAPI(&obj);
return ret; return ret;
} }
...@@ -4408,7 +4402,7 @@ testStoragePoolCreate(virStoragePoolPtr pool, ...@@ -4408,7 +4402,7 @@ testStoragePoolCreate(virStoragePoolPtr pool,
VIR_STORAGE_POOL_EVENT_STARTED, VIR_STORAGE_POOL_EVENT_STARTED,
0); 0);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virStoragePoolObjEndAPI(&obj); virStoragePoolObjEndAPI(&obj);
return 0; return 0;
} }
...@@ -4558,7 +4552,7 @@ testStoragePoolCreateXML(virConnectPtr conn, ...@@ -4558,7 +4552,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
cleanup: cleanup:
virStoragePoolDefFree(newDef); virStoragePoolDefFree(newDef);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virStoragePoolObjEndAPI(&obj); virStoragePoolObjEndAPI(&obj);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return pool; return pool;
...@@ -4610,7 +4604,7 @@ testStoragePoolDefineXML(virConnectPtr conn, ...@@ -4610,7 +4604,7 @@ testStoragePoolDefineXML(virConnectPtr conn,
cleanup: cleanup:
virStoragePoolDefFree(newDef); virStoragePoolDefFree(newDef);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virStoragePoolObjEndAPI(&obj); virStoragePoolObjEndAPI(&obj);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return pool; return pool;
...@@ -4634,7 +4628,7 @@ testStoragePoolUndefine(virStoragePoolPtr pool) ...@@ -4634,7 +4628,7 @@ testStoragePoolUndefine(virStoragePoolPtr pool)
virStoragePoolObjRemove(privconn->pools, obj); virStoragePoolObjRemove(privconn->pools, obj);
virObjectUnref(obj); virObjectUnref(obj);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return 0; return 0;
} }
...@@ -4658,7 +4652,7 @@ testStoragePoolBuild(virStoragePoolPtr pool, ...@@ -4658,7 +4652,7 @@ testStoragePoolBuild(virStoragePoolPtr pool,
virStoragePoolObjEndAPI(&obj); virStoragePoolObjEndAPI(&obj);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return 0; return 0;
} }
...@@ -4692,7 +4686,7 @@ testDestroyVport(testDriverPtr privconn, ...@@ -4692,7 +4686,7 @@ testDestroyVport(testDriverPtr privconn,
virNodeDeviceObjListRemove(privconn->devs, obj); virNodeDeviceObjListRemove(privconn->devs, obj);
virObjectUnref(obj); virObjectUnref(obj);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return 0; return 0;
} }
...@@ -4732,7 +4726,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool) ...@@ -4732,7 +4726,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool)
ret = 0; ret = 0;
cleanup: cleanup:
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virStoragePoolObjEndAPI(&obj); virStoragePoolObjEndAPI(&obj);
return ret; return ret;
} }
...@@ -4755,7 +4749,7 @@ testStoragePoolDelete(virStoragePoolPtr pool, ...@@ -4755,7 +4749,7 @@ testStoragePoolDelete(virStoragePoolPtr pool,
VIR_STORAGE_POOL_EVENT_DELETED, VIR_STORAGE_POOL_EVENT_DELETED,
0); 0);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virStoragePoolObjEndAPI(&obj); virStoragePoolObjEndAPI(&obj);
return 0; return 0;
...@@ -4777,7 +4771,7 @@ testStoragePoolRefresh(virStoragePoolPtr pool, ...@@ -4777,7 +4771,7 @@ testStoragePoolRefresh(virStoragePoolPtr pool,
event = virStoragePoolEventRefreshNew(pool->name, pool->uuid); event = virStoragePoolEventRefreshNew(pool->name, pool->uuid);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virStoragePoolObjEndAPI(&obj); virStoragePoolObjEndAPI(&obj);
return 0; return 0;
} }
...@@ -5561,7 +5555,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver, ...@@ -5561,7 +5555,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver,
event = virNodeDeviceEventLifecycleNew(objdef->name, event = virNodeDeviceEventLifecycleNew(objdef->name,
VIR_NODE_DEVICE_EVENT_CREATED, VIR_NODE_DEVICE_EVENT_CREATED,
0); 0);
testObjectEventQueue(driver, event); virObjectEventStateQueue(driver->eventState, event);
cleanup: cleanup:
VIR_FREE(xml); VIR_FREE(xml);
...@@ -5673,7 +5667,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev) ...@@ -5673,7 +5667,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
cleanup: cleanup:
virNodeDeviceObjEndAPI(&obj); virNodeDeviceObjEndAPI(&obj);
testObjectEventQueue(driver, event); virObjectEventStateQueue(driver->eventState, event);
VIR_FREE(wwnn); VIR_FREE(wwnn);
VIR_FREE(wwpn); VIR_FREE(wwpn);
return ret; return ret;
...@@ -5950,7 +5944,7 @@ testDomainManagedSave(virDomainPtr dom, unsigned int flags) ...@@ -5950,7 +5944,7 @@ testDomainManagedSave(virDomainPtr dom, unsigned int flags)
ret = 0; ret = 0;
cleanup: cleanup:
virDomainObjEndAPI(&vm); virDomainObjEndAPI(&vm);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
return ret; return ret;
} }
...@@ -6467,7 +6461,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain, ...@@ -6467,7 +6461,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
} }
virDomainObjEndAPI(&vm); virDomainObjEndAPI(&vm);
} }
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
virDomainSnapshotDefFree(def); virDomainSnapshotDefFree(def);
return snapshot; return snapshot;
} }
...@@ -6708,7 +6702,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, ...@@ -6708,7 +6702,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT); VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT);
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
goto load; goto load;
} }
...@@ -6787,7 +6781,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, ...@@ -6787,7 +6781,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
/* Flush first event, now do transition 2 or 3 */ /* Flush first event, now do transition 2 or 3 */
bool paused = (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != 0; bool paused = (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != 0;
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT); VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT);
...@@ -6803,8 +6797,8 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, ...@@ -6803,8 +6797,8 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
ret = 0; ret = 0;
cleanup: cleanup:
if (event) { if (event) {
testObjectEventQueue(privconn, event); virObjectEventStateQueue(privconn->eventState, event);
testObjectEventQueue(privconn, event2); virObjectEventStateQueue(privconn->eventState, event2);
} else { } else {
virObjectUnref(event2); virObjectUnref(event2);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册