Changeset
src/libxl/libxl_domain.c    | 24 +++-------
src/libxl/libxl_domain.h    |  4 --
src/libxl/libxl_driver.c    | 21 +++------
src/libxl/libxl_migration.c | 18 +++-----
src/qemu/qemu_blockjob.c    |  4 +-
src/qemu/qemu_cgroup.c      |  2 +-
src/qemu/qemu_domain.c      | 11 +----
src/qemu/qemu_domain.h      |  2 -
src/qemu/qemu_driver.c      | 88 +++++++++++++++++--------------------
src/qemu/qemu_hotplug.c     | 26 +++++------
src/qemu/qemu_migration.c   | 24 +++++-----
src/qemu/qemu_process.c     | 54 +++++++++++------------
src/test/test_driver.c      | 80 ++++++++++++++++-----------------
src/uml/uml_driver.c        | 33 ++++----------
14 files changed, 162 insertions(+), 229 deletions(-)
Git apply log
Switched to a new branch 'cover.1528824678.git.aharter@redhat.com'
Applying: events: remove testObjectEventQueue wrapper func
Using index info to reconstruct a base tree...
M	src/test/test_driver.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: events: remove libxlDomainEventQueue wrapper func
Using index info to reconstruct a base tree...
M	src/libxl/libxl_domain.c
M	src/libxl/libxl_domain.h
M	src/libxl/libxl_driver.c
M	src/libxl/libxl_migration.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: events: remove qemuDomainEventQueue wrapper func
Using index info to reconstruct a base tree...
M	src/qemu/qemu_blockjob.c
M	src/qemu/qemu_cgroup.c
M	src/qemu/qemu_domain.c
M	src/qemu/qemu_domain.h
M	src/qemu/qemu_driver.c
M	src/qemu/qemu_hotplug.c
M	src/qemu/qemu_migration.c
M	src/qemu/qemu_process.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: events: remove umlDomainEventQueue wrapper func
Using index info to reconstruct a base tree...
M	src/uml/uml_driver.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
To https://github.com/patchew-project/libvirt
 + 4446847...a53017e patchew/cover.1528824678.git.aharter@redhat.com -> patchew/cover.1528824678.git.aharter@redhat.com (forced update)
Test passed: syntax-check

loading

[libvirt] [PATCH libvirt 0/4] rmv virObjectEventStateQueue wrapper funcs
Posted by Anya Harter, 1 week ago
Currently, there are four wrapper functions which call
virObjectEventStateQueue:
    - testObjectEventQueue
    - libxlDomainEventQueue
    - qemuDomainEventQueue
    - umlDomainEventQueue

This patch series removes these wrappers makes all calls directly to
virObjectEventStateQueue.

Since virObjectEventStateQueue takes care of NULL checking, all NULL
checking by callers has also been removed.

This patch series should complete the BiteSizedTask entry at 
https://wiki.libvirt.org/page/BiteSizedTasks#Remove_NULL_checking_around_EventStateQueue . 

Anya Harter (4):
  events: remove testObjectEventQueue wrapper func
  events: remove libxlDomainEventQueue wrapper func
  events: remove qemuDomainEventQueue wrapper func
  events: remove umlDomainEventQueue wrapper func

 src/libxl/libxl_domain.c    | 24 +++-------
 src/libxl/libxl_domain.h    |  4 --
 src/libxl/libxl_driver.c    | 21 +++------
 src/libxl/libxl_migration.c | 18 +++-----
 src/qemu/qemu_blockjob.c    |  4 +-
 src/qemu/qemu_cgroup.c      |  2 +-
 src/qemu/qemu_domain.c      | 11 +----
 src/qemu/qemu_domain.h      |  2 -
 src/qemu/qemu_driver.c      | 88 +++++++++++++++++--------------------
 src/qemu/qemu_hotplug.c     | 26 +++++------
 src/qemu/qemu_migration.c   | 24 +++++-----
 src/qemu/qemu_process.c     | 54 +++++++++++------------
 src/test/test_driver.c      | 80 ++++++++++++++++-----------------
 src/uml/uml_driver.c        | 33 ++++----------
 14 files changed, 162 insertions(+), 229 deletions(-)

-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH libvirt 0/4] rmv virObjectEventStateQueue wrapper funcs
Posted by Ján Tomko, 1 week ago
On Tue, Jun 12, 2018 at 01:32:59PM -0400, Anya Harter wrote:
>Currently, there are four wrapper functions which call
>virObjectEventStateQueue:
>    - testObjectEventQueue
>    - libxlDomainEventQueue
>    - qemuDomainEventQueue
>    - umlDomainEventQueue
>
>This patch series removes these wrappers makes all calls directly to
>virObjectEventStateQueue.
>
>Since virObjectEventStateQueue takes care of NULL checking, all NULL
>checking by callers has also been removed.
>
>This patch series should complete the BiteSizedTask entry at
>https://wiki.libvirt.org/page/BiteSizedTasks#Remove_NULL_checking_around_EventStateQueue .
>
>Anya Harter (4):
>  events: remove testObjectEventQueue wrapper func
>  events: remove libxlDomainEventQueue wrapper func
>  events: remove qemuDomainEventQueue wrapper func
>  events: remove umlDomainEventQueue wrapper func
>

Series:
Reviewed-by: J�n Tomko <jtomko@redhat.com>

and pushed

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH libvirt 1/4] events: remove testObjectEventQueue wrapper func
Posted by Anya Harter, 1 week ago
And replace all calls with virObjectEventStateQueue such that:

    testObjectEventQueue(privconn, event);

becomes:

    virObjectEventStateQueue(privconn->eventState, event);

Signed-off-by: Anya Harter <aharter@redhat.com>
---
 src/test/test_driver.c | 80 +++++++++++++++++++-----------------------
 1 file changed, 37 insertions(+), 43 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index eb4e5aa341..5494d51017 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -174,12 +174,6 @@ static void testDriverUnlock(testDriverPtr driver)
     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"
 
 typedef struct _testDomainNamespaceDef testDomainNamespaceDef;
