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,8 +566,7 @@ bhyveDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag
|
||||
virDomainDefFree(def);
|
||||
virDomainDefFree(oldDef);
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
|
||||
return dom;
|
||||
}
|
||||
@ -616,8 +615,7 @@ bhyveDomainUndefine(virDomainPtr domain)
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -896,8 +894,7 @@ bhyveDomainCreateWithFlags(virDomainPtr dom,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -969,8 +966,7 @@ bhyveDomainCreateXML(virConnectPtr conn,
|
||||
virObjectUnref(caps);
|
||||
virDomainDefFree(def);
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
virObjectEventStateQueue(privconn->domainEventState, event);
|
||||
|
||||
return dom;
|
||||
}
|
||||
@ -1002,8 +998,7 @@ bhyveDomainDestroy(virDomainPtr dom)
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(privconn->domainEventState, 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,8 +499,7 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
virDomainDefFree(def);
|
||||
virDomainDefFree(oldDef);
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectUnref(caps);
|
||||
virObjectUnref(cfg);
|
||||
return dom;
|
||||
@ -553,8 +552,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
}
|
||||
@ -1132,8 +1130,7 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectUnref(cfg);
|
||||
virNWFilterUnlockFilterUpdates();
|
||||
return ret;
|
||||
@ -1260,8 +1257,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
|
||||
cleanup:
|
||||
virDomainDefFree(def);
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectUnref(caps);
|
||||
virObjectUnref(cfg);
|
||||
virNWFilterUnlockFilterUpdates();
|
||||
@ -1516,8 +1512,7 @@ lxcDomainDestroyFlags(virDomainPtr dom,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1709,8 +1704,7 @@ 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);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3100,8 +3094,7 @@ static int lxcDomainSuspend(virDomainPtr dom)
|
||||
virLXCDomainObjEndJob(driver, vm);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virDomainObjEndAPI(&vm);
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
@ -3158,8 +3151,7 @@ static int lxcDomainResume(virDomainPtr dom)
|
||||
virLXCDomainObjEndJob(driver, vm);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virDomainObjEndAPI(&vm);
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
|
@ -82,8 +82,7 @@ lxcProcessAutoDestroy(virDomainObjPtr dom,
|
||||
if (!dom->persistent)
|
||||
virDomainObjListRemove(driver->domains, dom);
|
||||
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -692,8 +691,7 @@ 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);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
|
||||
static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
@ -1607,8 +1605,7 @@ virLXCProcessAutostartDomain(virDomainObjPtr vm,
|
||||
virDomainEventLifecycleNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STARTED,
|
||||
VIR_DOMAIN_EVENT_STARTED_BOOTED);
|
||||
if (event)
|
||||
virObjectEventStateQueue(data->driver->domainEventState, event);
|
||||
virObjectEventStateQueue(data->driver->domainEventState, event);
|
||||
}
|
||||
}
|
||||
virObjectUnlock(vm);
|
||||
|
@ -3579,8 +3579,7 @@ networkCreateXML(virConnectPtr conn,
|
||||
|
||||
cleanup:
|
||||
virNetworkDefFree(newDef);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virNetworkObjEndAPI(&obj);
|
||||
return net;
|
||||
}
|
||||
@ -3633,8 +3632,7 @@ networkDefineXML(virConnectPtr conn,
|
||||
net = virGetNetwork(conn, def->name, def->uuid);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
if (freeDef)
|
||||
virNetworkDefFree(def);
|
||||
virNetworkObjEndAPI(&obj);
|
||||
@ -3694,8 +3692,7 @@ networkUndefine(virNetworkPtr net)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virNetworkObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
@ -3905,8 +3902,7 @@ networkCreate(virNetworkPtr net)
|
||||
0);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virNetworkObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
@ -3952,8 +3948,7 @@ networkDestroy(virNetworkPtr net)
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virObjectEventStateQueue(driver->networkEventState, event);
|
||||
virNetworkObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1297,8 +1297,7 @@ udevRemoveOneDevice(struct udev_device *device)
|
||||
virNodeDeviceObjListRemove(driver->devs, obj);
|
||||
virObjectUnref(obj);
|
||||
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->nodeDeviceEventState, event);
|
||||
virObjectEventStateQueue(driver->nodeDeviceEventState, event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1410,8 +1409,7 @@ udevAddOneDevice(struct udev_device *device)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->nodeDeviceEventState, event);
|
||||
virObjectEventStateQueue(driver->nodeDeviceEventState, event);
|
||||
|
||||
if (ret != 0) {
|
||||
VIR_DEBUG("Discarding device %d %p %s", ret, def,
|
||||
|
@ -259,8 +259,7 @@ qemuDomainDisableNamespace(virDomainObjPtr vm,
|
||||
void qemuDomainEventQueue(virQEMUDriverPtr driver,
|
||||
virObjectEventPtr event)
|
||||
{
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
|
||||
|
||||
|
@ -278,8 +278,7 @@ secretDefineXML(virConnectPtr conn,
|
||||
cleanup:
|
||||
virSecretDefFree(def);
|
||||
virSecretObjEndAPI(&obj);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->secretEventState, event);
|
||||
virObjectEventStateQueue(driver->secretEventState, event);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -341,8 +340,7 @@ secretSetValue(virSecretPtr secret,
|
||||
|
||||
cleanup:
|
||||
virSecretObjEndAPI(&obj);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->secretEventState, event);
|
||||
virObjectEventStateQueue(driver->secretEventState, event);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -420,8 +418,7 @@ secretUndefine(virSecretPtr secret)
|
||||
|
||||
cleanup:
|
||||
virSecretObjEndAPI(&obj);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->secretEventState, event);
|
||||
virObjectEventStateQueue(driver->secretEventState, event);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -772,8 +772,7 @@ storagePoolCreateXML(virConnectPtr conn,
|
||||
cleanup:
|
||||
VIR_FREE(stateFile);
|
||||
virStoragePoolDefFree(newDef);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return pool;
|
||||
}
|
||||
@ -829,8 +828,7 @@ storagePoolDefineXML(virConnectPtr conn,
|
||||
pool = virGetStoragePool(conn, def->name, def->uuid, NULL, NULL);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolDefFree(newDef);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return pool;
|
||||
@ -889,8 +887,7 @@ storagePoolUndefine(virStoragePoolPtr pool)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
@ -971,8 +968,7 @@ storagePoolCreate(virStoragePoolPtr pool,
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(stateFile);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
@ -1016,8 +1012,7 @@ storagePoolBuild(virStoragePoolPtr pool,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
@ -1082,8 +1077,7 @@ storagePoolDestroy(virStoragePoolPtr pool)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
@ -1147,8 +1141,7 @@ storagePoolDelete(virStoragePoolPtr pool,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
@ -1210,8 +1203,7 @@ storagePoolRefresh(virStoragePoolPtr pool,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
virStoragePoolObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
@ -2301,8 +2293,7 @@ virStorageVolPoolRefreshThread(void *opaque)
|
||||
event = virStoragePoolEventRefreshNew(def->name, def->uuid);
|
||||
|
||||
cleanup:
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->storageEventState, 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,8 +2093,7 @@ prlsdkSendEvent(vzDriverPtr driver,
|
||||
event = virDomainEventLifecycleNewFromObj(dom,
|
||||
lvEventType,
|
||||
lvEventTypeDetails);
|
||||
if (event)
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user