Every single call to qemuDomainEventQueue() uses the following pattern:
if (event)
qemuDomainEventQueue(driver, event);
Let's move the check for valid event to qemuDomainEventQueue and
simplify all callers.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
Version 2:
- no change
src/qemu/qemu_blockjob.c | 6 ++--
src/qemu/qemu_cgroup.c | 3 +-
src/qemu/qemu_domain.c | 6 ++--
src/qemu/qemu_driver.c | 87 ++++++++++++++++-------------------------------
src/qemu/qemu_hotplug.c | 26 ++++++--------
src/qemu/qemu_migration.c | 24 +++++--------
src/qemu/qemu_process.c | 72 +++++++++++++--------------------------
7 files changed, 78 insertions(+), 146 deletions(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 8849850..1d5b7ce 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -194,10 +194,8 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
"after block job", vm->def->name);
}
- if (event)
- qemuDomainEventQueue(driver, event);
- if (event2)
- qemuDomainEventQueue(driver, event2);
+ qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event2);
virObjectUnref(cfg);
}
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 0da6c02..570dab5 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -706,8 +706,7 @@ qemuSetupCpuCgroup(virQEMUDriverPtr driver,
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
}
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
return 0;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c8b0ccd..0ef09b2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -126,7 +126,8 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
void qemuDomainEventQueue(virQEMUDriverPtr driver,
virObjectEventPtr event)
{
- virObjectEventStateQueue(driver->domainEventState, event);
+ if (event)
+ virObjectEventStateQueue(driver->domainEventState, event);
}
@@ -2732,8 +2733,7 @@ qemuDomainCheckRemoveOptionalDisk(virQEMUDriverPtr driver,
virDomainDiskDefFree(disk);
}
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return 0;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 91eb661..f26564a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -974,8 +974,7 @@ static void qemuNotifyLoadDomain(virDomainObjPtr vm, int newVM, void
*opaque)
virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_DEFINED,
VIR_DOMAIN_EVENT_DEFINED_ADDED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
}
@@ -1789,8 +1788,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
virDomainObjEndAPI(&vm);
if (event) {
qemuDomainEventQueue(driver, event);
- if (event2)
- qemuDomainEventQueue(driver, event2);
+ qemuDomainEventQueue(driver, event2);
}
virObjectUnref(caps);
virObjectUnref(qemuCaps);
@@ -1871,8 +1869,7 @@ static int qemuDomainSuspend(virDomainPtr dom)
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return ret;
}
@@ -1931,8 +1928,7 @@ static int qemuDomainResume(virDomainPtr dom)
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return ret;
}
@@ -2252,8 +2248,7 @@ qemuDomainDestroyFlags(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return ret;
}
@@ -3276,8 +3271,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
cleanup:
VIR_FREE(xml);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(caps);
return ret;
}
@@ -3778,8 +3772,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return ret;
}
@@ -4017,8 +4010,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
VIR_DOMAIN_EVENT_CRASHED,
VIR_DOMAIN_EVENT_CRASHED_PANICKED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
if (virDomainLockProcessPause(driver->lockManager, vm, &priv->lockState)
< 0)
VIR_WARN("Unable to release lease on %s", vm->def->name);
@@ -4051,8 +4043,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_CRASHED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virDomainAuditStop(vm, "destroyed");
@@ -4495,9 +4486,9 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
}
}
- if ((event = virDomainEventAgentLifecycleNewFromObj(vm, newstate,
-
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL)))
- qemuDomainEventQueue(driver, event);
+ event = virDomainEventAgentLifecycleNewFromObj(vm, newstate,
+
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL);
+ qemuDomainEventQueue(driver, event);
}
dev.data.chr->state = newstate;
@@ -5196,8 +5187,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
if (cgroup_vcpu)
virCgroupFree(&cgroup_vcpu);
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
VIR_FREE(str);
virBitmapFree(pcpumap);
virObjectUnref(cfg);
@@ -5398,8 +5388,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
cleanup:
if (cgroup_emulator)
virCgroupFree(&cgroup_emulator);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
VIR_FREE(str);
virBitmapFree(pcpumap);
virDomainObjEndAPI(&vm);
@@ -5899,8 +5888,7 @@ qemuDomainPinIOThread(virDomainPtr dom,
cleanup:
if (cgroup_iothread)
virCgroupFree(&cgroup_iothread);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
VIR_FREE(str);
virBitmapFree(pcpumap);
virDomainObjEndAPI(&vm);
@@ -6708,8 +6696,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_RESTORED);
virDomainAuditStart(vm, "restored", true);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
/* If it was running before, resume it now unless caller requested pause. */
@@ -6732,8 +6719,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
detail);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
ret = 0;
@@ -7401,8 +7387,7 @@ qemuDomainObjStart(virConnectPtr conn,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
}
}
@@ -7551,8 +7536,7 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn,
const char *xml
virDomainDefFree(oldDef);
virDomainDefFree(def);
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(qemuCaps);
virObjectUnref(caps);
virObjectUnref(cfg);
@@ -7669,8 +7653,7 @@ qemuDomainUndefineFlags(virDomainPtr dom,
cleanup:
VIR_FREE(name);
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return ret;
}
@@ -7818,8 +7801,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
* is in monitor */
virObjectEventPtr event;
event = virDomainEventDeviceAddedNewFromObj(vm, alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
if (ret == 0)
@@ -10503,8 +10485,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
if (eventNparams) {
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
eventNparams = 0;
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
@@ -13739,8 +13720,7 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn,
}
}
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return ret;
}
@@ -14561,8 +14541,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
virDomainAuditStop(vm, "from-snapshot");
resume = false;
thaw = 0;
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
} else if (memory && pmsuspended) {
/* qemu 1.3 is unable to save a domain in pm-suspended (S3)
* state; so we must emit an event stating that it was
@@ -14571,8 +14550,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
VIR_DOMAIN_PAUSED_FROM_SNAPSHOT);
event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
ret = 0;
@@ -14585,8 +14563,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
if (virGetLastError() == NULL) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("resuming after snapshot failed"));
@@ -15425,8 +15402,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_STOPPED,
detail);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
goto load;
}
@@ -15564,8 +15540,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
start_flags |= paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
rc = qemuProcessStart(snapshot->domain->conn, driver, vm,
QEMU_ASYNC_JOB_NONE, NULL, -1, NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
@@ -15625,8 +15600,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
}
if (event) {
qemuDomainEventQueue(driver, event);
- if (event2)
- qemuDomainEventQueue(driver, event2);
+ qemuDomainEventQueue(driver, event2);
}
virDomainObjEndAPI(&vm);
virObjectUnref(caps);
@@ -17708,8 +17682,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
if (eventNparams) {
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
eventNparams = 0;
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
}
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 63fafa6..0639481 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1828,8 +1828,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
}
event = virDomainEventDeviceAddedNewFromObj(vm, objalias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
/* fix the balloon size if it was set to maximum */
if (fix_balloon)
@@ -2859,8 +2858,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
virDomainAuditDisk(vm, disk->src, NULL, "detach", true);
event = virDomainEventDeviceRemovedNewFromObj(vm, disk->info.alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
for (i = 0; i < vm->def->ndisks; i++) {
if (vm->def->disks[i] == disk) {
@@ -2902,8 +2900,7 @@ qemuDomainRemoveControllerDevice(virQEMUDriverPtr driver,
controller->info.alias, vm, vm->def->name);
event = virDomainEventDeviceRemovedNewFromObj(vm, controller->info.alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
for (i = 0; i < vm->def->ncontrollers; i++) {
if (vm->def->controllers[i] == controller) {
@@ -2934,8 +2931,8 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver,
VIR_DEBUG("Removing memory device %s from domain %p %s",
mem->info.alias, vm, vm->def->name);
- if ((event = virDomainEventDeviceRemovedNewFromObj(vm, mem->info.alias)))
- qemuDomainEventQueue(driver, event);
+ event = virDomainEventDeviceRemovedNewFromObj(vm, mem->info.alias);
+ qemuDomainEventQueue(driver, event);
if (virAsprintf(&backendAlias, "mem%s", mem->info.alias) < 0)
return -1;
@@ -3017,8 +3014,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
}
event = virDomainEventDeviceRemovedNewFromObj(vm, hostdev->info->alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET) {
net =
hostdev->parent.data.net;
@@ -3132,8 +3128,7 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
virDomainAuditNet(vm, net, NULL, "detach", true);
event = virDomainEventDeviceRemovedNewFromObj(vm, net->info.alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
for (i = 0; i < vm->def->nnets; i++) {
if (vm->def->nets[i] == net) {
@@ -3210,8 +3205,7 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
goto cleanup;
event = virDomainEventDeviceRemovedNewFromObj(vm, chr->info.alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
qemuDomainChrRemove(vm->def, chr);
virDomainChrDefFree(chr);
@@ -3259,8 +3253,8 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
if (rc < 0)
goto cleanup;
- if ((event = virDomainEventDeviceRemovedNewFromObj(vm, rng->info.alias)))
- qemuDomainEventQueue(driver, event);
+ event = virDomainEventDeviceRemovedNewFromObj(vm, rng->info.alias);
+ qemuDomainEventQueue(driver, event);
if ((idx = virDomainRNGFind(vm->def, rng)) >= 0)
virDomainRNGRemove(vm->def, idx);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 35ab521..22c994e 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2303,8 +2303,7 @@ qemuMigrationSetOffline(virQEMUDriverPtr driver,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
return ret;
@@ -3475,8 +3474,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
qemuDomainRemoveInactive(driver, vm);
}
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
qemuMigrationCookieFree(mig);
virObjectUnref(caps);
virNWFilterUnlockFilterUpdates();
@@ -3825,8 +3823,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
rv = 0;
cleanup:
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return rv;
}
@@ -5362,8 +5359,7 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return ret;
}
@@ -5431,8 +5427,7 @@ qemuMigrationPerformPhase(virQEMUDriverPtr driver,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return ret;
}
@@ -5592,8 +5587,7 @@ qemuMigrationPersist(virQEMUDriverPtr driver,
newVM ?
VIR_DOMAIN_EVENT_DEFINED_ADDED :
VIR_DOMAIN_EVENT_DEFINED_UPDATED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
ret = 0;
@@ -5751,8 +5745,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
VIR_DOMAIN_PAUSED_USER);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
@@ -5802,8 +5795,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
qemuMonitorSetDomainLog(priv->mon, -1);
VIR_FREE(priv->origname);
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
qemuMigrationCookieFree(mig);
if (orig_err) {
virSetError(orig_err);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d9a0942..b16f234 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -328,8 +328,7 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
cleanup:
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
@@ -353,8 +352,7 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
((qemuDomainObjPrivatePtr) vm->privateData)->monError = true;
event = virDomainEventControlErrorNewFromObj(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnlock(vm);
}
@@ -517,8 +515,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
@@ -594,8 +591,7 @@ qemuProcessFakeReboot(void *opaque)
if (ret == -1)
ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE));
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
}
@@ -644,8 +640,7 @@ qemuProcessHandleEvent(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
seconds, micros, details);
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return 0;
}
@@ -698,8 +693,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
unlock:
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
@@ -748,8 +742,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
unlock:
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
@@ -802,8 +795,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
unlock:
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
}
@@ -847,8 +839,7 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
}
@@ -909,10 +900,8 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
if (vm)
virObjectUnlock(vm);
- if (watchdogEvent)
- qemuDomainEventQueue(driver, watchdogEvent);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, watchdogEvent);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
@@ -973,12 +962,9 @@ qemuProcessHandleIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
virObjectUnlock(vm);
- if (ioErrorEvent)
- qemuDomainEventQueue(driver, ioErrorEvent);
- if (ioErrorEvent2)
- qemuDomainEventQueue(driver, ioErrorEvent2);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, ioErrorEvent);
+ qemuDomainEventQueue(driver, ioErrorEvent2);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
}
@@ -1101,8 +1087,7 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
event = virDomainEventGraphicsNewFromObj(vm, phase, localAddr, remoteAddr,
authScheme, subject);
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return 0;
@@ -1163,8 +1148,7 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
}
@@ -1202,10 +1186,8 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
}
@@ -1246,10 +1228,8 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
}
@@ -1276,8 +1256,7 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
}
@@ -1318,10 +1297,8 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon
ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
@@ -5777,8 +5754,7 @@ qemuProcessAutoDestroy(virDomainObjPtr dom,
if (!dom->persistent)
qemuDomainRemoveInactive(driver, dom);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
cleanup:
virDomainObjEndAPI(&dom);
--
2.5.1