@@ -1692,7 +1686,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
 
  cleanup:
     virDomainObjEndAPI(&dom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virDomainDefFree(def);
     testDriverUnlock(privconn);
     return ret;
@@ -1791,7 +1785,7 @@ static int testDomainDestroyFlags(virDomainPtr domain,
     ret = 0;
  cleanup:
     virDomainObjEndAPI(&privdom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -1825,7 +1819,7 @@ static int testDomainResume(virDomainPtr domain)
 
  cleanup:
     virDomainObjEndAPI(&privdom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -1855,7 +1849,7 @@ static int testDomainSuspend(virDomainPtr domain)
 
  cleanup:
     virDomainObjEndAPI(&privdom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -1890,7 +1884,7 @@ static int testDomainShutdownFlags(virDomainPtr domain,
     ret = 0;
  cleanup:
     virDomainObjEndAPI(&privdom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -1958,7 +1952,7 @@ static int testDomainReboot(virDomainPtr domain,
     ret = 0;
  cleanup:
     virDomainObjEndAPI(&privdom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -2102,7 +2096,7 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
         unlink(path);
     }
     virDomainObjEndAPI(&privdom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -2205,7 +2199,7 @@ testDomainRestoreFlags(virConnectPtr conn,
     VIR_FREE(xml);
     VIR_FORCE_CLOSE(fd);
     virDomainObjEndAPI(&dom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -2275,7 +2269,7 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain,
  cleanup:
     VIR_FORCE_CLOSE(fd);
     virDomainObjEndAPI(&privdom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -2649,8 +2643,8 @@ testDomainRenameCallback(virDomainObjPtr privdom,
  cleanup:
     VIR_FREE(old_dom_name);
     VIR_FREE(new_dom_name);
-    testObjectEventQueue(driver, event_old);
-    testObjectEventQueue(driver, event_new);
+    virObjectEventStateQueue(driver->eventState, event_old);
+    virObjectEventStateQueue(driver->eventState, event_new);
     return ret;
 }
 
@@ -2786,7 +2780,7 @@ static virDomainPtr testDomainDefineXMLFlags(virConnectPtr conn,
     virDomainDefFree(def);
     virDomainDefFree(oldDef);
     virDomainObjEndAPI(&dom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -2840,7 +2834,7 @@ static int testDomainSetMetadata(virDomainPtr dom,
     if (ret == 0) {
         virObjectEventPtr ev = NULL;
         ev = virDomainEventMetadataChangeNewFromObj(privdom, type, uri);
-        testObjectEventQueue(privconn, ev);
+        virObjectEventStateQueue(privconn->eventState, ev);
     }
 
     virDomainObjEndAPI(&privdom);
@@ -2995,7 +2989,7 @@ static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
 
  cleanup:
     virDomainObjEndAPI(&privdom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     testDriverUnlock(privconn);
     return ret;
 }
@@ -3061,7 +3055,7 @@ static int testDomainUndefineFlags(virDomainPtr domain,
 
  cleanup:
     virDomainObjEndAPI(&privdom);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return ret;
 }
 
@@ -3486,7 +3480,7 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml)
 
  cleanup:
     virNetworkDefFree(newDef);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virNetworkObjEndAPI(&obj);
     return net;
 }
@@ -3519,7 +3513,7 @@ testNetworkDefineXML(virConnectPtr conn,
 
  cleanup:
     virNetworkDefFree(newDef);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virNetworkObjEndAPI(&obj);
     return net;
 }
@@ -3550,7 +3544,7 @@ testNetworkUndefine(virNetworkPtr net)
     ret = 0;
 
  cleanup:
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virNetworkObjEndAPI(&obj);
     return ret;
 }
@@ -3625,7 +3619,7 @@ testNetworkCreate(virNetworkPtr net)
     ret = 0;
 
  cleanup:
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virNetworkObjEndAPI(&obj);
     return ret;
 }
@@ -3654,7 +3648,7 @@ testNetworkDestroy(virNetworkPtr net)
     ret = 0;
 
  cleanup:
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virNetworkObjEndAPI(&obj);
     return ret;
 }
@@ -4408,7 +4402,7 @@ testStoragePoolCreate(virStoragePoolPtr pool,
                                             VIR_STORAGE_POOL_EVENT_STARTED,
                                             0);
 
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virStoragePoolObjEndAPI(&obj);
     return 0;
 }
@@ -4558,7 +4552,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
 
  cleanup:
     virStoragePoolDefFree(newDef);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virStoragePoolObjEndAPI(&obj);
     testDriverUnlock(privconn);
     return pool;
@@ -4610,7 +4604,7 @@ testStoragePoolDefineXML(virConnectPtr conn,
 
  cleanup:
     virStoragePoolDefFree(newDef);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virStoragePoolObjEndAPI(&obj);
     testDriverUnlock(privconn);
     return pool;
@@ -4634,7 +4628,7 @@ testStoragePoolUndefine(virStoragePoolPtr pool)
     virStoragePoolObjRemove(privconn->pools, obj);
     virObjectUnref(obj);
 
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return 0;
 }
 
@@ -4658,7 +4652,7 @@ testStoragePoolBuild(virStoragePoolPtr pool,
 
     virStoragePoolObjEndAPI(&obj);
 
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return 0;
 }
 
@@ -4692,7 +4686,7 @@ testDestroyVport(testDriverPtr privconn,
     virNodeDeviceObjListRemove(privconn->devs, obj);
     virObjectUnref(obj);
 
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     return 0;
 }
 
@@ -4732,7 +4726,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool)
     ret = 0;
 
  cleanup:
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virStoragePoolObjEndAPI(&obj);
     return ret;
 }
@@ -4755,7 +4749,7 @@ testStoragePoolDelete(virStoragePoolPtr pool,
                                             VIR_STORAGE_POOL_EVENT_DELETED,
                                             0);
 
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
 
     virStoragePoolObjEndAPI(&obj);
     return 0;
@@ -4777,7 +4771,7 @@ testStoragePoolRefresh(virStoragePoolPtr pool,
 
     event = virStoragePoolEventRefreshNew(pool->name, pool->uuid);
 
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virStoragePoolObjEndAPI(&obj);
     return 0;
 }
@@ -5561,7 +5555,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver,
     event = virNodeDeviceEventLifecycleNew(objdef->name,
                                            VIR_NODE_DEVICE_EVENT_CREATED,
                                            0);
-    testObjectEventQueue(driver, event);
+    virObjectEventStateQueue(driver->eventState, event);
 
  cleanup:
     VIR_FREE(xml);
@@ -5673,7 +5667,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
 
  cleanup:
     virNodeDeviceObjEndAPI(&obj);
-    testObjectEventQueue(driver, event);
+    virObjectEventStateQueue(driver->eventState, event);
     VIR_FREE(wwnn);
     VIR_FREE(wwpn);
     return ret;
@@ -5950,7 +5944,7 @@ testDomainManagedSave(virDomainPtr dom, unsigned int flags)
     ret = 0;
  cleanup:
     virDomainObjEndAPI(&vm);
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
 
     return ret;
 }
@@ -6467,7 +6461,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
         }
         virDomainObjEndAPI(&vm);
     }
-    testObjectEventQueue(privconn, event);
+    virObjectEventStateQueue(privconn->eventState, event);
     virDomainSnapshotDefFree(def);
     return snapshot;
 }
@@ -6708,7 +6702,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
                 event = virDomainEventLifecycleNewFromObj(vm,
                             VIR_DOMAIN_EVENT_STOPPED,
                             VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT);
-                testObjectEventQueue(privconn, event);
+                virObjectEventStateQueue(privconn->eventState, event);
                 goto load;
             }
 
@@ -6787,7 +6781,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
             /* Flush first event, now do transition 2 or 3 */
             bool paused = (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != 0;
 
-            testObjectEventQueue(privconn, event);
+            virObjectEventStateQueue(privconn->eventState, event);
             event = virDomainEventLifecycleNewFromObj(vm,
                             VIR_DOMAIN_EVENT_STARTED,
                             VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT);
@@ -6803,8 +6797,8 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
     ret = 0;
  cleanup:
     if (event) {
-        testObjectEventQueue(privconn, event);
-        testObjectEventQueue(privconn, event2);
+        virObjectEventStateQueue(privconn->eventState, event);
+        virObjectEventStateQueue(privconn->eventState, event2);
     } else {
         virObjectUnref(event2);
     }
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH libvirt 2/4] events: remove libxlDomainEventQueue wrapper func
Posted by Anya Harter, 1 week ago
And replace all calls with virObjectEventStateQueue such that:

    libxlDomainEventQueue(driver, event);

becomes:

    virObjectEventStateQueue(driver->domainEventState, event);

And remove NULL checking from all callers.

Signed-off-by: Anya Harter <aharter@redhat.com>
---
 src/libxl/libxl_domain.c    | 24 ++++++------------------
 src/libxl/libxl_domain.h    |  4 ----
 src/libxl/libxl_driver.c    | 21 +++++++--------------
 src/libxl/libxl_migration.c | 18 ++++++------------
 4 files changed, 19 insertions(+), 48 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index d12b1b1b4b..2ab78ac9a5 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -526,10 +526,8 @@ libxlDomainShutdownThread(void *opaque)
     }
 
  destroy:
-    if (dom_event) {
-        libxlDomainEventQueue(driver, dom_event);
-        dom_event = NULL;
-    }
+    virObjectEventStateQueue(driver->domainEventState, dom_event);
+    dom_event = NULL;
     libxlDomainDestroyInternal(driver, vm);
     libxlDomainCleanup(driver, vm);
     if (!vm->persistent)
@@ -538,10 +536,8 @@ libxlDomainShutdownThread(void *opaque)
     goto endjob;
 
  restart:
-    if (dom_event) {
-        libxlDomainEventQueue(driver, dom_event);
-        dom_event = NULL;
-    }
+    virObjectEventStateQueue(driver->domainEventState, dom_event);
+    dom_event = NULL;
     libxlDomainDestroyInternal(driver, vm);
     libxlDomainCleanup(driver, vm);
     if (libxlDomainStartNew(driver, vm, false) < 0) {
@@ -554,8 +550,7 @@ libxlDomainShutdownThread(void *opaque)
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    if (dom_event)
-        libxlDomainEventQueue(driver, dom_event);
+    virObjectEventStateQueue(driver->domainEventState, dom_event);
     libxl_event_free(cfg->ctx, ev);
     VIR_FREE(shutdown_info);
     virObjectUnref(cfg);
@@ -616,12 +611,6 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event)
     VIR_FREE(shutdown_info);
 }
 
