mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
events: add NULL check in virObjectEventStateQueue
And remove NULL checking from all callers. Signed-off-by: Anya Harter <aharter@redhat.com>
This commit is contained in:
parent
4e3a9daa66
commit
031eb8f6dc
@ -566,7 +566,6 @@ bhyveDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag
|
||||
virDomainDefFree(def);
|
||||
virDomainDefFree(oldDef);
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
|
||||
return dom;
|
||||
@ -616,7 +615,6 @@ bhyveDomainUndefine(virDomainPtr domain)
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
return ret;
|
||||
}
|
||||
@ -896,7 +894,6 @@ bhyveDomainCreateWithFlags(virDomainPtr dom,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
return ret;
|
||||
}
|
||||
@ -969,7 +966,6 @@ bhyveDomainCreateXML(virConnectPtr conn,
|
||||
virObjectUnref(caps);
|
||||
virDomainDefFree(def);
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
|
||||
return dom;
|
||||
@ -1002,7 +998,6 @@ bhyveDomainDestroy(virDomainPtr dom)
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
return ret;
|
||||
}
|
||||
|
@ -776,6 +776,9 @@ void
|
||||
virObjectEventStateQueue(virObjectEventStatePtr state,
|
||||
virObjectEventPtr event)
|
||||
{
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
virObjectEventStateQueueRemote(state, event, -1);
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,6 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
virDomainDefFree(def);
|
||||
virDomainDefFree(oldDef);
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectUnref(caps);
|
||||
virObjectUnref(cfg);
|
||||
@ -553,7 +552,6 @@ static int lxcDomainUndefineFlags(virDomainPtr dom,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
@ -1132,7 +1130,6 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectUnref(cfg);
|
||||
virNWFilterUnlockFilterUpdates();
|
||||
@ -1260,7 +1257,6 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
|
||||
cleanup:
|
||||
virDomainDefFree(def);
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectUnref(caps);
|
||||
virObjectUnref(cfg);
|
||||
@ -1516,7 +1512,6 @@ lxcDomainDestroyFlags(virDomainPtr dom,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
return ret;
|
||||
}
|
||||
@ -1709,7 +1704,6 @@ static void lxcNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
|
||||
virDomainEventLifecycleNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_DEFINED,
|
||||
VIR_DOMAIN_EVENT_DEFINED_ADDED);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
}
|
||||
@ -3100,7 +3094,6 @@ static int lxcDomainSuspend(virDomainPtr dom)
|
||||
virLXCDomainObjEndJob(driver, vm);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virDomainObjEndAPI(&vm);
|
||||
virObjectUnref(cfg);
|
||||
@ -3158,7 +3151,6 @@ static int lxcDomainResume(virDomainPtr dom)
|
||||
virLXCDomainObjEndJob(driver, vm);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virDomainObjEndAPI(&vm);
|
||||
virObjectUnref(cfg);
|
||||
|
@ -82,7 +82,6 @@ lxcProcessAutoDestroy(virDomainObjPtr dom,
|
||||
if (!dom->persistent)
|
||||
virDomainObjListRemove(driver->domains, dom);
|
||||
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
|
||||
@ -692,7 +691,6 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon,
|
||||
* before adding monitorCallbacks. Since we are now done with the @vm
|
||||
* we can Unref/Unlock */
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
|
||||
@ -1607,7 +1605,6 @@ virLXCProcessAutostartDomain(virDomainObjPtr vm,
|
||||
virDomainEventLifecycleNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STARTED,
|
||||
VIR_DOMAIN_EVENT_STARTED_BOOTED);
|
||||
if (event)
|
||||
virObjectEventStateQueue(data->driver->domainEventState, event);
|
||||
}
|
||||
}
|
||||
|
@ -3579,7 +3579,6 @@ networkCreateXML(virConnectPtr conn,
|
||||
|
||||
cleanup:
|
||||
virNetworkDefFree(newDef);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virNetworkObjEndAPI(&obj);
|
||||
return net;
|
||||
@ -3633,7 +3632,6 @@ networkDefineXML(virConnectPtr conn,
|
||||
net = virGetNetwork(conn, def->name, def->uuid);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
if (freeDef)
|
||||
virNetworkDefFree(def);
|
||||
@ -3694,7 +3692,6 @@ networkUndefine(virNetworkPtr net)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virNetworkObjEndAPI(&obj);
|
||||
return ret;
|
||||
@ -3905,7 +3902,6 @@ networkCreate(virNetworkPtr net)
|
||||
0);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virNetworkObjEndAPI(&obj);
|
||||
return ret;
|
||||
@ -3952,7 +3948,6 @@ networkDestroy(virNetworkPtr net)
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virNetworkObjEndAPI(&obj);
|
||||
return ret;
|
||||
|
@ -1297,7 +1297,6 @@ udevRemoveOneDevice(struct udev_device *device)
|
||||
virNodeDeviceObjListRemove(driver->devs, obj);
|
||||
virObjectUnref(obj);
|
||||
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->nodeDeviceEventState, event);
|
||||
return 0;
|
||||
}
|
||||
@ -1410,7 +1409,6 @@ udevAddOneDevice(struct udev_device *device)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->nodeDeviceEventState, event);
|
||||
|
||||
if (ret != 0) {
|
||||
|
@ -259,7 +259,6 @@ qemuDomainDisableNamespace(virDomainObjPtr vm,
|
||||
void qemuDomainEventQueue(virQEMUDriverPtr driver,
|
||||
virObjectEventPtr event)
|
||||
{
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,6 @@ secretDefineXML(virConnectPtr conn,
|
||||
cleanup:
|
||||
virSecretDefFree(def);
|
||||
virSecretObjEndAPI(&obj);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->secretEventState, event);
|
||||
|
||||
return ret;
|
||||
@ -341,7 +340,6 @@ secretSetValue(virSecretPtr secret,
|
||||
|
||||
cleanup:
|
||||
virSecretObjEndAPI(&obj);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->secretEventState, event);
|
||||
|
||||
return ret;
|
||||
@ -420,7 +418,6 @@ secretUndefine(virSecretPtr secret)
|
||||
|
||||
cleanup:
|
||||
virSecretObjEndAPI(&obj);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->secretEventState, event);
|
||||
|
||||
return ret;
|
||||
|
@ -772,7 +772,6 @@ storagePoolCreateXML(virConnectPtr conn,
|
||||
cleanup:
|
||||
VIR_FREE(stateFile);
|
||||
virStoragePoolDefFree(newDef);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return pool;
|
||||
@ -829,7 +828,6 @@ storagePoolDefineXML(virConnectPtr conn,
|
||||
pool = virGetStoragePool(conn, def->name, def->uuid, NULL, NULL);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolDefFree(newDef);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
@ -889,7 +887,6 @@ storagePoolUndefine(virStoragePoolPtr pool)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
@ -971,7 +968,6 @@ storagePoolCreate(virStoragePoolPtr pool,
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(stateFile);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
@ -1016,7 +1012,6 @@ storagePoolBuild(virStoragePoolPtr pool,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
@ -1082,7 +1077,6 @@ storagePoolDestroy(virStoragePoolPtr pool)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
@ -1147,7 +1141,6 @@ storagePoolDelete(virStoragePoolPtr pool,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
@ -1210,7 +1203,6 @@ storagePoolRefresh(virStoragePoolPtr pool,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
@ -2301,7 +2293,6 @@ virStorageVolPoolRefreshThread(void *opaque)
|
||||
event = virStoragePoolEventRefreshNew(def->name, def->uuid);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
virStorageVolPoolRefreshDataFree(cbdata);
|
||||
|
@ -177,9 +177,6 @@ static void testDriverUnlock(testDriverPtr driver)
|
||||
static void testObjectEventQueue(testDriverPtr driver,
|
||||
virObjectEventPtr event)
|
||||
{
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
virObjectEventStateQueue(driver->eventState, event);
|
||||
}
|
||||
|
||||
|
@ -2093,7 +2093,6 @@ prlsdkSendEvent(vzDriverPtr driver,
|
||||
event = virDomainEventLifecycleNewFromObj(dom,
|
||||
lvEventType,
|
||||
lvEventTypeDetails);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user