-void
-libxlDomainEventQueue(libxlDriverPrivatePtr driver, virObjectEventPtr event)
-{
-    virObjectEventStateQueue(driver->domainEventState, event);
-}
-
 char *
 libxlDomainManagedSavePath(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
 {
@@ -1394,8 +1383,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
                                      restore_fd < 0 ?
                                          VIR_DOMAIN_EVENT_STARTED_BOOTED :
                                          VIR_DOMAIN_EVENT_STARTED_RESTORED);
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     ret = 0;
     goto cleanup;
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index b5b6332151..5d83230cd6 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -95,10 +95,6 @@ int
 libxlDomainJobUpdateTime(struct libxlDomainJobObj *job)
     ATTRIBUTE_RETURN_CHECK;
 
-void
-libxlDomainEventQueue(libxlDriverPrivatePtr driver,
-                      virObjectEventPtr event);
-
 char *
 libxlDomainManagedSavePath(libxlDriverPrivatePtr driver,
                            virDomainObjPtr vm);
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 8c40661e5a..5a5e792957 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1179,8 +1179,7 @@ libxlDomainSuspend(virDomainPtr dom)
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -1234,8 +1233,7 @@ libxlDomainResume(virDomainPtr dom)
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -1394,8 +1392,7 @@ libxlDomainDestroyFlags(virDomainPtr dom,
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -1734,8 +1731,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver,
     VIR_FREE(xml);
     if (VIR_CLOSE(fd) < 0)
         virReportSystemError(errno, "%s", _("cannot close file"));
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -1950,8 +1946,7 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags)
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -2755,8 +2750,7 @@ libxlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag
     virDomainDefFree(def);
     virDomainDefFree(oldDef);
     virDomainObjEndAPI(&vm);
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return dom;
 }
@@ -2827,8 +2821,7 @@ libxlDomainUndefineFlags(virDomainPtr dom,
  cleanup:
     VIR_FREE(name);
     virDomainObjEndAPI(&vm);
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 206b878292..b2e5847c58 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -1284,10 +1284,8 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn,
                                          VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
     }
 
-    if (event) {
-        libxlDomainEventQueue(driver, event);
-        event = NULL;
-    }
+    virObjectEventStateQueue(driver->domainEventState, event);
+    event = NULL;
 
     if (flags & VIR_MIGRATE_PERSIST_DEST) {
         unsigned int oldPersist = vm->persistent;
@@ -1306,10 +1304,8 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn,
                                          oldPersist ?
                                          VIR_DOMAIN_EVENT_DEFINED_UPDATED :
                                          VIR_DOMAIN_EVENT_DEFINED_ADDED);
-        if (event) {
-            libxlDomainEventQueue(driver, event);
-            event = NULL;
-        }
+        virObjectEventStateQueue(driver->domainEventState, event);
+        event = NULL;
     }
 
     if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
@@ -1329,8 +1325,7 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn,
             virDomainObjListRemove(driver->domains, vm);
     }
 
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return dom;
 }
@@ -1384,8 +1379,7 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivatePtr driver,
     ret = 0;
 
  cleanup:
-    if (event)
-        libxlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH libvirt 3/4] events: remove qemuDomainEventQueue wrapper func
Posted by Anya Harter, 1 week ago
And replace all calls with virObjectEventStateQueue such that:

    qemuDomainEventQueue(driver, event);

becomes:

    virObjectEventStateQueue(driver->domainEventState, event);

And remove NULL checking from all callers.

Signed-off-by: Anya Harter <aharter@redhat.com>
---
 src/qemu/qemu_blockjob.c  |  4 +-
 src/qemu/qemu_cgroup.c    |  2 +-
 src/qemu/qemu_domain.c    | 11 +----
 src/qemu/qemu_domain.h    |  2 -
 src/qemu/qemu_driver.c    | 88 ++++++++++++++++++---------------------
 src/qemu/qemu_hotplug.c   | 26 ++++++------
 src/qemu/qemu_migration.c | 24 +++++------
 src/qemu/qemu_process.c   | 54 ++++++++++++------------
 8 files changed, 98 insertions(+), 113 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index e0dfb88c1c..b08e047490 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -210,8 +210,8 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
                      "after block job", vm->def->name);
     }
 
-    qemuDomainEventQueue(driver, event);
-    qemuDomainEventQueue(driver, event2);
+    virObjectEventStateQueue(driver->domainEventState, event);
+    virObjectEventStateQueue(driver->domainEventState, event2);
 
     virObjectUnref(cfg);
 }
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 43c5ae8f8e..c8fba7f9e6 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -896,7 +896,7 @@ qemuSetupCpuCgroup(virDomainObjPtr vm)
             event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
         }
 
-        qemuDomainEventQueue(priv->driver, event);
+        virObjectEventStateQueue(priv->driver->domainEventState, event);
     }
 
     return 0;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 756e938858..2119233907 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -256,13 +256,6 @@ qemuDomainDisableNamespace(virDomainObjPtr vm,
 }
 
 
-void qemuDomainEventQueue(virQEMUDriverPtr driver,
-                          virObjectEventPtr event)
-{
-    virObjectEventStateQueue(driver->domainEventState, event);
-}
-
-
 void
 qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm)
@@ -283,7 +276,7 @@ qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
     }
 
     event = virDomainEventJobCompletedNewFromObj(vm, params, nparams);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 }
 
 
@@ -7872,7 +7865,7 @@ qemuDomainCheckRemoveOptionalDisk(virQEMUDriverPtr driver,
         virDomainDiskDefFree(disk);
     }
 
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 }
 
 
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index f17157b951..fd8d9b5305 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -493,8 +493,6 @@ int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
 
 void qemuDomainEventFlush(int timer, void *opaque);
 
-void qemuDomainEventQueue(virQEMUDriverPtr driver,
-                          virObjectEventPtr event);
 void qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm);
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f0fb806fcd..7c79c324e6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -975,7 +975,7 @@ static void qemuNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
             virDomainEventLifecycleNewFromObj(vm,
                                      VIR_DOMAIN_EVENT_DEFINED,
                                      VIR_DOMAIN_EVENT_DEFINED_ADDED);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     }
 }
 
@@ -1806,10 +1806,8 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
  cleanup:
     virDomainDefFree(def);
     virDomainObjEndAPI(&vm);
-    if (event) {
-        qemuDomainEventQueue(driver, event);
-        qemuDomainEventQueue(driver, event2);
-    }
+    virObjectEventStateQueue(driver->domainEventState, event);
+    virObjectEventStateQueue(driver->domainEventState, event2);
     virObjectUnref(caps);
     virNWFilterUnlockFilterUpdates();
     return dom;
@@ -1879,7 +1877,7 @@ static int qemuDomainSuspend(virDomainPtr dom)
  cleanup:
     virDomainObjEndAPI(&vm);
 
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -1942,7 +1940,7 @@ static int qemuDomainResume(virDomainPtr dom)
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -2250,7 +2248,7 @@ qemuDomainDestroyFlags(virDomainPtr dom,
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     return ret;
 }
 
@@ -3385,7 +3383,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver,
                                      VIR_DOMAIN_RUNNING_SAVE_CANCELED,
                                      QEMU_ASYNC_JOB_SAVE) < 0) {
                 VIR_WARN("Unable to resume guest CPUs after save failure");
-                qemuDomainEventQueue(driver,
+                virObjectEventStateQueue(driver->domainEventState,
                                      virDomainEventLifecycleNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_SUSPENDED,
                                          VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR));
@@ -3402,7 +3400,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver,
     virObjectUnref(cookie);
     VIR_FREE(xml);
     virQEMUSaveDataFree(data);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(caps);
     return ret;
 }
@@ -3973,7 +3971,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom,
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     return ret;
 }
 
@@ -4251,7 +4249,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
                                               VIR_DOMAIN_EVENT_CRASHED,
                                               VIR_DOMAIN_EVENT_CRASHED_PANICKED);
 
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
         VIR_WARN("Unable to save status on vm %s after state change",
@@ -4275,7 +4273,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
                                                   VIR_DOMAIN_EVENT_STOPPED,
                                                   VIR_DOMAIN_EVENT_STOPPED_CRASHED);
 
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
         virDomainAuditStop(vm, "destroyed");
         removeInactive = true;
         break;
@@ -4719,7 +4717,7 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
 
         event = virDomainEventAgentLifecycleNewFromObj(vm, newstate,
                                                        VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     }
 
  endjob:
@@ -4793,7 +4791,7 @@ processMonitorEOFEvent(virQEMUDriverPtr driver,
                                               eventReason);
     qemuProcessStop(driver, vm, stopReason, QEMU_ASYNC_JOB_NONE, stopFlags);
     virDomainAuditStop(vm, auditReason);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
  endjob:
     qemuDomainRemoveInactive(driver, vm);
@@ -5072,7 +5070,7 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
     virBitmapFree(tmpmap);
     virCgroupFree(&cgroup_vcpu);
     VIR_FREE(str);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     return ret;
 }
 
@@ -5309,7 +5307,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
  cleanup:
     if (cgroup_emulator)
         virCgroupFree(&cgroup_emulator);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     VIR_FREE(str);
     virBitmapFree(pcpumap);
     virDomainObjEndAPI(&vm);
@@ -5791,7 +5789,7 @@ qemuDomainPinIOThread(virDomainPtr dom,
  cleanup:
     if (cgroup_iothread)
         virCgroupFree(&cgroup_iothread);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     VIR_FREE(str);
     virBitmapFree(pcpumap);
     virDomainObjEndAPI(&vm);
@@ -6622,7 +6620,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
     event = virDomainEventLifecycleNewFromObj(vm,
                                      VIR_DOMAIN_EVENT_STARTED,
                                      VIR_DOMAIN_EVENT_STARTED_RESTORED);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
 
     /* If it was running before, resume it now unless caller requested pause. */
@@ -6645,7 +6643,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
         event = virDomainEventLifecycleNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_SUSPENDED,
                                          detail);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     }
 
     ret = 0;
@@ -7293,14 +7291,12 @@ qemuDomainObjStart(virConnectPtr conn,
             virDomainEventLifecycleNewFromObj(vm,
                                      VIR_DOMAIN_EVENT_STARTED,
                                      VIR_DOMAIN_EVENT_STARTED_BOOTED);
-        if (event) {
-            qemuDomainEventQueue(driver, event);
-            if (start_paused) {
-                event = virDomainEventLifecycleNewFromObj(vm,
-                                                 VIR_DOMAIN_EVENT_SUSPENDED,
-                                                 VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
-                qemuDomainEventQueue(driver, event);
-            }
+        virObjectEventStateQueue(driver->domainEventState, event);
+        if (start_paused) {
+            event = virDomainEventLifecycleNewFromObj(vm,
+                                             VIR_DOMAIN_EVENT_SUSPENDED,
+                                             VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
+            virObjectEventStateQueue(driver->domainEventState, event);
         }
     }
 
@@ -7444,7 +7440,7 @@ qemuDomainDefineXMLFlags(virConnectPtr conn,
     virDomainDefFree(oldDef);
     virDomainDefFree(def);
     virDomainObjEndAPI(&vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return dom;
@@ -7571,7 +7567,7 @@ qemuDomainUndefineFlags(virDomainPtr dom,
  cleanup:
     VIR_FREE(name);
     virDomainObjEndAPI(&vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -7728,7 +7724,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
          * is in monitor */
         virObjectEventPtr event;
         event = virDomainEventDeviceAddedNewFromObj(vm, alias);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     }
 
     if (ret == 0)
@@ -10647,7 +10643,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
     if (eventNparams) {
         event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
         eventNparams = 0;
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     }
 
     if (persistentDef) {
@@ -14320,7 +14316,7 @@ qemuDomainSnapshotCreateActiveInternal(virQEMUDriverPtr driver,
         }
     }
 
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     return ret;
 }
@@ -15255,7 +15251,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
         virDomainAuditStop(vm, "from-snapshot");
         resume = false;
         thaw = 0;
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, 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
@@ -15264,7 +15260,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
                              VIR_DOMAIN_PAUSED_FROM_SNAPSHOT);
         event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED,
                                          VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     }
 
     ret = 0;
@@ -15277,7 +15273,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
         event = virDomainEventLifecycleNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_SUSPENDED,
                                          VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
         if (virGetLastErrorCode() == VIR_ERR_OK) {
             virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                            _("resuming after snapshot failed"));
@@ -16165,7 +16161,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
                     event = virDomainEventLifecycleNewFromObj(vm,
                                                      VIR_DOMAIN_EVENT_STOPPED,
                                                      detail);
-                    qemuDomainEventQueue(driver, event);
+                    virObjectEventStateQueue(driver->domainEventState, event);
                     goto load;
                 }
             }
@@ -16317,7 +16313,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
 
             start_flags |= paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
 
-            qemuDomainEventQueue(driver, event);
+            virObjectEventStateQueue(driver->domainEventState, event);
             rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
                                   QEMU_ASYNC_JOB_START, NULL, -1, NULL, NULL,
                                   VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
@@ -16377,15 +16373,13 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
         !(ret = virDomainSaveConfig(cfg->configDir, driver->caps,
                                     vm->newDef ? vm->newDef : vm->def))) {
         detail = VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT;
-        qemuDomainEventQueue(driver,
+        virObjectEventStateQueue(driver->domainEventState,
             virDomainEventLifecycleNewFromObj(vm,
                                               VIR_DOMAIN_EVENT_DEFINED,
                                               detail));
     }
-    if (event) {
-        qemuDomainEventQueue(driver, event);
-        qemuDomainEventQueue(driver, event2);
-    }
+    virObjectEventStateQueue(driver->domainEventState, event);
+    virObjectEventStateQueue(driver->domainEventState, event2);
     virDomainObjEndAPI(&vm);
     virObjectUnref(caps);
     virObjectUnref(cfg);
@@ -18545,7 +18539,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
         if (eventNparams) {
             event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
             eventNparams = 0;
-            qemuDomainEventQueue(driver, event);
+            virObjectEventStateQueue(driver->domainEventState, event);
         }
     }
 
@@ -18845,7 +18839,7 @@ qemuDomainSetMetadata(virDomainPtr dom,
     if (ret == 0) {
         virObjectEventPtr ev = NULL;
         ev = virDomainEventMetadataChangeNewFromObj(vm, type, uri);
-        qemuDomainEventQueue(driver, ev);
+        virObjectEventStateQueue(driver->domainEventState, ev);
     }
 
     qemuDomainObjEndJob(driver, vm);
@@ -20908,8 +20902,8 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
     VIR_FREE(new_dom_cfg_file);
     VIR_FREE(old_dom_name);
     VIR_FREE(new_dom_name);
-    qemuDomainEventQueue(driver, event_old);
-    qemuDomainEventQueue(driver, event_new);
+    virObjectEventStateQueue(driver->domainEventState, event_old);
+    virObjectEventStateQueue(driver->domainEventState, event_new);
     virObjectUnref(cfg);
     return ret;
 
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 822e38ae08..7c0c366b99 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2042,7 +2042,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
     }
 
     event = virDomainEventDeviceAddedNewFromObj(vm, objalias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     /* fix the balloon size */
     ignore_value(qemuProcessRefreshBalloonState(driver, vm, QEMU_ASYNC_JOB_NONE));
@@ -3807,7 +3807,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
     virDomainAuditDisk(vm, disk->src, NULL, "detach", true);
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, disk->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     if (prManaged && !prUsed)
         qemuProcessKillManagedPRDaemon(vm);
@@ -3848,7 +3848,7 @@ qemuDomainRemoveControllerDevice(virQEMUDriverPtr driver,
               controller->info.alias, vm, vm->def->name);
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, controller->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     for (i = 0; i < vm->def->ncontrollers; i++) {
         if (vm->def->controllers[i] == controller) {
@@ -3894,7 +3894,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver,
         return -1;
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, mem->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     if ((idx = virDomainMemoryFindByDef(vm->def, mem)) >= 0)
         virDomainMemoryRemove(vm->def, idx);
@@ -4020,7 +4020,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
     }
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, hostdev->info->alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET) {
         net = hostdev->parent.data.net;
@@ -4146,7 +4146,7 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
     virDomainAuditNet(vm, net, NULL, "detach", true);
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, net->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     for (i = 0; i < vm->def->nnets; i++) {
         if (vm->def->nets[i] == net) {
@@ -4229,7 +4229,7 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
         VIR_WARN("Unable to remove chr device from /dev");
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, chr->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     qemuDomainReleaseDeviceAddress(vm, &chr->info, NULL);
     qemuDomainChrRemove(vm->def, chr);
@@ -4290,7 +4290,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
         VIR_WARN("Unable to remove RNG device from /dev");
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, rng->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     if ((idx = virDomainRNGFind(vm->def, rng)) >= 0)
         virDomainRNGRemove(vm->def, idx);
@@ -4345,7 +4345,7 @@ qemuDomainRemoveShmemDevice(virQEMUDriverPtr driver,
         goto cleanup;
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, shmem->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     if ((idx = virDomainShmemDefFind(vm->def, shmem)) >= 0)
         virDomainShmemDefRemove(vm->def, idx);
@@ -4372,7 +4372,7 @@ qemuDomainRemoveWatchdog(virQEMUDriverPtr driver,
               watchdog->info.alias, vm, vm->def->name);
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, watchdog->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     qemuDomainReleaseDeviceAddress(vm, &watchdog->info, NULL);
     virDomainWatchdogDefFree(vm->def->watchdog);
     vm->def->watchdog = NULL;
@@ -4393,7 +4393,7 @@ qemuDomainRemoveInputDevice(virDomainObjPtr vm,
               dev->info.alias, vm, vm->def->name);
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, dev->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     for (i = 0; i < vm->def->ninputs; i++) {
         if (vm->def->inputs[i] == dev)
             break;
@@ -4426,7 +4426,7 @@ qemuDomainRemoveVsockDevice(virDomainObjPtr vm,
               dev->info.alias, vm, vm->def->name);
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, dev->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     qemuDomainReleaseDeviceAddress(vm, &dev->info, NULL);
     virDomainVsockDefFree(vm->def->vsock);
     vm->def->vsock = NULL;
@@ -4466,7 +4466,7 @@ qemuDomainRemoveRedirdevDevice(virQEMUDriverPtr driver,
     virDomainAuditRedirdev(vm, dev, "detach", true);
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, dev->info.alias);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     if ((idx = virDomainRedirdevDefFind(vm->def, dev)) >= 0)
         virDomainRedirdevDefRemove(vm->def, idx);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index ee482475f5..910766080c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1245,7 +1245,7 @@ qemuMigrationSrcSetOffline(virQEMUDriverPtr driver,
         event = virDomainEventLifecycleNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_SUSPENDED,
                                          VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     }
 
     return ret;
@@ -1285,7 +1285,7 @@ qemuMigrationAnyPostcopyFailed(virQEMUDriverPtr driver,
         event = virDomainEventLifecycleNewFromObj(vm,
                                 VIR_DOMAIN_EVENT_SUSPENDED,
                                 VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     } else {
         virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
                              VIR_DOMAIN_PAUSED_POSTCOPY_FAILED);
@@ -2613,7 +2613,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
         qemuDomainRemoveInactiveJob(driver, vm);
     }
     virDomainObjEndAPI(&vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     qemuMigrationCookieFree(mig);
     virObjectUnref(caps);
     virNWFilterUnlockFilterUpdates();
@@ -2967,7 +2967,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
         event = virDomainEventLifecycleNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_STOPPED,
                                          VIR_DOMAIN_EVENT_STOPPED_MIGRATED);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
         qemuDomainEventEmitJobCompleted(driver, vm);
     } else {
         virErrorPtr orig_err = virSaveLastError();
@@ -2987,7 +2987,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
             event = virDomainEventLifecycleNewFromObj(vm,
                                                       VIR_DOMAIN_EVENT_RESUMED,
                                                       VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
-            qemuDomainEventQueue(driver, event);
+            virObjectEventStateQueue(driver->domainEventState, event);
         }
 
         qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
@@ -4649,7 +4649,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -4725,7 +4725,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     return ret;
 }
 
@@ -4889,7 +4889,7 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver,
                                               oldPersist ?
                                               VIR_DOMAIN_EVENT_DEFINED_UPDATED :
                                               VIR_DOMAIN_EVENT_DEFINED_ADDED);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     ret = 0;
 
@@ -5082,7 +5082,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver,
             event = virDomainEventLifecycleNewFromObj(vm,
                                         VIR_DOMAIN_EVENT_RESUMED,
                                         VIR_DOMAIN_EVENT_RESUMED_POSTCOPY);
-            qemuDomainEventQueue(driver, event);
+            virObjectEventStateQueue(driver->domainEventState, event);
         }
     }
 
@@ -5117,14 +5117,14 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver,
     event = virDomainEventLifecycleNewFromObj(vm,
                                               VIR_DOMAIN_EVENT_RESUMED,
                                               VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
         virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
         event = virDomainEventLifecycleNewFromObj(vm,
                                                   VIR_DOMAIN_EVENT_SUSPENDED,
                                                   VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
-        qemuDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     }
 
     if (virDomainObjIsActive(vm) &&
@@ -5146,7 +5146,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver,
             event = virDomainEventLifecycleNewFromObj(vm,
                                 VIR_DOMAIN_EVENT_STOPPED,
                                 VIR_DOMAIN_EVENT_STOPPED_FAILED);
-            qemuDomainEventQueue(driver, event);
+            virObjectEventStateQueue(driver->domainEventState, event);
         } else {
             qemuMigrationAnyPostcopyFailed(driver, vm);
         }
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 480bc8c1ad..84e0506d93 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -344,7 +344,7 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     ((qemuDomainObjPrivatePtr) vm->privateData)->monError = true;
     event = virDomainEventControlErrorNewFromObj(vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     virObjectUnlock(vm);
 }
@@ -416,7 +416,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     ret = 0;
  cleanup:
     virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return ret;
 }
@@ -491,7 +491,7 @@ qemuProcessFakeReboot(void *opaque)
     if (ret == -1)
         ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE));
     virDomainObjEndAPI(&vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
 }
 
@@ -540,7 +540,7 @@ qemuProcessHandleEvent(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
                                          seconds, micros, details);
 
     virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     return 0;
 }
@@ -612,7 +612,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
  unlock:
     virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
 
     return 0;
@@ -677,7 +677,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
  unlock:
     virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
 
     return 0;
@@ -719,7 +719,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
  unlock:
     virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return 0;
 }
@@ -763,7 +763,7 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     virObjectUnlock(vm);
 
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return 0;
 }
@@ -823,8 +823,8 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     if (vm)
         virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, watchdogEvent);
-    qemuDomainEventQueue(driver, lifecycleEvent);
+    virObjectEventStateQueue(driver->domainEventState, watchdogEvent);
+    virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
 
     virObjectUnref(cfg);
     return 0;
@@ -885,9 +885,9 @@ qemuProcessHandleIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     }
     virObjectUnlock(vm);
 
-    qemuDomainEventQueue(driver, ioErrorEvent);
-    qemuDomainEventQueue(driver, ioErrorEvent2);
-    qemuDomainEventQueue(driver, lifecycleEvent);
+    virObjectEventStateQueue(driver->domainEventState, ioErrorEvent);
+    virObjectEventStateQueue(driver->domainEventState, ioErrorEvent2);
+    virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
     virObjectUnref(cfg);
     return 0;
 }
@@ -1010,7 +1010,7 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     event = virDomainEventGraphicsNewFromObj(vm, phase, localAddr, remoteAddr, authScheme, subject);
     virObjectUnlock(vm);
 
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     return 0;
 
@@ -1071,7 +1071,7 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     }
 
     virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return 0;
 }
@@ -1109,8 +1109,8 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     }
 
     virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, event);
-    qemuDomainEventQueue(driver, lifecycleEvent);
+    virObjectEventStateQueue(driver->domainEventState, event);
+    virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
     virObjectUnref(cfg);
     return 0;
 }
@@ -1151,8 +1151,8 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     virObjectUnlock(vm);
 
-    qemuDomainEventQueue(driver, event);
-    qemuDomainEventQueue(driver, lifecycleEvent);
+    virObjectEventStateQueue(driver->domainEventState, event);
+    virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
     virObjectUnref(cfg);
     return 0;
 }
@@ -1179,7 +1179,7 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     virObjectUnlock(vm);
 
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     virObjectUnref(cfg);
     return 0;
 }
@@ -1220,8 +1220,8 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     virObjectUnlock(vm);
 
-    qemuDomainEventQueue(driver, event);
-    qemuDomainEventQueue(driver, lifecycleEvent);
+    virObjectEventStateQueue(driver->domainEventState, event);
+    virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
     virObjectUnref(cfg);
 
     return 0;
@@ -1367,7 +1367,7 @@ qemuProcessHandleAcpiOstInfo(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     }
 
     virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     return 0;
 }
@@ -1407,7 +1407,7 @@ qemuProcessHandleBlockThreshold(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     }
 
     virObjectUnlock(vm);
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 
     return 0;
 }
@@ -1567,7 +1567,7 @@ qemuProcessHandleMigrationPass(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
         goto cleanup;
     }
 
-    qemuDomainEventQueue(driver,
+    virObjectEventStateQueue(driver->domainEventState,
                          virDomainEventMigrationIterationNewFromObj(vm, pass));
 
  cleanup:
@@ -1977,7 +1977,7 @@ qemuProcessRefreshChannelVirtioState(virQEMUDriverPtr driver,
                 STREQ_NULLABLE(chr->target.name, "org.qemu.guest_agent.0") &&
                 (event = virDomainEventAgentLifecycleNewFromObj(vm, entry->state,
                                                                 agentReason)))
-                qemuDomainEventQueue(driver, event);
+                virObjectEventStateQueue(driver->domainEventState, event);
 
             chr->state = entry->state;
         }
@@ -7320,7 +7320,7 @@ qemuProcessAutoDestroy(virDomainObjPtr dom,
 
     qemuDomainObjEndJob(driver, dom);
 
-    qemuDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
 }
 
 int qemuProcessAutoDestroyAdd(virQEMUDriverPtr driver,
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH libvirt 4/4] events: remove umlDomainEventQueue wrapper func
Posted by Anya Harter, 1 week ago
And replace all calls with virObjectEventStateQueue such that:

    umlDomainEventQueue(driver, event);

becomes:

    virObjectEventStateQueue(driver->domainEventState, event);

And remove NULL checking from all callers.

Signed-off-by: Anya Harter <aharter@redhat.com>
---
 src/uml/uml_driver.c | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 53ec64e10f..0c5b7fcda7 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -125,8 +125,6 @@ static int umlOpenMonitor(struct uml_driver *driver,
                           virDomainObjPtr vm);
 static int umlReadPidFile(struct uml_driver *driver,
                           virDomainObjPtr vm);
-static void umlDomainEventQueue(struct uml_driver *driver,
-                                virObjectEventPtr event);
 
 static int umlStartVMDaemon(virConnectPtr conn,
                             struct uml_driver *driver,
@@ -228,8 +226,7 @@ umlAutostartDomain(virDomainObjPtr vm,
                 virDomainEventLifecycleNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_STARTED,
                                          VIR_DOMAIN_EVENT_STARTED_BOOTED);
-            if (event)
-                umlDomainEventQueue(data->driver, event);
+            virObjectEventStateQueue(data->driver->domainEventState, event);
         }
     }
     virObjectUnlock(vm);
@@ -425,10 +422,8 @@ umlInotifyEvent(int watch,
             }
         }
         virDomainObjEndAPI(&dom);
-        if (event) {
-            umlDomainEventQueue(driver, event);
-            event = NULL;
-        }
+        virObjectEventStateQueue(driver->domainEventState, event);
+        event = NULL;
     }
 
  cleanup:
@@ -646,8 +641,7 @@ static void umlNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
             virDomainEventLifecycleNewFromObj(vm,
                                      VIR_DOMAIN_EVENT_DEFINED,
                                      VIR_DOMAIN_EVENT_DEFINED_ADDED);
-        if (event)
-            umlDomainEventQueue(driver, event);
+        virObjectEventStateQueue(driver->domainEventState, event);
     }
 }
 
@@ -783,8 +777,7 @@ static int umlProcessAutoDestroyDom(void *payload,
         virDomainObjListRemove(data->driver->domains, dom);
 
     virDomainObjEndAPI(&dom);
-    if (event)
-        umlDomainEventQueue(data->driver, event);
+    virObjectEventStateQueue(data->driver->domainEventState, event);
     virHashRemoveEntry(data->driver->autodestroy, uuidstr);
     return 0;
 }
@@ -1615,8 +1608,7 @@ static virDomainPtr umlDomainCreateXML(virConnectPtr conn, const char *xml,
  cleanup:
     virDomainDefFree(def);
     virDomainObjEndAPI(&vm);
-    if (event)
-        umlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     umlDriverUnlock(driver);
     virNWFilterUnlockFilterUpdates();
     return dom;
@@ -1689,8 +1681,7 @@ umlDomainDestroyFlags(virDomainPtr dom,
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    if (event)
-        umlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     umlDriverUnlock(driver);
     return ret;
 }
@@ -1949,8 +1940,7 @@ static int umlDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    if (event)
-        umlDomainEventQueue(driver, event);
+    virObjectEventStateQueue(driver->domainEventState, event);
     umlDriverUnlock(driver);
     virNWFilterUnlockFilterUpdates();
     return ret;
@@ -2587,13 +2577,6 @@ umlConnectDomainEventDeregisterAny(virConnectPtr conn,
 }
 
 
-/* driver must be locked before calling */
-static void umlDomainEventQueue(struct uml_driver *driver,
-                                virObjectEventPtr event)
-{
-    virObjectEventStateQueue(driver->domainEventState, event);
-}
-
 static int umlConnectListAllDomains(virConnectPtr conn,
                                     virDomainPtr **domains,
                                     unsigned int flags)
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list