[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2] Remove qemuDriverLock from almost everywhere



From: "Daniel P. Berrange" <berrange redhat com>

With the majority of fields in the virQEMUDriverPtr struct
now immutable or self-locking, there is no need for practically
any methods to be using the QEMU driver lock. Only a handful
of helper APIs in qemu_conf.c now need it
---
 src/qemu/THREADS.txt      | 194 +++--------------------
 src/qemu/qemu_conf.c      |  50 ++++--
 src/qemu/qemu_domain.c    | 213 +++++--------------------
 src/qemu/qemu_domain.h    |  40 +----
 src/qemu/qemu_driver.c    | 386 +++++++++++-----------------------------------
 src/qemu/qemu_hotplug.c   | 118 +++++++-------
 src/qemu/qemu_migration.c |  66 ++++----
 src/qemu/qemu_process.c   | 223 +++++++++-----------------
 src/qemu/qemu_process.h   |   3 +-
 9 files changed, 360 insertions(+), 933 deletions(-)

diff --git a/src/qemu/THREADS.txt b/src/qemu/THREADS.txt
index c3bad21..785be99 100644
--- a/src/qemu/THREADS.txt
+++ b/src/qemu/THREADS.txt
@@ -14,35 +14,24 @@ Basic locking primitives
 
 There are a number of locks on various objects
 
-  * struct qemud_driver: RWLock
+  * virQEMUDriverPtr
 
-    This is the top level lock on the entire driver. Every API call in
-    the QEMU driver is blocked while this is held, though some internal
-    callbacks may still run asynchronously. This lock must never be held
-    for anything which sleeps/waits (i.e. monitor commands)
+    The qemu_conf.h file has inline comments describing the locking
+    needs for each field. Any field marked immutable, self-locking
+    can be accessed without the driver lock. For other fields there
+    are typically helper APIs in qemu_conf.c that provide serialized
+    access to the data. No code outside qemu_conf.c should ever
+    acquire this lock
 
-    When obtaining the driver lock, under *NO* circumstances must
-    any lock be held on a virDomainObjPtr. This *WILL* result in
-    deadlock.
-
-
-
-  * virDomainObjPtr:  Mutex
+  * virDomainObjPtr
 
     Will be locked after calling any of the virDomainFindBy{ID,Name,UUID}
     methods.
 
     Lock must be held when changing/reading any variable in the virDomainObjPtr
 
-    Once the lock is held, you must *NOT* try to lock the driver. You must
-    release all virDomainObjPtr locks before locking the driver, or deadlock
-    *WILL* occur.
-
     If the lock needs to be dropped & then re-acquired for a short period of
     time, the reference count must be incremented first using virDomainObjRef().
-    If the reference count is incremented in this way, it is not necessary
-    to have the driver locked when re-acquiring the dropped locked, since the
-    reference count prevents it being freed by another thread.
 
     This lock must not be held for anything which sleeps/waits (i.e. monitor
     commands).
@@ -103,26 +92,10 @@ There are a number of locks on various objects
     The virDomainObjPtr lock *MUST* then be released when invoking the
     monitor command.
 
-    The driver lock *MUST* be released when invoking the monitor commands.
-
-    This ensures that the virDomainObjPtr & driver are both unlocked while
-    sleeping/waiting for the monitor response.
-
-
 
 Helper methods
 --------------
 
-To lock the driver
-
-  qemuDriverLock()
-    - Acquires the driver lock
-
-  qemuDriverUnlock()
-    - Releases the driver lock
-
-
-
 To lock the virDomainObjPtr
 
   virObjectLock()
@@ -135,19 +108,8 @@ To lock the virDomainObjPtr
 
 To acquire the normal job condition
 
-  qemuDomainObjBeginJob()           (if driver is unlocked)
-    - Increments ref count on virDomainObjPtr
-    - Waits until the job is compatible with current async job or no
-      async job is running
-    - Waits for job.cond condition 'job.active != 0' using virDomainObjPtr
-      mutex
-    - Rechecks if the job is still compatible and repeats waiting if it
-      isn't
-    - Sets job.active to the job type
-
-  qemuDomainObjBeginJobWithDriver() (if driver needs to be locked)
+  qemuDomainObjBeginJob()
     - Increments ref count on virDomainObjPtr
-    - Unlocks driver
     - Waits until the job is compatible with current async job or no
       async job is running
     - Waits for job.cond condition 'job.active != 0' using virDomainObjPtr
@@ -155,12 +117,6 @@ To acquire the normal job condition
     - Rechecks if the job is still compatible and repeats waiting if it
       isn't
     - Sets job.active to the job type
-    - Unlocks virDomainObjPtr
-    - Locks driver
-    - Locks virDomainObjPtr
-
-   NB: this variant is required in order to comply with lock ordering
-   rules for virDomainObjPtr vs. driver
 
 
   qemuDomainObjEndJob()
@@ -181,22 +137,6 @@ To acquire the asynchronous job condition
       and repeats waiting in that case
     - Sets job.asyncJob to the asynchronous job type
 
-  qemuDomainObjBeginAsyncJobWithDriver()  (if driver needs to be locked)
-    - Increments ref count on virDomainObjPtr
-    - Unlocks driver
-    - Waits until no async job is running
-    - Waits for job.cond condition 'job.active != 0' using virDomainObjPtr
-      mutex
-    - Rechecks if any async job was started while waiting on job.cond
-      and repeats waiting in that case
-    - Sets job.asyncJob to the asynchronous job type
-    - Unlocks virDomainObjPtr
-    - Locks driver
-    - Locks virDomainObjPtr
-
-   NB: this variant is required in order to comply with lock ordering
-   rules for virDomainObjPtr vs driver
-
 
   qemuDomainObjEndAsyncJob()
     - Sets job.asyncJob to 0
@@ -220,25 +160,7 @@ To acquire the QEMU monitor lock
   These functions must not be used by an asynchronous job.
 
 
-To acquire the QEMU monitor lock with the driver lock held
-
-  qemuDomainObjEnterMonitorWithDriver()
-    - Acquires the qemuMonitorObjPtr lock
-    - Releases the virDomainObjPtr lock
-    - Releases the driver lock
-
-  qemuDomainObjExitMonitorWithDriver()
-    - Releases the qemuMonitorObjPtr lock
-    - Acquires the driver lock
-    - Acquires the virDomainObjPtr lock
-
-  NB: caller must take care to drop the driver lock if necessary
-
-  These functions must not be used inside an asynchronous job.
-
-
-To acquire the QEMU monitor lock with the driver lock held and as part
-of an asynchronous job
+To acquire the QEMU monitor lock as part of an asynchronous job
 
   qemuDomainObjEnterMonitorAsync()
     - Validates that the right async job is still running
@@ -247,13 +169,11 @@ of an asynchronous job
     - Releases the driver lock
     - Validates that the VM is still active
 
-  qemuDomainObjExitMonitorWithDriver()
+  qemuDomainObjExitMonitor()
     - Releases the qemuMonitorObjPtr lock
     - Acquires the driver lock
     - Acquires the virDomainObjPtr lock
 
-  NB: caller must take care to drop the driver lock if necessary
-
   These functions are for use inside an asynchronous job; the caller
   must check for a return of -1 (VM not running, so nothing to exit).
   Helper functions may also call this with QEMU_ASYNC_JOB_NONE when
@@ -263,13 +183,11 @@ of an asynchronous job
 To keep a domain alive while waiting on a remote command, starting
 with the driver lock held
 
-  qemuDomainObjEnterRemoterWithDriver()
+  qemuDomainObjEnterRemote()
     - Increments ref count on virDomainObjPtr
     - Releases the virDomainObjPtr lock
-    - Releases the driver lock
 
-  qemuDomainObjExitRemoteWithDriver()
-    - Acquires the driver lock
+  qemuDomainObjExitRemote()
     - Acquires the virDomainObjPtr lock
     - Decrements ref count on virDomainObjPtr
 
@@ -278,51 +196,22 @@ Design patterns
 ---------------
 
 
- * Accessing or updating something with just the driver
-
-     qemuDriverLock(driver);
-
-     ...do work...
-
-     qemuDriverUnlock(driver);
-
-
-
  * Accessing something directly to do with a virDomainObjPtr
 
      virDomainObjPtr obj;
 
-     qemuDriverLock(driver);
-     obj = virDomainFindByUUID(driver->domains, dom->uuid);
-     qemuDriverUnlock(driver);
-
-     ...do work...
-
-     virDomainObjUnlock(obj);
-
-
-
- * Accessing something directly to do with a virDomainObjPtr and driver
-
-     virDomainObjPtr obj;
-
-     qemuDriverLock(driver);
      obj = virDomainFindByUUID(driver->domains, dom->uuid);
 
      ...do work...
 
      virDomainObjUnlock(obj);
-     qemuDriverUnlock(driver);
-
 
 
  * Updating something directly to do with a virDomainObjPtr
 
      virDomainObjPtr obj;
 
-     qemuDriverLock(driver);
      obj = virDomainFindByUUID(driver->domains, dom->uuid);
-     qemuDriverUnlock(driver);
 
      qemuDomainObjBeginJob(obj, QEMU_JOB_TYPE);
 
@@ -341,9 +230,7 @@ Design patterns
      virDomainObjPtr obj;
      qemuDomainObjPrivatePtr priv;
 
-     qemuDriverLock(driver);
      obj = virDomainFindByUUID(driver->domains, dom->uuid);
-     qemuDriverUnlock(driver);
 
      qemuDomainObjBeginJob(obj, QEMU_JOB_TYPE);
 
@@ -362,42 +249,14 @@ Design patterns
 
 
 
-
- * Invoking a monitor command on a virDomainObjPtr with driver locked too
-
+ * Running asynchronous job
 
      virDomainObjPtr obj;
      qemuDomainObjPrivatePtr priv;
 
-     qemuDriverLock(driver);
      obj = virDomainFindByUUID(driver->domains, dom->uuid);
 
-     qemuDomainObjBeginJobWithDriver(obj, QEMU_JOB_TYPE);
-
-     ...do prep work...
-
-     if (virDomainObjIsActive(vm)) {
-         qemuDomainObjEnterMonitorWithDriver(driver, obj);
-         qemuMonitorXXXX(priv->mon);
-         qemuDomainObjExitMonitorWithDriver(driver, obj);
-     }
-
-     ...do final work...
-
-     qemuDomainObjEndJob(obj);
-     virDomainObjUnlock(obj);
-     qemuDriverUnlock(driver);
-
-
- * Running asynchronous job with driver lock held
-
-     virDomainObjPtr obj;
-     qemuDomainObjPrivatePtr priv;
-
-     qemuDriverLock(driver);
-     obj = virDomainFindByUUID(driver->domains, dom->uuid);
-
-     qemuDomainObjBeginAsyncJobWithDriver(obj, QEMU_ASYNC_JOB_TYPE);
+     qemuDomainObjBeginAsyncJob(obj, QEMU_ASYNC_JOB_TYPE);
      qemuDomainObjSetAsyncJobMask(obj, allowedJobs);
 
      ...do prep work...
@@ -408,7 +267,7 @@ Design patterns
          goto error;
      }
      ...start qemu job...
-     qemuDomainObjExitMonitorWithDriver(driver, obj);
+     qemuDomainObjExitMonitor(driver, obj);
 
      while (!finished) {
          if (qemuDomainObjEnterMonitorAsync(driver, obj,
@@ -417,7 +276,7 @@ Design patterns
              goto error;
          }
          ...monitor job progress...
-         qemuDomainObjExitMonitorWithDriver(driver, obj);
+         qemuDomainObjExitMonitor(driver, obj);
 
          virObjectUnlock(obj);
          sleep(aWhile);
@@ -428,7 +287,6 @@ Design patterns
 
      qemuDomainObjEndAsyncJob(obj);
      virDomainObjUnlock(obj);
-     qemuDriverUnlock(driver);
 
 
  * Coordinating with a remote server for migration
@@ -436,17 +294,16 @@ Design patterns
      virDomainObjPtr obj;
      qemuDomainObjPrivatePtr priv;
 
-     qemuDriverLock(driver);
      obj = virDomainFindByUUID(driver->domains, dom->uuid);
 
-     qemuDomainObjBeginAsyncJobWithDriver(obj, QEMU_ASYNC_JOB_TYPE);
+     qemuDomainObjBeginAsyncJob(obj, QEMU_ASYNC_JOB_TYPE);
 
      ...do prep work...
 
      if (virDomainObjIsActive(vm)) {
-         qemuDomainObjEnterRemoteWithDriver(driver, obj);
+         qemuDomainObjEnterRemote(obj);
          ...communicate with remote...
-         qemuDomainObjExitRemoteWithDriver(driver, obj);
+         qemuDomainObjExitRemote(obj);
          /* domain may have been stopped while we were talking to remote */
          if (!virDomainObjIsActive(vm)) {
              qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -458,14 +315,3 @@ Design patterns
 
      qemuDomainObjEndAsyncJob(obj);
      virDomainObjUnlock(obj);
-     qemuDriverUnlock(driver);
-
-
-Summary
--------
-
-  * Respect lock ordering rules: never lock driver if anything else is
-    already locked
-
-  * Don't hold locks in code which sleeps: unlock driver & virDomainObjPtr
-    when using monitor
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 2bd1931..5ac2004 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -523,7 +523,11 @@ no_memory:
 
 virQEMUDriverConfigPtr virQEMUDriverGetConfig(virQEMUDriverPtr driver)
 {
-    return virObjectRef(driver->config);
+    virQEMUDriverConfigPtr conf;
+    qemuDriverLock(driver);
+    conf = virObjectRef(driver->config);
+    qemuDriverUnlock(driver);
+    return conf;
 }
 
 
@@ -613,16 +617,22 @@ err_exit:
 virCapsPtr virQEMUDriverGetCapabilities(virQEMUDriverPtr driver,
                                         bool refresh)
 {
+    virCapsPtr ret = NULL;
     if (refresh) {
         virCapsPtr caps = NULL;
         if ((caps = virQEMUDriverCreateCapabilities(driver)) == NULL)
             return NULL;
 
+        qemuDriverLock(driver);
         virObjectUnref(driver->caps);
         driver->caps = caps;
+    } else {
+        qemuDriverLock(driver);
     }
 
-    return virObjectRef(driver->caps);
+    ret = virObjectRef(driver->caps);
+    qemuDriverUnlock(driver);
+    return ret;
 }
 
 
@@ -657,7 +667,9 @@ qemuDriverCloseCallbackSet(virQEMUDriverPtr driver,
 {
     char uuidstr[VIR_UUID_STRING_BUFLEN];
     qemuDriverCloseDefPtr closeDef;
+    int ret = -1;
 
+    qemuDriverLock(driver);
     virUUIDFormat(vm->def->uuid, uuidstr);
     VIR_DEBUG("vm=%s, uuid=%s, conn=%p, cb=%p",
               vm->def->name, uuidstr, conn, cb);
@@ -669,30 +681,34 @@ qemuDriverCloseCallbackSet(virQEMUDriverPtr driver,
                            _("Close callback for domain %s already registered"
                              " with another connection %p"),
                            vm->def->name, closeDef->conn);
-            return -1;
+            goto cleanup;
         }
         if (closeDef->cb && closeDef->cb != cb) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Another close callback is already defined for"
                              " domain %s"), vm->def->name);
-            return -1;
+            goto cleanup;
         }
 
         closeDef->cb = cb;
     } else {
         if (VIR_ALLOC(closeDef) < 0) {
             virReportOOMError();
-            return -1;
+            goto cleanup;
         }
 
         closeDef->conn = conn;
         closeDef->cb = cb;
         if (virHashAddEntry(driver->closeCallbacks, uuidstr, closeDef) < 0) {
             VIR_FREE(closeDef);
-            return -1;
+            goto cleanup;
         }
     }
-    return 0;
+
+    ret = 0;
+cleanup:
+    qemuDriverUnlock(driver);
+    return ret;
 }
 
 int
@@ -702,23 +718,28 @@ qemuDriverCloseCallbackUnset(virQEMUDriverPtr driver,
 {
     char uuidstr[VIR_UUID_STRING_BUFLEN];
     qemuDriverCloseDefPtr closeDef;
+    int ret = -1;
 
+    qemuDriverLock(driver);
     virUUIDFormat(vm->def->uuid, uuidstr);
     VIR_DEBUG("vm=%s, uuid=%s, cb=%p",
               vm->def->name, uuidstr, cb);
 
     closeDef = virHashLookup(driver->closeCallbacks, uuidstr);
     if (!closeDef)
-        return -1;
+        goto cleanup;
 
     if (closeDef->cb && closeDef->cb != cb) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Trying to remove mismatching close callback for"
                          " domain %s"), vm->def->name);
-        return -1;
+        goto cleanup;
     }
 
-    return virHashRemoveEntry(driver->closeCallbacks, uuidstr);
+    ret = virHashRemoveEntry(driver->closeCallbacks, uuidstr);
+cleanup:
+    qemuDriverUnlock(driver);
+    return ret;
 }
 
 qemuDriverCloseCallback
@@ -730,6 +751,7 @@ qemuDriverCloseCallbackGet(virQEMUDriverPtr driver,
     qemuDriverCloseDefPtr closeDef;
     qemuDriverCloseCallback cb = NULL;
 
+    qemuDriverLock(driver);
     virUUIDFormat(vm->def->uuid, uuidstr);
     VIR_DEBUG("vm=%s, uuid=%s, conn=%p",
               vm->def->name, uuidstr, conn);
@@ -739,6 +761,7 @@ qemuDriverCloseCallbackGet(virQEMUDriverPtr driver,
         cb = closeDef->cb;
 
     VIR_DEBUG("cb=%p", cb);
+    qemuDriverUnlock(driver);
     return cb;
 }
 
@@ -794,8 +817,9 @@ qemuDriverCloseCallbackRunAll(virQEMUDriverPtr driver,
         driver, conn
     };
     VIR_DEBUG("conn=%p", conn);
-
+    qemuDriverLock(driver);
     virHashForEach(driver->closeCallbacks, qemuDriverCloseCallbackRun, &data);
+    qemuDriverUnlock(driver);
 }
 
 /* Construct the hash key for sharedDisks as "major:minor" */
@@ -832,6 +856,7 @@ qemuAddSharedDisk(virQEMUDriverPtr driver,
     char *key = NULL;
     int ret = -1;
 
+    qemuDriverLock(driver);
     if (!(key = qemuGetSharedDiskKey(disk_path)))
         goto cleanup;
 
@@ -845,6 +870,7 @@ qemuAddSharedDisk(virQEMUDriverPtr driver,
 
     ret = 0;
 cleanup:
+    qemuDriverUnlock(driver);
     VIR_FREE(key);
     return ret;
 }
@@ -860,6 +886,7 @@ qemuRemoveSharedDisk(virQEMUDriverPtr driver,
     char *key = NULL;
     int ret = -1;
 
+    qemuDriverLock(driver);
     if (!(key = qemuGetSharedDiskKey(disk_path)))
         goto cleanup;
 
@@ -876,6 +903,7 @@ qemuRemoveSharedDisk(virQEMUDriverPtr driver,
 
     ret = 0;
 cleanup:
+    qemuDriverUnlock(driver);
     VIR_FREE(key);
     return ret;
 }
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4917721..ec4c8f8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -760,12 +760,10 @@ qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv, enum qemuDomainJob job)
 #define QEMU_JOB_WAIT_TIME (1000ull * 30)
 
 /*
- * obj must be locked before calling; driver_locked says if qemu_driver is
- * locked or not.
+ * obj must be locked before calling;
  */
 static int ATTRIBUTE_NONNULL(1)
 qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
-                              bool driver_locked,
                               virDomainObjPtr obj,
                               enum qemuDomainJob job,
                               enum qemuDomainAsyncJob asyncJob)
@@ -786,8 +784,6 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
     then = now + QEMU_JOB_WAIT_TIME;
 
     virObjectRef(obj);
-    if (driver_locked)
-        qemuDriverUnlock(driver);
 
 retry:
     if (cfg->maxQueuedJobs &&
@@ -827,12 +823,6 @@ retry:
         priv->job.start = now;
     }
 
-    if (driver_locked) {
-        virObjectUnlock(obj);
-        qemuDriverLock(driver);
-        virObjectLock(obj);
-    }
-
     if (qemuDomainTrackJob(job))
         qemuDomainObjSaveJob(driver, obj);
 
@@ -861,11 +851,6 @@ error:
         virReportSystemError(errno,
                              "%s", _("cannot acquire job mutex"));
     priv->jobs_queued--;
-    if (driver_locked) {
-        virObjectUnlock(obj);
-        qemuDriverLock(driver);
-        virObjectLock(obj);
-    }
     virObjectUnref(obj);
     virObjectUnref(cfg);
     return -1;
@@ -884,7 +869,7 @@ int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
                           virDomainObjPtr obj,
                           enum qemuDomainJob job)
 {
-    return qemuDomainObjBeginJobInternal(driver, false, obj, job,
+    return qemuDomainObjBeginJobInternal(driver, obj, job,
                                          QEMU_ASYNC_JOB_NONE);
 }
 
@@ -892,40 +877,10 @@ int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                enum qemuDomainAsyncJob asyncJob)
 {
-    return qemuDomainObjBeginJobInternal(driver, false, obj, QEMU_JOB_ASYNC,
+    return qemuDomainObjBeginJobInternal(driver, obj, QEMU_JOB_ASYNC,
                                          asyncJob);
 }
 
-/*
- * obj and driver must be locked before calling.
- *
- * This must be called by anything that will change the VM state
- * in any way, or anything that will use the QEMU monitor.
- *
- * Upon successful return, the object will have its ref count increased,
- * successful calls must be followed by EndJob eventually
- */
-int qemuDomainObjBeginJobWithDriver(virQEMUDriverPtr driver,
-                                    virDomainObjPtr obj,
-                                    enum qemuDomainJob job)
-{
-    if (job <= QEMU_JOB_NONE || job >= QEMU_JOB_ASYNC) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Attempt to start invalid job"));
-        return -1;
-    }
-
-    return qemuDomainObjBeginJobInternal(driver, true, obj, job,
-                                         QEMU_ASYNC_JOB_NONE);
-}
-
-int qemuDomainObjBeginAsyncJobWithDriver(virQEMUDriverPtr driver,
-                                         virDomainObjPtr obj,
-                                         enum qemuDomainAsyncJob asyncJob)
-{
-    return qemuDomainObjBeginJobInternal(driver, true, obj, QEMU_JOB_ASYNC,
-                                         asyncJob);
-}
 
 /*
  * obj must be locked before calling, driver does not matter
@@ -983,9 +938,17 @@ qemuDomainObjAbortAsyncJob(virDomainObjPtr obj)
     priv->job.asyncAbort = true;
 }
 
+/*
+ * obj must be locked before calling
+ *
+ * To be called immediately before any QEMU monitor API call
+ * Must have already either called qemuDomainObjBeginJob() and checked
+ * that the VM is still active; may not be used for nested async jobs.
+ *
+ * To be followed with qemuDomainObjExitMonitor() once complete
+ */
 static int
 qemuDomainObjEnterMonitorInternal(virQEMUDriverPtr driver,
-                                  bool driver_locked,
                                   virDomainObjPtr obj,
                                   enum qemuDomainAsyncJob asyncJob)
 {
@@ -1000,7 +963,7 @@ qemuDomainObjEnterMonitorInternal(virQEMUDriverPtr driver,
         if (priv->job.asyncOwner != virThreadSelfID())
             VIR_WARN("This thread doesn't seem to be the async job owner: %d",
                      priv->job.asyncOwner);
-        if (qemuDomainObjBeginJobInternal(driver, driver_locked, obj,
+        if (qemuDomainObjBeginJobInternal(driver, obj,
                                           QEMU_JOB_ASYNC_NESTED,
                                           QEMU_ASYNC_JOB_NONE) < 0)
             return -1;
@@ -1020,15 +983,12 @@ qemuDomainObjEnterMonitorInternal(virQEMUDriverPtr driver,
     virObjectRef(priv->mon);
     ignore_value(virTimeMillisNow(&priv->monStart));
     virObjectUnlock(obj);
-    if (driver_locked)
-        qemuDriverUnlock(driver);
 
     return 0;
 }
 
 static void ATTRIBUTE_NONNULL(1)
 qemuDomainObjExitMonitorInternal(virQEMUDriverPtr driver,
-                                 bool driver_locked,
                                  virDomainObjPtr obj)
 {
     qemuDomainObjPrivatePtr priv = obj->privateData;
@@ -1039,8 +999,6 @@ qemuDomainObjExitMonitorInternal(virQEMUDriverPtr driver,
     if (hasRefs)
         virObjectUnlock(priv->mon);
 
-    if (driver_locked)
-        qemuDriverLock(driver);
     virObjectLock(obj);
 
     priv->monStart = 0;
@@ -1056,59 +1014,34 @@ qemuDomainObjExitMonitorInternal(virQEMUDriverPtr driver,
     }
 }
 
-/*
- * obj must be locked before calling, driver must be unlocked
- *
- * To be called immediately before any QEMU monitor API call
- * Must have already either called qemuDomainObjBeginJob() and checked
- * that the VM is still active; may not be used for nested async jobs.
- *
- * To be followed with qemuDomainObjExitMonitor() once complete
- */
 void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver,
                                virDomainObjPtr obj)
 {
-    ignore_value(qemuDomainObjEnterMonitorInternal(driver, false, obj,
+    ignore_value(qemuDomainObjEnterMonitorInternal(driver, obj,
                                                    QEMU_ASYNC_JOB_NONE));
 }
 
-/* obj must NOT be locked before calling, driver must be unlocked
+/* obj must NOT be locked before calling
  *
  * Should be paired with an earlier qemuDomainObjEnterMonitor() call
  */
 void qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
                               virDomainObjPtr obj)
 {
-    qemuDomainObjExitMonitorInternal(driver, false, obj);
+    qemuDomainObjExitMonitorInternal(driver, obj);
 }
 
 /*
- * obj must be locked before calling, driver must be locked
- *
- * To be called immediately before any QEMU monitor API call
- * Must have already either called qemuDomainObjBeginJobWithDriver() and
- * checked that the VM is still active; may not be used for nested async jobs.
- *
- * To be followed with qemuDomainObjExitMonitorWithDriver() once complete
- */
-void qemuDomainObjEnterMonitorWithDriver(virQEMUDriverPtr driver,
-                                         virDomainObjPtr obj)
-{
-    ignore_value(qemuDomainObjEnterMonitorInternal(driver, true, obj,
-                                                   QEMU_ASYNC_JOB_NONE));
-}
-
-/*
- * obj and driver must be locked before calling
+ * obj must be locked before calling
  *
  * To be called immediately before any QEMU monitor API call.
- * Must have already either called qemuDomainObjBeginJobWithDriver()
+ * Must have already either called qemuDomainObjBeginJob()
  * and checked that the VM is still active, with asyncJob of
  * QEMU_ASYNC_JOB_NONE; or already called qemuDomainObjBeginAsyncJob,
  * with the same asyncJob.
  *
  * Returns 0 if job was started, in which case this must be followed with
- * qemuDomainObjExitMonitorWithDriver(); or -1 if the job could not be
+ * qemuDomainObjExitMonitor(); or -1 if the job could not be
  * started (probably because the vm exited in the meantime).
  */
 int
@@ -1116,26 +1049,22 @@ qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                enum qemuDomainAsyncJob asyncJob)
 {
-    return qemuDomainObjEnterMonitorInternal(driver, true, obj, asyncJob);
-}
-
-/* obj must NOT be locked before calling, driver must be unlocked,
- * and will be locked after returning
- *
- * Should be paired with an earlier qemuDomainObjEnterMonitorWithDriver() call
- */
-void qemuDomainObjExitMonitorWithDriver(virQEMUDriverPtr driver,
-                                        virDomainObjPtr obj)
-{
-    qemuDomainObjExitMonitorInternal(driver, true, obj);
+    return qemuDomainObjEnterMonitorInternal(driver, obj, asyncJob);
 }
 
 
 
-static int
-qemuDomainObjEnterAgentInternal(virQEMUDriverPtr driver,
-                                bool driver_locked,
-                                virDomainObjPtr obj)
+/*
+ * obj must be locked before calling
+ *
+ * To be called immediately before any QEMU agent API call.
+ * Must have already called qemuDomainObjBeginJob() and checked
+ * that the VM is still active.
+ *
+ * To be followed with qemuDomainObjExitAgent() once complete
+ */
+void
+qemuDomainObjEnterAgent(virDomainObjPtr obj)
 {
     qemuDomainObjPrivatePtr priv = obj->privateData;
 
@@ -1143,16 +1072,15 @@ qemuDomainObjEnterAgentInternal(virQEMUDriverPtr driver,
     virObjectRef(priv->agent);
     ignore_value(virTimeMillisNow(&priv->agentStart));
     virObjectUnlock(obj);
-    if (driver_locked)
-        qemuDriverUnlock(driver);
-
-    return 0;
 }
 
-static void ATTRIBUTE_NONNULL(1)
-qemuDomainObjExitAgentInternal(virQEMUDriverPtr driver,
-                               bool driver_locked,
-                               virDomainObjPtr obj)
+
+/* obj must NOT be locked before calling
+ *
+ * Should be paired with an earlier qemuDomainObjEnterAgent() call
+ */
+void
+qemuDomainObjExitAgent(virDomainObjPtr obj)
 {
     qemuDomainObjPrivatePtr priv = obj->privateData;
     bool hasRefs;
@@ -1162,8 +1090,6 @@ qemuDomainObjExitAgentInternal(virQEMUDriverPtr driver,
     if (hasRefs)
         virObjectUnlock(priv->agent);
 
-    if (driver_locked)
-        qemuDriverLock(driver);
     virObjectLock(obj);
 
     priv->agentStart = 0;
@@ -1171,69 +1097,14 @@ qemuDomainObjExitAgentInternal(virQEMUDriverPtr driver,
         priv->agent = NULL;
 }
 
-/*
- * obj must be locked before calling, driver must be unlocked
- *
- * To be called immediately before any QEMU agent API call.
- * Must have already called qemuDomainObjBeginJob() and checked
- * that the VM is still active.
- *
- * To be followed with qemuDomainObjExitAgent() once complete
- */
-void qemuDomainObjEnterAgent(virQEMUDriverPtr driver,
-                             virDomainObjPtr obj)
-{
-    ignore_value(qemuDomainObjEnterAgentInternal(driver, false, obj));
-}
-
-/* obj must NOT be locked before calling, driver must be unlocked
- *
- * Should be paired with an earlier qemuDomainObjEnterAgent() call
- */
-void qemuDomainObjExitAgent(virQEMUDriverPtr driver,
-                            virDomainObjPtr obj)
-{
-    qemuDomainObjExitAgentInternal(driver, false, obj);
-}
-
-/*
- * obj must be locked before calling, driver must be locked
- *
- * To be called immediately before any QEMU agent API call.
- * Must have already called qemuDomainObjBeginJobWithDriver() and
- * checked that the VM is still active; may not be used for nested async jobs.
- *
- * To be followed with qemuDomainObjExitAgentWithDriver() once complete
- */
-void qemuDomainObjEnterAgentWithDriver(virQEMUDriverPtr driver,
-                                       virDomainObjPtr obj)
-{
-    ignore_value(qemuDomainObjEnterAgentInternal(driver, true, obj));
-}
-
-/* obj must NOT be locked before calling, driver must be unlocked,
- * and will be locked after returning
- *
- * Should be paired with an earlier qemuDomainObjEnterAgentWithDriver() call
- */
-void qemuDomainObjExitAgentWithDriver(virQEMUDriverPtr driver,
-                                      virDomainObjPtr obj)
-{
-    qemuDomainObjExitAgentInternal(driver, true, obj);
-}
-
-void qemuDomainObjEnterRemoteWithDriver(virQEMUDriverPtr driver,
-                                        virDomainObjPtr obj)
+void qemuDomainObjEnterRemote(virDomainObjPtr obj)
 {
     virObjectRef(obj);
     virObjectUnlock(obj);
-    qemuDriverUnlock(driver);
 }
 
-void qemuDomainObjExitRemoteWithDriver(virQEMUDriverPtr driver,
-                                       virDomainObjPtr obj)
+void qemuDomainObjExitRemote(virDomainObjPtr obj)
 {
-    qemuDriverLock(driver);
     virObjectLock(obj);
     virObjectUnref(obj);
 }
@@ -1783,10 +1654,10 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
                 goto cleanup;
         } else {
             priv = vm->privateData;
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(driver, vm);
             /* we continue on even in the face of error */
             qemuMonitorDeleteSnapshot(priv->mon, snap->def->name);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
         }
     }
 
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 51cd2dc..cfc952d 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -190,14 +190,6 @@ int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                enum qemuDomainAsyncJob asyncJob)
     ATTRIBUTE_RETURN_CHECK;
-int qemuDomainObjBeginJobWithDriver(virQEMUDriverPtr driver,
-                                    virDomainObjPtr obj,
-                                    enum qemuDomainJob job)
-    ATTRIBUTE_RETURN_CHECK;
-int qemuDomainObjBeginAsyncJobWithDriver(virQEMUDriverPtr driver,
-                                         virDomainObjPtr obj,
-                                         enum qemuDomainAsyncJob asyncJob)
-    ATTRIBUTE_RETURN_CHECK;
 
 bool qemuDomainObjEndJob(virQEMUDriverPtr driver,
                          virDomainObjPtr obj)
@@ -224,38 +216,22 @@ void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver,
 void qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
                               virDomainObjPtr obj)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-void qemuDomainObjEnterMonitorWithDriver(virQEMUDriverPtr driver,
-                                         virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
                                    virDomainObjPtr obj,
                                    enum qemuDomainAsyncJob asyncJob)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
-void qemuDomainObjExitMonitorWithDriver(virQEMUDriverPtr driver,
-                                        virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 
-void qemuDomainObjEnterAgent(virQEMUDriverPtr driver,
-                             virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-void qemuDomainObjExitAgent(virQEMUDriverPtr driver,
-                            virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-void qemuDomainObjEnterAgentWithDriver(virQEMUDriverPtr driver,
-                                       virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-void qemuDomainObjExitAgentWithDriver(virQEMUDriverPtr driver,
-                                      virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+void qemuDomainObjEnterAgent(virDomainObjPtr obj)
+    ATTRIBUTE_NONNULL(1);
+void qemuDomainObjExitAgent(virDomainObjPtr obj)
+    ATTRIBUTE_NONNULL(1);
 
 
-void qemuDomainObjEnterRemoteWithDriver(virQEMUDriverPtr driver,
-                                        virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-void qemuDomainObjExitRemoteWithDriver(virQEMUDriverPtr driver,
-                                       virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+void qemuDomainObjEnterRemote(virDomainObjPtr obj)
+    ATTRIBUTE_NONNULL(1);
+void qemuDomainObjExitRemote(virDomainObjPtr obj)
+    ATTRIBUTE_NONNULL(1);
 
 int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
                            virDomainDefPtr vm,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a4fc0c9..4d756f3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -153,16 +153,9 @@ virQEMUDriverPtr qemu_driver = NULL;
 
 
 static void
-qemuVMDriverLock(void) {
-    qemuDriverLock(qemu_driver);
-};
-
-
+qemuVMDriverLock(void) {}
 static void
-qemuVMDriverUnlock(void) {
-    qemuDriverUnlock(qemu_driver);
-};
-
+qemuVMDriverUnlock(void) {}
 
 static int
 qemuVMFilterRebuild(virConnectPtr conn ATTRIBUTE_UNUSED,
@@ -184,61 +177,32 @@ struct qemuAutostartData {
     virConnectPtr conn;
 };
 
+
 /**
- * qemuDomObjFromDomainDriver:
+ * qemuDomObjFromDomain:
  * @domain: Domain pointer that has to be looked up
- * @drv: Pointer to virQEMUDriverPtr to return the driver object
  *
- * This function looks up @domain in the domain list and returns the
- * appropriate virDomainObjPtr. On successful lookup, both driver and domain
- * object are returned locked.
+ * This function looks up @domain and returns the appropriate
+ * virDomainObjPtr.
  *
- * Returns the domain object if it's found and the driver. Both are locked.
- * In case of failure NULL is returned and the driver isn't locked.
+ * Returns the domain object which is locked on success, NULL
+ * otherwise.
  */
 static virDomainObjPtr
-qemuDomObjFromDomainDriver(virDomainPtr domain, virQEMUDriverPtr *drv)
+qemuDomObjFromDomain(virDomainPtr domain)
 {
-    virQEMUDriverPtr driver = domain->conn->privateData;
     virDomainObjPtr vm;
+    virQEMUDriverPtr driver = domain->conn->privateData;
     char uuidstr[VIR_UUID_STRING_BUFLEN];
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
     if (!vm) {
         virUUIDFormat(domain->uuid, uuidstr);
         virReportError(VIR_ERR_NO_DOMAIN,
                        _("no domain with matching uuid '%s'"), uuidstr);
-        qemuDriverUnlock(driver);
-        *drv = NULL;
         return NULL;
     }
 
-    *drv = driver;
-    return vm;
-}
-
-/**
- * qemuDomObjFromDomain:
- * @domain: Domain pointer that has to be looked up
- *
- * This function looks up @domain and returns the appropriate
- * virDomainObjPtr. The driver is unlocked after the call.
- *
- * Returns the domain object which is locked on success, NULL
- * otherwise. The driver remains unlocked after the call.
- */
-static virDomainObjPtr
-qemuDomObjFromDomain(virDomainPtr domain)
-{
-    virDomainObjPtr vm;
-    virQEMUDriverPtr driver;
-
-    if (!(vm = qemuDomObjFromDomainDriver(domain, &driver)))
-        return NULL;
-
-    qemuDriverUnlock(driver);
-
     return vm;
 }
 
@@ -293,8 +257,8 @@ qemuAutostartDomain(virDomainObjPtr vm,
     virResetLastError();
     if (vm->autostart &&
         !virDomainObjIsActive(vm)) {
-        if (qemuDomainObjBeginJobWithDriver(data->driver, vm,
-                                            QEMU_JOB_MODIFY) < 0) {
+        if (qemuDomainObjBeginJob(data->driver, vm,
+                                  QEMU_JOB_MODIFY) < 0) {
             err = virGetLastError();
             VIR_ERROR(_("Failed to start job on VM '%s': %s"),
                       vm->def->name,
@@ -335,9 +299,7 @@ qemuAutostartDomains(virQEMUDriverPtr driver)
     /* Ignoring NULL conn which is mostly harmless here */
     struct qemuAutostartData data = { driver, conn };
 
-    qemuDriverLock(driver);
     virDomainObjListForEach(driver->domains, qemuAutostartDomain, &data);
-    qemuDriverUnlock(driver);
 
     if (conn)
         virConnectClose(conn);
@@ -603,7 +565,6 @@ qemuStartup(bool privileged,
         VIR_FREE(qemu_driver);
         return -1;
     }
-    qemuDriverLock(qemu_driver);
 
     qemu_driver->inhibitCallback = callback;
     qemu_driver->inhibitOpaque = opaque;
@@ -841,8 +802,6 @@ qemuStartup(bool privileged,
     if (!qemu_driver->workerPool)
         goto error;
 
-    qemuDriverUnlock(qemu_driver);
-
     qemuAutostartDomains(qemu_driver);
 
     if (conn)
@@ -854,8 +813,6 @@ qemuStartup(bool privileged,
 out_of_memory:
     virReportOOMError();
 error:
-    if (qemu_driver)
-        qemuDriverUnlock(qemu_driver);
     if (conn)
         virConnectClose(conn);
     VIR_FREE(driverConf);
@@ -893,7 +850,6 @@ qemuReload(void) {
     if (!qemu_driver)
         return 0;
 
-    qemuDriverLock(qemu_driver);
     if (!(caps = virQEMUDriverGetCapabilities(qemu_driver, false)))
         goto cleanup;
 
@@ -904,9 +860,7 @@ qemuReload(void) {
                                    cfg->autostartDir,
                                    0, QEMU_EXPECTED_VIRT_TYPES,
                                    qemuNotifyLoadDomain, qemu_driver);
-
 cleanup:
-    qemuDriverUnlock(qemu_driver);
     virObjectUnref(cfg);
     virObjectUnref(caps);
     return 0;
@@ -987,7 +941,6 @@ qemuShutdown(void) {
     if (!qemu_driver)
         return -1;
 
-    qemuDriverLock(qemu_driver);
     virNWFilterUnRegisterCallbackDriver(&qemuCallbackDriver);
     virObjectUnref(qemu_driver->activePciHostdevs);
     virObjectUnref(qemu_driver->inactivePciHostdevs);
@@ -1016,7 +969,6 @@ qemuShutdown(void) {
 
     virLockManagerPluginUnref(qemu_driver->lockManager);
 
-    qemuDriverUnlock(qemu_driver);
     virMutexDestroy(&qemu_driver->lock);
     virThreadPoolFree(qemu_driver->workerPool);
     VIR_FREE(qemu_driver);
@@ -1100,9 +1052,7 @@ static int qemuClose(virConnectPtr conn) {
     virQEMUDriverPtr driver = conn->privateData;
 
     /* Get rid of callbacks registered for this conn */
-    qemuDriverLock(driver);
     qemuDriverCloseCallbackRunAll(driver, conn);
-    qemuDriverUnlock(driver);
 
     conn->privateData = NULL;
 
@@ -1218,9 +1168,7 @@ static char *qemuGetCapabilities(virConnectPtr conn) {
     virCapsPtr caps = NULL;
     char *xml = NULL;
 
-    qemuDriverLock(driver);
-
-    if (!(caps = virQEMUDriverGetCapabilities(qemu_driver, true)))
+    if (!(caps = virQEMUDriverGetCapabilities(driver, true)))
         goto cleanup;
 
     if ((xml = virCapabilitiesFormatXML(caps)) == NULL)
@@ -1228,7 +1176,6 @@ static char *qemuGetCapabilities(virConnectPtr conn) {
     virObjectUnref(caps);
 
 cleanup:
-    qemuDriverUnlock(driver);
 
     return xml;
 }
@@ -1316,9 +1263,7 @@ static virDomainPtr qemuDomainLookupByID(virConnectPtr conn,
     virDomainObjPtr vm;
     virDomainPtr dom = NULL;
 
-    qemuDriverLock(driver);
     vm  = virDomainObjListFindByID(driver->domains, id);
-    qemuDriverUnlock(driver);
 
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -1341,9 +1286,7 @@ static virDomainPtr qemuDomainLookupByUUID(virConnectPtr conn,
     virDomainObjPtr vm;
     virDomainPtr dom = NULL;
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, uuid);
-    qemuDriverUnlock(driver);
 
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -1368,9 +1311,7 @@ static virDomainPtr qemuDomainLookupByName(virConnectPtr conn,
     virDomainObjPtr vm;
     virDomainPtr dom = NULL;
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByName(driver->domains, name);
-    qemuDriverUnlock(driver);
 
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -1442,7 +1383,6 @@ static int qemuGetVersion(virConnectPtr conn, unsigned long *version) {
     unsigned int qemuVersion;
     virCapsPtr caps = NULL;
 
-    qemuDriverLock(driver);
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;
 
@@ -1456,7 +1396,6 @@ static int qemuGetVersion(virConnectPtr conn, unsigned long *version) {
 
 cleanup:
     virObjectUnref(caps);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -1464,9 +1403,7 @@ static int qemuListDomains(virConnectPtr conn, int *ids, int nids) {
     virQEMUDriverPtr driver = conn->privateData;
     int n;
 
-    qemuDriverLock(driver);
     n = virDomainObjListGetActiveIDs(driver->domains, ids, nids);
-    qemuDriverUnlock(driver);
 
     return n;
 }
@@ -1475,9 +1412,7 @@ static int qemuNumDomains(virConnectPtr conn) {
     virQEMUDriverPtr driver = conn->privateData;
     int n;
 
-    qemuDriverLock(driver);
     n = virDomainObjListNumOfDomains(driver->domains, 1);
-    qemuDriverUnlock(driver);
 
     return n;
 }
@@ -1525,8 +1460,6 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char *xml,
     if (flags & VIR_DOMAIN_START_AUTODESTROY)
         start_flags |= VIR_QEMU_PROCESS_START_AUTODESROY;
 
-    qemuDriverLock(driver);
-
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;
 
@@ -1556,7 +1489,7 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char *xml,
 
     def = NULL;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup; /* XXXX free the 'vm' we created ? */
 
     if (qemuProcessStart(conn, driver, vm, NULL, -1, NULL, NULL,
@@ -1602,7 +1535,6 @@ cleanup:
     }
     virObjectUnref(caps);
     virObjectUnref(qemuCaps);
-    qemuDriverUnlock(driver);
     return dom;
 }
 
@@ -1619,7 +1551,6 @@ static int qemuDomainSuspend(virDomainPtr dom) {
     virQEMUDriverConfigPtr cfg = NULL;
     virCapsPtr caps = NULL;
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (!vm) {
@@ -1638,7 +1569,7 @@ static int qemuDomainSuspend(virDomainPtr dom) {
     cfg = virQEMUDriverGetConfig(driver);
     priv = vm->privateData;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_SUSPEND) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_SUSPEND) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -1690,7 +1621,6 @@ cleanup:
 
     if (event)
         qemuDomainEventQueue(driver, event);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
@@ -1706,7 +1636,6 @@ static int qemuDomainResume(virDomainPtr dom) {
     virQEMUDriverConfigPtr cfg = NULL;
     virCapsPtr caps = NULL;
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (!vm) {
@@ -1719,7 +1648,7 @@ static int qemuDomainResume(virDomainPtr dom) {
 
     cfg = virQEMUDriverGetConfig(driver);
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -1761,7 +1690,6 @@ cleanup:
         virObjectUnlock(vm);
     if (event)
         qemuDomainEventQueue(driver, event);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
@@ -1819,9 +1747,9 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) {
     }
 
     if (useAgent) {
-        qemuDomainObjEnterAgent(driver, vm);
+        qemuDomainObjEnterAgent(vm);
         ret = qemuAgentShutdown(priv->agent, QEMU_AGENT_SHUTDOWN_POWERDOWN);
-        qemuDomainObjExitAgent(driver, vm);
+        qemuDomainObjExitAgent(vm);
     } else {
         qemuDomainSetFakeReboot(driver, vm, false);
 
@@ -1916,9 +1844,9 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
     }
 
     if (useAgent) {
-        qemuDomainObjEnterAgent(driver, vm);
+        qemuDomainObjEnterAgent(vm);
         ret = qemuAgentShutdown(priv->agent, QEMU_AGENT_SHUTDOWN_REBOOT);
-        qemuDomainObjExitAgent(driver, vm);
+        qemuDomainObjExitAgent(vm);
     } else {
         qemuDomainObjEnterMonitor(driver, vm);
         ret = qemuMonitorSystemPowerdown(priv->mon);
@@ -2004,7 +1932,6 @@ qemuDomainDestroyFlags(virDomainPtr dom,
 
     virCheckFlags(VIR_DOMAIN_DESTROY_GRACEFUL, -1);
 
-    qemuDriverLock(driver);
     vm  = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -2030,18 +1957,18 @@ qemuDomainDestroyFlags(virDomainPtr dom,
      * it now means the job will be released
      */
     if (flags & VIR_DOMAIN_DESTROY_GRACEFUL) {
-        if (qemuProcessKill(driver, vm, 0) < 0) {
+        if (qemuProcessKill(vm, 0) < 0) {
             priv->beingDestroyed = false;
             goto cleanup;
         }
     } else {
-        if (qemuProcessKill(driver, vm, VIR_QEMU_PROCESS_KILL_FORCE) < 0) {
+        if (qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE) < 0) {
             priv->beingDestroyed = false;
             goto cleanup;
         }
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_DESTROY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_DESTROY) < 0)
         goto cleanup;
 
     priv->beingDestroyed = false;
@@ -2075,7 +2002,6 @@ cleanup:
         virObjectUnlock(vm);
     if (event)
         qemuDomainEventQueue(driver, event);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -2235,7 +2161,6 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags)
 
     virCheckFlags(0, -1);
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -2253,7 +2178,7 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags)
 
     priv = vm->privateData;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -2262,9 +2187,9 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags)
         goto endjob;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorInjectNMI(priv->mon);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
 endjob:
     if (qemuDomainObjEndJob(driver, vm) == 0) {
@@ -2275,7 +2200,6 @@ endjob:
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -2847,7 +2771,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
     if (!qemuMigrationIsAllowed(driver, vm, vm->def, false))
         goto cleanup;
 
-    if (qemuDomainObjBeginAsyncJobWithDriver(driver, vm,
+    if (qemuDomainObjBeginAsyncJob(driver, vm,
                                              QEMU_ASYNC_JOB_SAVE) < 0)
 
     memset(&priv->job.info, 0, sizeof(priv->job.info));
@@ -2975,8 +2899,6 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
                   VIR_DOMAIN_SAVE_RUNNING |
                   VIR_DOMAIN_SAVE_PAUSED, -1);
 
-    qemuDriverLock(driver);
-
     cfg = virQEMUDriverGetConfig(driver);
     if (cfg->saveImageFormat == NULL)
         compressed = QEMU_SAVE_FORMAT_RAW;
@@ -3018,7 +2940,6 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(cfg);
     return ret;
 }
@@ -3048,7 +2969,7 @@ qemuDomainManagedSavePath(virQEMUDriverPtr driver, virDomainObjPtr vm)
 static int
 qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
 {
-    virQEMUDriverPtr driver;
+    virQEMUDriverPtr driver = dom->conn->privateData;
     virDomainObjPtr vm;
     char *name = NULL;
     int ret = -1;
@@ -3058,7 +2979,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
                   VIR_DOMAIN_SAVE_RUNNING |
                   VIR_DOMAIN_SAVE_PAUSED, -1);
 
-    if (!(vm = qemuDomObjFromDomainDriver(dom, &driver)))
+    if (!(vm = qemuDomObjFromDomain(dom)))
         return -1;
 
     if (!virDomainObjIsActive(vm)) {
@@ -3087,7 +3008,6 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     VIR_FREE(name);
 
     return ret;
@@ -3135,14 +3055,14 @@ qemuDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
 static int
 qemuDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
 {
-    virQEMUDriverPtr driver;
+    virQEMUDriverPtr driver = dom->conn->privateData;
     virDomainObjPtr vm;
     int ret = -1;
     char *name = NULL;
 
     virCheckFlags(0, -1);
 
-    if (!(vm = qemuDomObjFromDomainDriver(dom, &driver)))
+    if (!(vm = qemuDomObjFromDomain(dom)))
         return -1;
 
     if (!(name = qemuDomainManagedSavePath(driver, vm)))
@@ -3161,7 +3081,6 @@ qemuDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
 cleanup:
     VIR_FREE(name);
     virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -3187,7 +3106,7 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm,
         return -1;
 
     ret = qemuMonitorDumpToFd(priv->mon, fd);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     return ret;
 }
@@ -3305,7 +3224,6 @@ static int qemuDomainCoreDump(virDomainPtr dom,
                   VIR_DUMP_BYPASS_CACHE | VIR_DUMP_RESET |
                   VIR_DUMP_MEMORY_ONLY, -1);
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (!vm) {
@@ -3316,7 +3234,7 @@ static int qemuDomainCoreDump(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginAsyncJobWithDriver(driver, vm,
+    if (qemuDomainObjBeginAsyncJob(driver, vm,
                                              QEMU_ASYNC_JOB_DUMP) < 0)
         goto cleanup;
 
@@ -3367,9 +3285,9 @@ endjob:
              virDomainObjIsActive(vm)) {
         if ((ret == 0) && (flags & VIR_DUMP_RESET)) {
             priv =  vm->privateData;
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(driver, vm);
             ret = qemuMonitorSystemReset(priv->mon);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
         }
 
         if (resume && qemuProcessStartCPUs(driver, vm, dom->conn,
@@ -3396,7 +3314,6 @@ cleanup:
         virObjectUnlock(vm);
     if (event)
         qemuDomainEventQueue(driver, event);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -3497,7 +3414,6 @@ static void processWatchdogEvent(void *data, void *opaque)
     virQEMUDriverPtr driver = opaque;
     virQEMUDriverConfigPtr cfg;
 
-    qemuDriverLock(driver);
     virObjectLock(wdEvent->vm);
     cfg = virQEMUDriverGetConfig(driver);
 
@@ -3515,7 +3431,7 @@ static void processWatchdogEvent(void *data, void *opaque)
                 goto unlock;
             }
 
-            if (qemuDomainObjBeginAsyncJobWithDriver(driver, wdEvent->vm,
+            if (qemuDomainObjBeginAsyncJob(driver, wdEvent->vm,
                                                      QEMU_ASYNC_JOB_DUMP) < 0) {
                 VIR_FREE(dumpfile);
                 goto unlock;
@@ -3559,7 +3475,6 @@ endjob:
 unlock:
     virObjectUnlock(wdEvent->vm);
     virObjectUnref(wdEvent->vm);
-    qemuDriverUnlock(driver);
     VIR_FREE(wdEvent);
     virObjectUnref(cfg);
 }
@@ -4517,7 +4432,6 @@ static int qemuDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secl
     virDomainObjPtr vm;
     int ret = -1;
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     memset(seclabel, 0, sizeof(*seclabel));
@@ -4565,7 +4479,6 @@ static int qemuDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secl
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -4577,7 +4490,6 @@ static int qemuDomainGetSecurityLabelList(virDomainPtr dom,
     int i, ret = -1;
 
     /* Protect domain data with qemu lock */
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (!vm) {
@@ -4638,9 +4550,10 @@ static int qemuDomainGetSecurityLabelList(virDomainPtr dom,
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return ret;
 }
+
+
 static int qemuNodeGetSecurityModel(virConnectPtr conn,
                                     virSecurityModelPtr secmodel)
 {
@@ -4649,7 +4562,6 @@ static int qemuNodeGetSecurityModel(virConnectPtr conn,
     int ret = 0;
     virCapsPtr caps = NULL;
 
-    qemuDriverLock(driver);
     memset(secmodel, 0, sizeof(*secmodel));
 
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
@@ -4681,7 +4593,6 @@ static int qemuNodeGetSecurityModel(virConnectPtr conn,
     strcpy(secmodel->doi, p);
 
 cleanup:
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     return ret;
 }
@@ -4988,7 +4899,6 @@ qemuDomainRestoreFlags(virConnectPtr conn,
                   VIR_DOMAIN_SAVE_RUNNING |
                   VIR_DOMAIN_SAVE_PAUSED, -1);
 
-    qemuDriverLock(driver);
 
     if (flags & VIR_DOMAIN_SAVE_RUNNING)
         state = 1;
@@ -5013,7 +4923,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
         goto cleanup;
     def = NULL;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, &header, path,
@@ -5035,7 +4945,6 @@ cleanup:
     if (vm)
         virObjectUnlock(vm);
     virObjectUnref(caps);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -5059,8 +4968,6 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path,
     /* We only take subset of virDomainDefFormat flags.  */
     virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL);
 
-    qemuDriverLock(driver);
-
     fd = qemuDomainSaveImageOpen(driver, path, &def, &header, false, NULL,
                                  NULL, -1, false, false);
 
@@ -5072,7 +4979,6 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path,
 cleanup:
     virDomainDefFree(def);
     VIR_FORCE_CLOSE(fd);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -5092,8 +4998,6 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
     virCheckFlags(VIR_DOMAIN_SAVE_RUNNING |
                   VIR_DOMAIN_SAVE_PAUSED, -1);
 
-    qemuDriverLock(driver);
-
     if (flags & VIR_DOMAIN_SAVE_RUNNING)
         state = 1;
     else if (flags & VIR_DOMAIN_SAVE_PAUSED)
@@ -5144,7 +5048,6 @@ cleanup:
     virDomainDefFree(def);
     VIR_FORCE_CLOSE(fd);
     VIR_FREE(xml);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -5215,7 +5118,6 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom,
 
     /* Flags checked by virDomainDefFormat */
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (!vm) {
@@ -5236,7 +5138,7 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom,
         /* Don't delay if someone's using the monitor, just use
          * existing most recent data instead */
         if (qemuDomainJobAllowed(priv, QEMU_JOB_QUERY)) {
-            if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_QUERY) < 0)
+            if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
                 goto cleanup;
 
             if (!virDomainObjIsActive(vm)) {
@@ -5245,9 +5147,9 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom,
                 goto endjob;
             }
 
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(driver, vm);
             err = qemuMonitorGetBalloonInfo(priv->mon, &balloon);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
 
 endjob:
             if (qemuDomainObjEndJob(driver, vm) == 0) {
@@ -5270,7 +5172,6 @@ endjob:
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -5293,14 +5194,11 @@ static char *qemuDomainXMLFromNative(virConnectPtr conn,
         goto cleanup;
     }
 
-    qemuDriverLock(driver);
-
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;
 
     def = qemuParseCommandLineString(caps, config,
                                      NULL, NULL, NULL);
-    qemuDriverUnlock(driver);
     if (!def)
         goto cleanup;
 
@@ -5336,7 +5234,6 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
 
     virCheckFlags(0, NULL);
 
-    qemuDriverLock(driver);
     cfg = virQEMUDriverGetConfig(driver);
 
     if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
@@ -5444,7 +5341,6 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
     ret = virCommandToString(cmd);
 
 cleanup:
-    qemuDriverUnlock(driver);
 
     virObjectUnref(qemuCaps);
     virCommandFree(cmd);
@@ -5460,9 +5356,7 @@ static int qemuListDefinedDomains(virConnectPtr conn,
     virQEMUDriverPtr driver = conn->privateData;
     int n;
 
-    qemuDriverLock(driver);
     n = virDomainObjListGetInactiveNames(driver->domains, names, nnames);
-    qemuDriverUnlock(driver);
     return n;
 }
 
@@ -5470,9 +5364,7 @@ static int qemuNumDefinedDomains(virConnectPtr conn) {
     virQEMUDriverPtr driver = conn->privateData;
     int n;
 
-    qemuDriverLock(driver);
     n = virDomainObjListNumOfDomains(driver->domains, 0);
-    qemuDriverUnlock(driver);
 
     return n;
 }
@@ -5567,7 +5459,6 @@ qemuDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
                   VIR_DOMAIN_START_BYPASS_CACHE |
                   VIR_DOMAIN_START_FORCE_BOOT, -1);
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (!vm) {
@@ -5578,7 +5469,7 @@ qemuDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (virDomainObjIsActive(vm)) {
@@ -5599,7 +5490,6 @@ endjob:
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -5620,7 +5510,6 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char *xml) {
     virQEMUDriverConfigPtr cfg;
     virCapsPtr caps = NULL;
 
-    qemuDriverLock(driver);
     cfg = virQEMUDriverGetConfig(driver);
 
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
@@ -5697,7 +5586,6 @@ cleanup:
     if (event)
         qemuDomainEventQueue(driver, event);
     virObjectUnref(qemuCaps);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return dom;
@@ -5718,7 +5606,6 @@ qemuDomainUndefineFlags(virDomainPtr dom,
     virCheckFlags(VIR_DOMAIN_UNDEFINE_MANAGED_SAVE |
                   VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA, -1);
 
-    qemuDriverLock(driver);
     cfg = virQEMUDriverGetConfig(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
@@ -5797,7 +5684,6 @@ cleanup:
         virObjectUnlock(vm);
     if (event)
         qemuDomainEventQueue(driver, event);
-    qemuDriverUnlock(driver);
     virObjectUnref(cfg);
     return ret;
 }
@@ -6446,7 +6332,6 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
 
     affect = flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG);
 
-    qemuDriverLock(driver);
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;
 
@@ -6460,7 +6345,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
     }
     priv = vm->privateData;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (virDomainObjIsActive(vm)) {
@@ -6588,7 +6473,6 @@ cleanup:
     virDomainDeviceDefFree(dev);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
@@ -6651,7 +6535,6 @@ static int qemuDomainSetAutostart(virDomainPtr dom,
     int ret = -1;
     virQEMUDriverConfigPtr cfg = NULL;
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     cfg = virQEMUDriverGetConfig(driver);
     if (!vm) {
@@ -6708,7 +6591,6 @@ cleanup:
     VIR_FREE(autostartLink);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(cfg);
     return ret;
 }
@@ -6754,7 +6636,6 @@ static char *qemuGetSchedulerType(virDomainPtr dom,
     char *ret = NULL;
     int rc;
 
-    qemuDriverLock(driver);
     if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
         virReportError(VIR_ERR_OPERATION_INVALID,
                        "%s", _("cgroup CPU controller is not mounted"));
@@ -6776,7 +6657,6 @@ static char *qemuGetSchedulerType(virDomainPtr dom,
         virReportOOMError();
 
 cleanup:
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -6933,7 +6813,6 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
                                        NULL) < 0)
         return -1;
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     if (vm == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -7061,7 +6940,6 @@ cleanup:
     virCgroupFree(&group);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
@@ -7086,7 +6964,6 @@ qemuDomainGetBlkioParameters(virDomainPtr dom,
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG |
                   VIR_TYPED_PARAM_STRING_OKAY, -1);
-    qemuDriverLock(driver);
 
     /* We blindly return a string, and let libvirt.c and
      * remote_driver.c do the filtering on behalf of older clients
@@ -7254,7 +7131,6 @@ cleanup:
     if (vm)
         virObjectUnlock(vm);
     virObjectUnref(caps);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -7292,8 +7168,6 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
                                        NULL) < 0)
         return -1;
 
-    qemuDriverLock(driver);
-
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (vm == NULL) {
@@ -7429,7 +7303,6 @@ cleanup:
     virCgroupFree(&group);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
@@ -7454,8 +7327,6 @@ qemuDomainGetMemoryParameters(virDomainPtr dom,
                   VIR_DOMAIN_AFFECT_CONFIG |
                   VIR_TYPED_PARAM_STRING_OKAY, -1);
 
-    qemuDriverLock(driver);
-
     /* We don't return strings, and thus trivially support this flag.  */
     flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
 
@@ -7596,7 +7467,6 @@ cleanup:
     if (vm)
         virObjectUnlock(vm);
     virObjectUnref(caps);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -7625,8 +7495,6 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
                                        NULL) < 0)
         return -1;
 
-    qemuDriverLock(driver);
-
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (vm == NULL) {
@@ -7751,7 +7619,6 @@ cleanup:
     virCgroupFree(&group);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
@@ -7777,8 +7644,6 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
                   VIR_DOMAIN_AFFECT_CONFIG |
                   VIR_TYPED_PARAM_STRING_OKAY, -1);
 
-    qemuDriverLock(driver);
-
     /* We blindly return a string, and let libvirt.c and
      * remote_driver.c do the filtering on behalf of older clients
      * that can't parse it.  */
@@ -7871,7 +7736,6 @@ cleanup:
     if (vm)
         virObjectUnlock(vm);
     virObjectUnref(caps);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -7993,8 +7857,6 @@ qemuSetSchedulerParametersFlags(virDomainPtr dom,
                                        NULL) < 0)
         return -1;
 
-    qemuDriverLock(driver);
-
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (vm == NULL) {
@@ -8129,7 +7991,6 @@ cleanup:
     virCgroupFree(&group);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
@@ -8274,8 +8135,6 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
                   VIR_DOMAIN_AFFECT_CONFIG |
                   VIR_TYPED_PARAM_STRING_OKAY, -1);
 
-    qemuDriverLock(driver);
-
     /* We don't return strings, and thus trivially support this flag.  */
     flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
 
@@ -8395,7 +8254,6 @@ cleanup:
     if (vm)
         virObjectUnlock(vm);
     virObjectUnref(caps);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -8821,7 +8679,6 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
                                        NULL) < 0)
         return -1;
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
 
     if (vm == NULL) {
@@ -8962,7 +8819,6 @@ cleanup:
     virCgroupFree(&group);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
@@ -8989,8 +8845,6 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom,
                   VIR_DOMAIN_AFFECT_CONFIG |
                   VIR_TYPED_PARAM_STRING_OKAY, -1);
 
-    qemuDriverLock(driver);
-
     flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
 
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
@@ -9091,7 +8945,6 @@ cleanup:
     if (vm)
         virObjectUnlock(vm);
     virObjectUnref(caps);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -9452,11 +9305,9 @@ qemuDomainEventRegister(virConnectPtr conn,
     virQEMUDriverPtr driver = conn->privateData;
     int ret;
 
-    qemuDriverLock(driver);
     ret = virDomainEventStateRegister(conn,
                                       driver->domainEventState,
                                       callback, opaque, freecb);
-    qemuDriverUnlock(driver);
 
     return ret;
 }
@@ -9469,11 +9320,9 @@ qemuDomainEventDeregister(virConnectPtr conn,
     virQEMUDriverPtr driver = conn->privateData;
     int ret;
 
-    qemuDriverLock(driver);
     ret = virDomainEventStateDeregister(conn,
                                         driver->domainEventState,
                                         callback);
-    qemuDriverUnlock(driver);
 
     return ret;
 }
@@ -9490,13 +9339,11 @@ qemuDomainEventRegisterAny(virConnectPtr conn,
     virQEMUDriverPtr driver = conn->privateData;
     int ret;
 
-    qemuDriverLock(driver);
     if (virDomainEventStateRegisterID(conn,
                                       driver->domainEventState,
                                       dom, eventID,
                                       callback, opaque, freecb, &ret) < 0)
         ret = -1;
-    qemuDriverUnlock(driver);
 
     return ret;
 }
@@ -9509,11 +9356,9 @@ qemuDomainEventDeregisterAny(virConnectPtr conn,
     virQEMUDriverPtr driver = conn->privateData;
     int ret;
 
-    qemuDriverLock(driver);
     ret = virDomainEventStateDeregisterID(conn,
                                           driver->domainEventState,
                                           callbackID);
-    qemuDriverUnlock(driver);
 
     return ret;
 }
@@ -9541,8 +9386,6 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
 
     virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
 
-    qemuDriverLock(driver);
-
     if (!dom_xml) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("no domain XML passed"));
@@ -9571,7 +9414,6 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
                                      st, dname, dom_xml, flags);
 
 cleanup:
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -9597,8 +9439,6 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
 
     *uri_out = NULL;
 
-    qemuDriverLock(driver);
-
     if (virLockManagerPluginUsesState(driver->lockManager)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Cannot use migrate v2 protocol with lock manager %s"),
@@ -9631,7 +9471,6 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
                                      dname, dom_xml, flags);
 
 cleanup:
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -9653,7 +9492,6 @@ qemuDomainMigratePerform(virDomainPtr dom,
 
     virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
 
-    qemuDriverLock(driver);
     if (virLockManagerPluginUsesState(driver->lockManager)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Cannot use migrate v2 protocol with lock manager %s"),
@@ -9687,7 +9525,6 @@ qemuDomainMigratePerform(virDomainPtr dom,
                                flags, dname, resource, false);
 
 cleanup:
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -9708,7 +9545,6 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
 
     virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByName(driver->domains, dname);
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -9725,7 +9561,6 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
                               flags, retcode, false);
 
 cleanup:
-    qemuDriverUnlock(driver);
     return dom;
 }
 
@@ -9750,7 +9585,6 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
 
     virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -9765,7 +9599,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
             goto cleanup;
         asyncJob = QEMU_ASYNC_JOB_MIGRATION_OUT;
     } else {
-        if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+        if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
             goto cleanup;
         asyncJob = QEMU_ASYNC_JOB_NONE;
     }
@@ -9811,7 +9645,6 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return xml;
 
 endjob:
@@ -9845,7 +9678,6 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
 
     *uri_out = NULL;
 
-    qemuDriverLock(driver);
     if (flags & VIR_MIGRATE_TUNNELLED) {
         /* this is a logical error; we never should have gotten here with
          * VIR_MIGRATE_TUNNELLED set
@@ -9868,7 +9700,6 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
                                      dname, dom_xml, flags);
 
 cleanup:
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -9906,12 +9737,10 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
         goto cleanup;
     }
 
-    qemuDriverLock(driver);
     ret = qemuMigrationPrepareTunnel(driver, dconn,
                                      cookiein, cookieinlen,
                                      cookieout, cookieoutlen,
                                      st, dname, dom_xml, flags);
-    qemuDriverUnlock(driver);
 
 cleanup:
     return ret;
@@ -9937,7 +9766,6 @@ qemuDomainMigratePerform3(virDomainPtr dom,
 
     virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -9953,7 +9781,6 @@ qemuDomainMigratePerform3(virDomainPtr dom,
                                flags, dname, resource, true);
 
 cleanup:
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -9976,7 +9803,6 @@ qemuDomainMigrateFinish3(virConnectPtr dconn,
 
     virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByName(driver->domains, dname);
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -9990,7 +9816,6 @@ qemuDomainMigrateFinish3(virConnectPtr dconn,
                               flags, cancelled, true);
 
 cleanup:
-    qemuDriverUnlock(driver);
     return dom;
 }
 
@@ -10009,7 +9834,6 @@ qemuDomainMigrateConfirm3(virDomainPtr domain,
 
     virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
 
-    qemuDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -10049,7 +9873,6 @@ qemuDomainMigrateConfirm3(virDomainPtr domain,
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(cfg);
     return ret;
 }
@@ -10117,7 +9940,6 @@ qemuNodeDeviceDettach(virNodeDevicePtr dev)
     if (!pci)
         return -1;
 
-    qemuDriverLock(driver);
     virObjectLock(driver->activePciHostdevs);
     virObjectLock(driver->inactivePciHostdevs);
     in_inactive_list = virPCIDeviceListFind(driver->inactivePciHostdevs, pci);
@@ -10130,7 +9952,6 @@ qemuNodeDeviceDettach(virNodeDevicePtr dev)
 out:
     virObjectUnlock(driver->inactivePciHostdevs);
     virObjectUnlock(driver->activePciHostdevs);
-    qemuDriverUnlock(driver);
     if (in_inactive_list)
         virPCIDeviceFree(pci);
     return ret;
@@ -10152,7 +9973,6 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
     if (!pci)
         return -1;
 
-    qemuDriverLock(driver);
     virObjectLock(driver->activePciHostdevs);
     virObjectLock(driver->inactivePciHostdevs);
     other = virPCIDeviceListFind(driver->activePciHostdevs, pci);
@@ -10180,7 +10000,6 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
 out:
     virObjectUnlock(driver->inactivePciHostdevs);
     virObjectUnlock(driver->activePciHostdevs);
-    qemuDriverUnlock(driver);
     virPCIDeviceFree(pci);
     return ret;
 }
@@ -10200,7 +10019,6 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
     if (!pci)
         return -1;
 
-    qemuDriverLock(driver);
     virObjectLock(driver->activePciHostdevs);
     virObjectLock(driver->inactivePciHostdevs);
 
@@ -10212,7 +10030,6 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
 out:
     virObjectUnlock(driver->inactivePciHostdevs);
     virObjectUnlock(driver->activePciHostdevs);
-    qemuDriverUnlock(driver);
     virPCIDeviceFree(pci);
     return ret;
 }
@@ -10228,8 +10045,6 @@ qemuCPUCompare(virConnectPtr conn,
 
     virCheckFlags(0, VIR_CPU_COMPARE_ERROR);
 
-    qemuDriverLock(driver);
-
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;
 
@@ -10243,7 +10058,6 @@ qemuCPUCompare(virConnectPtr conn,
 
 cleanup:
     virObjectUnref(caps);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -10538,8 +10352,7 @@ cleanup:
 
 /* this function expects the driver lock to be held by the caller */
 static int
-qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver,
-                           virDomainObjPtr vm) {
+qemuDomainSnapshotFSFreeze(virDomainObjPtr vm) {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     int freezed;
 
@@ -10555,16 +10368,15 @@ qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver,
         return -1;
     }
 
-    qemuDomainObjEnterAgentWithDriver(driver, vm);
+    qemuDomainObjEnterAgent(vm);
     freezed = qemuAgentFSFreeze(priv->agent);
-    qemuDomainObjExitAgentWithDriver(driver, vm);
+    qemuDomainObjExitAgent(vm);
 
     return freezed;
 }
 
 static int
-qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver,
-                         virDomainObjPtr vm, bool report)
+qemuDomainSnapshotFSThaw(virDomainObjPtr vm, bool report)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     int thawed;
@@ -10584,13 +10396,13 @@ qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver,
         return -1;
     }
 
-    qemuDomainObjEnterAgent(driver, vm);
+    qemuDomainObjEnterAgent(vm);
     if (!report)
         err = virSaveLastError();
     thawed = qemuAgentFSThaw(priv->agent);
     if (!report)
         virSetError(err);
-    qemuDomainObjExitAgent(driver, vm);
+    qemuDomainObjExitAgent(vm);
 
     virFreeError(err);
     return thawed;
@@ -10734,7 +10546,7 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn,
     bool resume = false;
     int ret = -1;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         return -1;
 
     if (!virDomainObjIsActive(vm)) {
@@ -10760,9 +10572,9 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn,
         }
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorCreateSnapshot(priv->mon, snap->def->name);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
     if (ret < 0)
         goto cleanup;
 
@@ -11199,7 +11011,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
             }
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
 cleanup:
     virCgroupFree(&cgroup);
@@ -11235,7 +11047,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
     int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */
     bool pmsuspended = false;
 
-    if (qemuDomainObjBeginAsyncJobWithDriver(driver, vm,
+    if (qemuDomainObjBeginAsyncJob(driver, vm,
                                              QEMU_ASYNC_JOB_SNAPSHOT) < 0)
         goto cleanup;
 
@@ -11244,7 +11056,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
      * fail if the guest is paused or the guest agent is not
      * running.  */
     if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) {
-        if (qemuDomainSnapshotFSFreeze(driver, vm) < 0) {
+        if (qemuDomainSnapshotFSFreeze(vm) < 0) {
             /* helper reported the error */
             thaw = -1;
             goto endjob;
@@ -11375,7 +11187,7 @@ endjob:
         goto cleanup;
     }
     if (vm && thaw != 0 &&
-        qemuDomainSnapshotFSThaw(driver, vm, thaw > 0) < 0) {
+        qemuDomainSnapshotFSThaw(vm, thaw > 0) < 0) {
         /* helper reported the error, if it was needed */
         if (thaw > 0)
             ret = -1;
@@ -11441,7 +11253,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
     if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE)
         parse_flags |= VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE;
 
-    qemuDriverLock(driver);
     virUUIDFormat(domain->uuid, uuidstr);
     vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
     if (!vm) {
@@ -11776,7 +11587,6 @@ cleanup:
     }
     virDomainSnapshotDefFree(def);
     VIR_FREE(xml);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return snapshot;
@@ -12149,7 +11959,6 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
      * and use of FORCE can cause multiple transitions.
      */
 
-    qemuDriverLock(driver);
     virUUIDFormat(snapshot->domain->uuid, uuidstr);
     vm = virDomainObjListFindByUUID(driver->domains, snapshot->domain->uuid);
     if (!vm) {
@@ -12229,7 +12038,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
             goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (snap->def->state == VIR_DOMAIN_RUNNING
@@ -12290,9 +12099,9 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
                     goto endjob;
                 }
             }
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(driver, vm);
             rc = qemuMonitorLoadSnapshot(priv->mon, snap->def->name);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             if (rc < 0) {
                 /* XXX resume domain if it was running before the
                  * failed loadvm attempt? */
@@ -12451,7 +12260,6 @@ cleanup:
     }
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
 
@@ -12520,7 +12328,6 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
                   VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY |
                   VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, -1);
 
-    qemuDriverLock(driver);
     virUUIDFormat(snapshot->domain->uuid, uuidstr);
     vm = virDomainObjListFindByUUID(driver->domains, snapshot->domain->uuid);
     if (!vm) {
@@ -12549,7 +12356,7 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
         }
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (flags & (VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN |
@@ -12611,7 +12418,6 @@ endjob:
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(cfg);
     return ret;
 }
@@ -12684,8 +12490,6 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn,
 
     virCheckFlags(0, NULL);
 
-    qemuDriverLock(driver);
-
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;
 
@@ -12732,7 +12536,7 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn,
 
     def = NULL;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (qemuProcessAttach(conn, driver, vm, pid,
@@ -12758,7 +12562,6 @@ cleanup:
     virDomainChrSourceDefFree(monConfig);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     VIR_FREE(pidfile);
     virObjectUnref(caps);
     return dom;
@@ -12971,10 +12774,10 @@ qemuDomainBlockPivot(virConnectPtr conn,
 
     /* Probe the status, if needed.  */
     if (!disk->mirroring) {
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(driver, vm);
         ret = qemuMonitorBlockJob(priv->mon, device, NULL, 0, &info,
                                   BLOCK_JOB_INFO, true);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         if (ret < 0)
             goto cleanup;
         if (!virDomainObjIsActive(vm)) {
@@ -13056,9 +12859,9 @@ qemuDomainBlockPivot(virConnectPtr conn,
     }
 
     /* Attempt the pivot.  */
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorDrivePivot(priv->mon, device, disk->mirror, format);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     if (ret == 0) {
         /* XXX We want to revoke security labels and disk lease, as
@@ -13127,7 +12930,6 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
     int idx;
     virDomainDiskDefPtr disk;
 
-    qemuDriverLock(driver);
     virUUIDFormat(dom->uuid, uuidstr);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     if (!vm) {
@@ -13180,7 +12982,7 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -13195,13 +12997,13 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
         goto endjob;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     /* XXX - libvirt should really be tracking the backing file chain
      * itself, and validating that base is on the chain, rather than
      * relying on qemu to do this.  */
     ret = qemuMonitorBlockJob(priv->mon, device, base, bandwidth, info, mode,
                               async);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
     if (ret < 0)
         goto endjob;
 
@@ -13239,20 +13041,18 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
                                               .tv_nsec = 50 * 1000 * 1000ull };
                 virDomainBlockJobInfo dummy;
 
-                qemuDomainObjEnterMonitorWithDriver(driver, vm);
+                qemuDomainObjEnterMonitor(driver, vm);
                 ret = qemuMonitorBlockJob(priv->mon, device, NULL, 0, &dummy,
                                           BLOCK_JOB_INFO, async);
-                qemuDomainObjExitMonitorWithDriver(driver, vm);
+                qemuDomainObjExitMonitor(driver, vm);
 
                 if (ret <= 0)
                     break;
 
                 virObjectUnlock(vm);
-                qemuDriverUnlock(driver);
 
                 nanosleep(&ts, NULL);
 
-                qemuDriverLock(driver);
                 virObjectLock(vm);
 
                 if (!virDomainObjIsActive(vm)) {
@@ -13277,7 +13077,6 @@ cleanup:
         virObjectUnlock(vm);
     if (event)
         qemuDomainEventQueue(driver, event);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -13685,7 +13484,6 @@ qemuDomainOpenGraphics(virDomainPtr dom,
 
     virCheckFlags(VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH, -1);
 
-    qemuDriverLock(driver);
     virUUIDFormat(dom->uuid, uuidstr);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     if (!vm) {
@@ -13721,12 +13519,12 @@ qemuDomainOpenGraphics(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorOpenGraphics(priv->mon, protocol, fd, "graphicsfd",
                                   (flags & VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH) != 0);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
     if (qemuDomainObjEndJob(driver, vm) == 0) {
         vm = NULL;
         goto cleanup;
@@ -13735,7 +13533,6 @@ qemuDomainOpenGraphics(virDomainPtr dom,
 cleanup:
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -13782,7 +13579,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
 
     memset(&info, 0, sizeof(info));
 
-    qemuDriverLock(driver);
     virUUIDFormat(dom->uuid, uuidstr);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     if (!vm) {
@@ -13808,7 +13604,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (virDomainLiveConfigHelperMethod(caps, vm, &flags,
@@ -13873,9 +13669,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
             info.read_iops_sec = oldinfo->read_iops_sec;
             info.write_iops_sec = oldinfo->write_iops_sec;
         }
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(driver, vm);
         ret = qemuMonitorSetBlockIoThrottle(priv->mon, device, &info);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         if (ret < 0)
             goto endjob;
         vm->def->disks[idx]->blkdeviotune = info;
@@ -13914,7 +13710,6 @@ cleanup:
     VIR_FREE(device);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
@@ -13945,7 +13740,6 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
     /* We don't return strings, and thus trivially support this flag.  */
     flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
 
-    qemuDriverLock(driver);
     virUUIDFormat(dom->uuid, uuidstr);
     vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     if (!vm) {
@@ -13970,7 +13764,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
     if (virDomainLiveConfigHelperMethod(caps, vm, &flags,
@@ -13979,9 +13773,9 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
 
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
         priv = vm->privateData;
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(driver, vm);
         ret = qemuMonitorGetBlockIoThrottle(priv->mon, device, &reply);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         if (ret < 0)
             goto endjob;
     }
@@ -14057,7 +13851,6 @@ cleanup:
     if (vm)
         virObjectUnlock(vm);
     virObjectUnref(caps);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -14536,8 +14329,6 @@ qemuDomainGetCPUStats(virDomainPtr domain,
 
     virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
 
-    qemuDriverLock(driver);
-
     vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
     if (vm == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -14573,7 +14364,6 @@ cleanup:
     virCgroupFree(&group);
     if (vm)
         virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
@@ -14664,9 +14454,9 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
         goto endjob;
     }
 
-    qemuDomainObjEnterAgent(driver, vm);
+    qemuDomainObjEnterAgent(vm);
     ret = qemuAgentSuspend(priv->agent, target);
-    qemuDomainObjExitAgent(driver, vm);
+    qemuDomainObjExitAgent(vm);
 
 endjob:
     if (qemuDomainObjEndJob(driver, vm) == 0)
@@ -14734,9 +14524,7 @@ qemuListAllDomains(virConnectPtr conn,
 
     virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
 
-    qemuDriverLock(driver);
     ret = virDomainObjListExport(driver->domains, conn, domains, flags);
-    qemuDriverUnlock(driver);
 
     return ret;
 }
@@ -14788,9 +14576,9 @@ qemuDomainAgentCommand(virDomainPtr domain,
         goto endjob;
     }
 
-    qemuDomainObjEnterAgent(driver, vm);
+    qemuDomainObjEnterAgent(vm);
     ret = qemuAgentArbitraryCommand(priv->agent, cmd, &result, timeout);
-    qemuDomainObjExitAgent(driver, vm);
+    qemuDomainObjExitAgent(vm);
     if (ret < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Failed to execute agent command"));
@@ -14861,9 +14649,9 @@ qemuDomainFSTrim(virDomainPtr dom,
         goto endjob;
     }
 
-    qemuDomainObjEnterAgent(driver, vm);
+    qemuDomainObjEnterAgent(vm);
     ret = qemuAgentFSTrim(priv->agent, minimum);
-    qemuDomainObjExitAgent(driver, vm);
+    qemuDomainObjExitAgent(vm);
 
 endjob:
     if (qemuDomainObjEndJob(driver, vm) == 0)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0c28a6a..488a440 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -107,7 +107,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
     if (!(driveAlias = qemuDeviceDriveHostAlias(origdisk, priv->qemuCaps)))
         goto error;
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorEjectMedia(priv->mon, driveAlias, force);
 
     /* we don't want to report errors from media tray_open polling */
@@ -144,7 +144,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
                                      disk->src, format);
     }
 exit_monitor:
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     virDomainAuditDisk(vm, origdisk->src, disk->src, "update", ret >= 0);
 
@@ -194,7 +194,7 @@ qemuDomainCheckEjectableMedia(virQEMUDriverPtr driver,
 
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
         table = qemuMonitorGetBlockInfo(priv->mon);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
     }
 
     if (!table)
@@ -276,7 +276,7 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
         goto error;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
@@ -305,7 +305,7 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
             memcpy(&disk->info.addr.pci, &guestAddr, sizeof(guestAddr));
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     virDomainAuditDisk(vm, NULL, disk->src, "attach", ret >= 0);
 
@@ -381,7 +381,7 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     } else {
@@ -389,7 +389,7 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver,
                                                  type,
                                                  &controller->info.addr.pci);
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     if (ret == 0) {
         controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
@@ -529,7 +529,7 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn,
         goto error;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
@@ -555,7 +555,7 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn,
             disk->info.addr.drive.unit = driveAddr.unit;
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     virDomainAuditDisk(vm, NULL, disk->src, "attach", ret >= 0);
 
@@ -633,7 +633,7 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn,
         goto error;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
@@ -648,7 +648,7 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn,
     } else {
         ret = qemuMonitorAddUSBDisk(priv->mon, disk->src);
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     virDomainAuditDisk(vm, NULL, disk->src, "attach", ret >= 0);
 
@@ -807,24 +807,24 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
             goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
         virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorAddNetdev(priv->mon, netstr, tapfd, tapfd_name,
                                  vhostfd, vhostfd_name) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditNet(vm, NULL, net, "attach", false);
             goto cleanup;
         }
     } else {
         if (qemuMonitorAddHostNetwork(priv->mon, netstr, tapfd, tapfd_name,
                                       vhostfd, vhostfd_name) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditNet(vm, NULL, net, "attach", false);
             goto cleanup;
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     VIR_FORCE_CLOSE(tapfd);
     VIR_FORCE_CLOSE(vhostfd);
@@ -843,10 +843,10 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
             goto try_remove;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditNet(vm, NULL, net, "attach", false);
             goto try_remove;
         }
@@ -854,14 +854,14 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
         guestAddr = net->info.addr.pci;
         if (qemuMonitorAddPCINetwork(priv->mon, nicstr,
                                      &guestAddr) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditNet(vm, NULL, net, "attach", false);
             goto try_remove;
         }
         net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
         memcpy(&net->info.addr.pci, &guestAddr, sizeof(guestAddr));
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     /* set link state */
     if (net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) {
@@ -869,11 +869,11 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
             virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                            _("device alias not found: cannot set link state to down"));
         } else {
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(driver, vm);
 
             if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
                 if (qemuMonitorSetLink(priv->mon, net->info.alias, VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) < 0) {
-                    qemuDomainObjExitMonitorWithDriver(driver, vm);
+                    qemuDomainObjExitMonitor(driver, vm);
                     virDomainAuditNet(vm, NULL, net, "attach", false);
                     goto try_remove;
                 }
@@ -882,7 +882,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
                                _("setting of link state not supported: Link is up"));
             }
 
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
         }
         /* link set to down */
     }
@@ -934,11 +934,11 @@ try_remove:
             char *netdev_name;
             if (virAsprintf(&netdev_name, "host%s", net->info.alias) < 0)
                 goto no_memory;
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(driver, vm);
             if (qemuMonitorRemoveNetdev(priv->mon, netdev_name) < 0)
                 VIR_WARN("Failed to remove network backend for netdev %s",
                          netdev_name);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             VIR_FREE(netdev_name);
         } else {
             VIR_WARN("Unable to remove network backend");
@@ -947,11 +947,11 @@ try_remove:
         char *hostnet_name;
         if (virAsprintf(&hostnet_name, "host%s", net->info.alias) < 0)
             goto no_memory;
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(driver, vm);
         if (qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 0)
             VIR_WARN("Failed to remove network backend for vlan %d, net %s",
                      vlan, hostnet_name);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         VIR_FREE(hostnet_name);
     }
     goto cleanup;
@@ -1009,18 +1009,18 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
                                                  priv->qemuCaps)))
             goto error;
 
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(driver, vm);
         ret = qemuMonitorAddDeviceWithFd(priv->mon, devstr,
                                          configfd, configfd_name);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
     } else {
         virDevicePCIAddress guestAddr = hostdev->info->addr.pci;
 
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(driver, vm);
         ret = qemuMonitorAddPCIHostDevice(priv->mon,
                                           &hostdev->source.subsys.u.pci,
                                           &guestAddr);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
 
         hostdev->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
         memcpy(&hostdev->info->addr.pci, &guestAddr, sizeof(guestAddr));
@@ -1076,13 +1076,13 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver,
         goto error;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     else
         goto error;
 
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
     virDomainAuditRedirdev(vm, redirdev, "attach", ret == 0);
     if (ret < 0)
         goto error;
@@ -1146,14 +1146,14 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver,
         virUSBDeviceFree(usb);
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     else
         ret = qemuMonitorAddUSBDeviceExact(priv->mon,
                                            hostdev->source.subsys.u.usb.bus,
                                            hostdev->source.subsys.u.usb.device);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
     virDomainAuditHostdev(vm, hostdev, "attach", ret == 0);
     if (ret < 0)
         goto error;
@@ -1421,7 +1421,7 @@ int qemuDomainChangeNetLinkState(virQEMUDriverPtr driver,
         return -1;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
 
     ret = qemuMonitorSetLink(priv->mon, dev->info.alias, linkstate);
     if (ret < 0)
@@ -1431,7 +1431,7 @@ int qemuDomainChangeNetLinkState(virQEMUDriverPtr driver,
     dev->linkstate = linkstate;
 
 cleanup:
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     return ret;
 }
@@ -2059,17 +2059,17 @@ int qemuDomainDetachPciDiskDevice(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditDisk(vm, detach->src, NULL, "detach", false);
             goto cleanup;
         }
     } else {
         if (qemuMonitorRemovePCIDevice(priv->mon,
                                        &detach->info.addr.pci) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditDisk(vm, detach->src, NULL, "detach", false);
             goto cleanup;
         }
@@ -2078,7 +2078,7 @@ int qemuDomainDetachPciDiskDevice(virQEMUDriverPtr driver,
     /* disconnect guest from host device */
     qemuMonitorDriveDel(priv->mon, drivestr);
 
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     virDomainAuditDisk(vm, detach->src, NULL, "detach", true);
 
@@ -2165,9 +2165,9 @@ int qemuDomainDetachDiskDevice(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         virDomainAuditDisk(vm, detach->src, NULL, "detach", false);
         goto cleanup;
     }
@@ -2175,7 +2175,7 @@ int qemuDomainDetachDiskDevice(virQEMUDriverPtr driver,
     /* disconnect guest from host device */
     qemuMonitorDriveDel(priv->mon, drivestr);
 
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     virDomainAuditDisk(vm, detach->src, NULL, "detach", true);
 
@@ -2301,20 +2301,20 @@ int qemuDomainDetachPciControllerDevice(virQEMUDriverPtr driver,
             goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             goto cleanup;
         }
     } else {
         if (qemuMonitorRemovePCIDevice(priv->mon,
                                        &detach->info.addr.pci) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             goto cleanup;
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     virDomainControllerRemove(vm->def, idx);
     virDomainControllerDefFree(detach);
@@ -2357,13 +2357,13 @@ qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         rv = qemuMonitorDelDevice(priv->mon, detach->info->alias);
     } else {
         rv = qemuMonitorRemovePCIDevice(priv->mon, &detach->info->addr.pci);
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
     virDomainAuditHostdev(vm, detach, "detach", rv == 0);
     if (rv < 0)
         goto cleanup;
@@ -2427,9 +2427,9 @@ qemuDomainDetachHostUsbDevice(virQEMUDriverPtr driver,
         return -1;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorDelDevice(priv->mon, detach->info->alias);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
     virDomainAuditHostdev(vm, detach, "detach", ret == 0);
     if (ret < 0)
         return -1;
@@ -2613,17 +2613,17 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditNet(vm, detach, NULL, "detach", false);
             goto cleanup;
         }
     } else {
         if (qemuMonitorRemovePCIDevice(priv->mon,
                                        &detach->info.addr.pci) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditNet(vm, detach, NULL, "detach", false);
             goto cleanup;
         }
@@ -2632,18 +2632,18 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
         virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditNet(vm, detach, NULL, "detach", false);
             goto cleanup;
         }
     } else {
         if (qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             virDomainAuditNet(vm, detach, NULL, "detach", false);
             goto cleanup;
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     virDomainAuditNet(vm, detach, NULL, "detach", true);
 
@@ -2713,7 +2713,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
     if (auth->connected)
         connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected);
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorSetPassword(priv->mon,
                                  type,
                                  auth->passwd ? auth->passwd : defaultPasswd,
@@ -2756,7 +2756,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
     }
 
 end_job:
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 cleanup:
     virObjectUnref(cfg);
     return ret;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 815f7a5..60cd47a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1188,7 +1188,7 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver,
         ret = qemuMonitorGetSpiceMigrationStatus(priv->mon,
                                                  &spice_migrated);
 
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     if (ret < 0 || virTimeMillisNow(&priv->job.info.timeElapsed) < 0) {
         priv->job.info.type = VIR_DOMAIN_JOB_FAILED;
@@ -1277,11 +1277,9 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, virDomainObjPtr vm,
         }
 
         virObjectUnlock(vm);
-        qemuDriverUnlock(driver);
 
         nanosleep(&ts, NULL);
 
-        qemuDriverLock(driver);
         virObjectLock(vm);
     }
 
@@ -1322,7 +1320,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
                                           cookie->graphics->port,
                                           cookie->graphics->tlsPort,
                                           cookie->graphics->tlsSubject);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
     }
 
     return ret;
@@ -2265,7 +2263,7 @@ qemuMigrationRun(virQEMUDriverPtr driver,
         /* explicitly do this *after* we entered the monitor,
          * as this is a critical section so we are guaranteed
          * priv->job.asyncAbort will not change */
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"),
                        qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
                        _("canceled by client"));
@@ -2273,7 +2271,7 @@ qemuMigrationRun(virQEMUDriverPtr driver,
     }
 
     if (qemuMonitorSetMigrationSpeed(priv->mon, migrate_speed) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         goto cleanup;
     }
 
@@ -2286,7 +2284,7 @@ qemuMigrationRun(virQEMUDriverPtr driver,
     /* connect to the destination qemu if needed */
     if (spec->destType == MIGRATION_DEST_CONNECT_HOST &&
         qemuMigrationConnect(driver, vm, spec) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         goto cleanup;
     }
 
@@ -2323,7 +2321,7 @@ qemuMigrationRun(virQEMUDriverPtr driver,
         VIR_FORCE_CLOSE(spec->dest.fd.qemu);
         break;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
     if (ret < 0)
         goto cleanup;
     ret = -1;
@@ -2412,7 +2410,7 @@ cancel:
         if (qemuDomainObjEnterMonitorAsync(driver, vm,
                                            QEMU_ASYNC_JOB_MIGRATION_OUT) == 0) {
             qemuMonitorMigrateCancel(priv->mon);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
         }
     }
     goto cleanup;
@@ -2615,23 +2613,23 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
         if (!(st = virStreamNew(dconn, 0)))
             goto cleanup;
 
-        qemuDomainObjEnterRemoteWithDriver(driver, vm);
+        qemuDomainObjEnterRemote(vm);
         ret = dconn->driver->domainMigratePrepareTunnel
             (dconn, st, flags, dname, resource, dom_xml);
-        qemuDomainObjExitRemoteWithDriver(driver, vm);
+        qemuDomainObjExitRemote(vm);
     } else {
-        qemuDomainObjEnterRemoteWithDriver(driver, vm);
+        qemuDomainObjEnterRemote(vm);
         ret = dconn->driver->domainMigratePrepare2
             (dconn, &cookie, &cookielen, NULL, &uri_out,
              flags, dname, resource, dom_xml);
-        qemuDomainObjExitRemoteWithDriver(driver, vm);
+        qemuDomainObjExitRemote(vm);
     }
     VIR_FREE(dom_xml);
     if (ret == -1)
         goto cleanup;
 
     /* the domain may have shutdown or crashed while we had the locks dropped
-     * in qemuDomainObjEnterRemoteWithDriver, so check again
+     * in qemuDomainObjEnterRemote, so check again
      */
     if (!virDomainObjIsActive(vm)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2678,11 +2676,11 @@ finish:
      */
     dname = dname ? dname : vm->def->name;
     VIR_DEBUG("Finish2 %p ret=%d", dconn, ret);
-    qemuDomainObjEnterRemoteWithDriver(driver, vm);
+    qemuDomainObjEnterRemote(vm);
     ddomain = dconn->driver->domainMigrateFinish2
         (dconn, dname, cookie, cookielen,
          uri_out ? uri_out : dconnuri, flags, cancelled);
-    qemuDomainObjExitRemoteWithDriver(driver, vm);
+    qemuDomainObjExitRemote(vm);
 
 cleanup:
     if (ddomain) {
@@ -2759,18 +2757,18 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver,
         if (!(st = virStreamNew(dconn, 0)))
             goto cleanup;
 
-        qemuDomainObjEnterRemoteWithDriver(driver, vm);
+        qemuDomainObjEnterRemote(vm);
         ret = dconn->driver->domainMigratePrepareTunnel3
             (dconn, st, cookiein, cookieinlen,
              &cookieout, &cookieoutlen,
              flags, dname, resource, dom_xml);
-        qemuDomainObjExitRemoteWithDriver(driver, vm);
+        qemuDomainObjExitRemote(vm);
     } else {
-        qemuDomainObjEnterRemoteWithDriver(driver, vm);
+        qemuDomainObjEnterRemote(vm);
         ret = dconn->driver->domainMigratePrepare3
             (dconn, cookiein, cookieinlen, &cookieout, &cookieoutlen,
              uri, &uri_out, flags, dname, resource, dom_xml);
-        qemuDomainObjExitRemoteWithDriver(driver, vm);
+        qemuDomainObjExitRemote(vm);
     }
     VIR_FREE(dom_xml);
     if (ret == -1)
@@ -2842,11 +2840,11 @@ finish:
     cookieout = NULL;
     cookieoutlen = 0;
     dname = dname ? dname : vm->def->name;
-    qemuDomainObjEnterRemoteWithDriver(driver, vm);
+    qemuDomainObjEnterRemote(vm);
     ddomain = dconn->driver->domainMigrateFinish3
         (dconn, dname, cookiein, cookieinlen, &cookieout, &cookieoutlen,
          dconnuri, uri_out ? uri_out : uri, flags, cancelled);
-    qemuDomainObjExitRemoteWithDriver(driver, vm);
+    qemuDomainObjExitRemote(vm);
 
     /* If ddomain is NULL, then we were unable to start
      * the guest on the target, and must restart on the
@@ -2934,9 +2932,9 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
      * destination side is completely setup before we touch the source
      */
 
-    qemuDomainObjEnterRemoteWithDriver(driver, vm);
+    qemuDomainObjEnterRemote(vm);
     dconn = virConnectOpen(dconnuri);
-    qemuDomainObjExitRemoteWithDriver(driver, vm);
+    qemuDomainObjExitRemote(vm);
     if (dconn == NULL) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("Failed to connect to remote libvirt URI %s"), dconnuri);
@@ -2948,7 +2946,7 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
                                cfg->keepAliveCount) < 0)
         goto cleanup;
 
-    qemuDomainObjEnterRemoteWithDriver(driver, vm);
+    qemuDomainObjEnterRemote(vm);
     p2p = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
                                    VIR_DRV_FEATURE_MIGRATION_P2P);
         /* v3proto reflects whether the caller used Perform3, but with
@@ -2960,7 +2958,7 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
     if (flags & VIR_MIGRATE_OFFLINE)
         offline = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
                                            VIR_DRV_FEATURE_MIGRATION_OFFLINE);
-    qemuDomainObjExitRemoteWithDriver(driver, vm);
+    qemuDomainObjExitRemote(vm);
 
     if (!p2p) {
         virReportError(VIR_ERR_OPERATION_FAILED, "%s",
@@ -2998,9 +2996,9 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
 
 cleanup:
     orig_err = virSaveLastError();
-    qemuDomainObjEnterRemoteWithDriver(driver, vm);
+    qemuDomainObjEnterRemote(vm);
     virConnectClose(dconn);
-    qemuDomainObjExitRemoteWithDriver(driver, vm);
+    qemuDomainObjExitRemote(vm);
     if (orig_err) {
         virSetError(orig_err);
         virFreeError(orig_err);
@@ -3646,7 +3644,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
         qemuMonitorSetMigrationSpeed(priv->mon,
                                      QEMU_DOMAIN_MIG_BANDWIDTH_MAX);
         priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX;
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
     }
 
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
@@ -3726,11 +3724,11 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
             if (virSetCloseExec(pipeFD[1]) < 0) {
                 virReportSystemError(errno, "%s",
                                      _("Unable to set cloexec flag"));
-                qemuDomainObjExitMonitorWithDriver(driver, vm);
+                qemuDomainObjExitMonitor(driver, vm);
                 goto cleanup;
             }
             if (virCommandRunAsync(cmd, NULL) < 0) {
-                qemuDomainObjExitMonitorWithDriver(driver, vm);
+                qemuDomainObjExitMonitor(driver, vm);
                 goto cleanup;
             }
             rc = qemuMonitorMigrateToFd(priv->mon,
@@ -3745,7 +3743,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
                                           args, path, offset);
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     if (rc < 0)
         goto cleanup;
@@ -3765,7 +3763,7 @@ cleanup:
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
         qemuMonitorSetMigrationSpeed(priv->mon, saveMigBandwidth);
         priv->migMaxBandwidth = saveMigBandwidth;
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
     }
 
     VIR_FORCE_CLOSE(pipeFD[0]);
@@ -3799,7 +3797,7 @@ qemuMigrationJobStart(virQEMUDriverPtr driver,
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    if (qemuDomainObjBeginAsyncJobWithDriver(driver, vm, job) < 0)
+    if (qemuDomainObjBeginAsyncJob(driver, vm, job) < 0)
         return -1;
 
     if (job == QEMU_ASYNC_JOB_MIGRATION_IN) {
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 12e3544..9c93e47 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -129,12 +129,10 @@ static void
 qemuProcessHandleAgentEOF(qemuAgentPtr agent,
                           virDomainObjPtr vm)
 {
-    virQEMUDriverPtr driver = qemu_driver;
     qemuDomainObjPrivatePtr priv;
 
     VIR_DEBUG("Received EOF from agent on %p '%s'", vm, vm->def->name);
 
-    qemuDriverLock(driver);
     virObjectLock(vm);
 
     priv = vm->privateData;
@@ -152,14 +150,12 @@ qemuProcessHandleAgentEOF(qemuAgentPtr agent,
     priv->agent = NULL;
 
     virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
 
     qemuAgentClose(agent);
     return;
 
 unlock:
     virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
     return;
 }
 
@@ -174,12 +170,10 @@ static void
 qemuProcessHandleAgentError(qemuAgentPtr agent ATTRIBUTE_UNUSED,
                             virDomainObjPtr vm)
 {
-    virQEMUDriverPtr driver = qemu_driver;
     qemuDomainObjPrivatePtr priv;
 
     VIR_DEBUG("Received error from agent on %p '%s'", vm, vm->def->name);
 
-    qemuDriverLock(driver);
     virObjectLock(vm);
 
     priv = vm->privateData;
@@ -187,7 +181,6 @@ qemuProcessHandleAgentError(qemuAgentPtr agent ATTRIBUTE_UNUSED,
     priv->agentError = true;
 
     virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
 }
 
 static void qemuProcessHandleAgentDestroy(qemuAgentPtr agent,
@@ -250,13 +243,11 @@ qemuConnectAgent(virQEMUDriverPtr driver, virDomainObjPtr vm)
 
     ignore_value(virTimeMillisNow(&priv->agentStart));
     virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
 
     agent = qemuAgentOpen(vm,
                           config,
                           &agentCallbacks);
 
-    qemuDriverLock(driver);
     virObjectLock(vm);
     priv->agentStart = 0;
 
@@ -307,7 +298,6 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     VIR_DEBUG("Received EOF on %p '%s'", vm, vm->def->name);
 
-    qemuDriverLock(driver);
     virObjectLock(vm);
 
     priv = vm->privateData;
@@ -347,7 +337,6 @@ unlock:
 cleanup:
     if (event)
         qemuDomainEventQueue(driver, event);
-    qemuDriverUnlock(driver);
 }
 
 
@@ -366,7 +355,6 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     VIR_DEBUG("Received error on %p '%s'", vm, vm->def->name);
 
-    qemuDriverLock(driver);
     virObjectLock(vm);
 
     ((qemuDomainObjPrivatePtr) vm->privateData)->monError = true;
@@ -375,7 +363,6 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
         qemuDomainEventQueue(driver, event);
 
     virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
 }
 
 
@@ -543,11 +530,8 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     virObjectUnlock(vm);
 
-    if (event) {
-        qemuDriverLock(driver);
+    if (event)
         qemuDomainEventQueue(driver, event);
-        qemuDriverUnlock(driver);
-    }
 
     return 0;
 }
@@ -570,7 +554,6 @@ qemuProcessFakeReboot(void *opaque)
     virDomainEventPtr event = NULL;
     int ret = -1;
     VIR_DEBUG("vm=%p", vm);
-    qemuDriverLock(driver);
     virObjectLock(vm);
     if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
@@ -581,12 +564,12 @@ qemuProcessFakeReboot(void *opaque)
         goto endjob;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (qemuMonitorSystemReset(priv->mon) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         goto endjob;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     if (!virDomainObjIsActive(vm)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -616,7 +599,7 @@ endjob:
 cleanup:
     if (vm) {
         if (ret == -1) {
-            ignore_value(qemuProcessKill(driver, vm,
+            ignore_value(qemuProcessKill(vm,
                                          VIR_QEMU_PROCESS_KILL_FORCE));
         }
         if (virObjectUnref(vm))
@@ -624,7 +607,6 @@ cleanup:
     }
     if (event)
         qemuDomainEventQueue(driver, event);
-    qemuDriverUnlock(driver);
 }
 
 
@@ -643,12 +625,13 @@ qemuProcessShutdownOrReboot(virQEMUDriverPtr driver,
                             qemuProcessFakeReboot,
                             vm) < 0) {
             VIR_ERROR(_("Failed to create reboot thread, killing domain"));
-            ignore_value(qemuProcessKill(driver, vm,
+            ignore_value(qemuProcessKill(vm,
                                          VIR_QEMU_PROCESS_KILL_NOWAIT));
             virObjectUnref(vm);
         }
     } else {
-        ignore_value(qemuProcessKill(driver, vm, VIR_QEMU_PROCESS_KILL_NOWAIT));
+        ignore_value(qemuProcessKill(vm,
+                                     VIR_QEMU_PROCESS_KILL_NOWAIT));
     }
 }
 
@@ -703,11 +686,8 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 unlock:
     virObjectUnlock(vm);
 cleanup:
-    if (event) {
-        qemuDriverLock(driver);
+    if (event)
         qemuDomainEventQueue(driver, event);
-        qemuDriverUnlock(driver);
-    }
     virObjectUnref(caps);
     virObjectUnref(cfg);
 
@@ -759,11 +739,8 @@ unlock:
     virObjectUnlock(vm);
 
 cleanup:
-    if (event) {
-        qemuDriverLock(driver);
+    if (event)
         qemuDomainEventQueue(driver, event);
-        qemuDriverUnlock(driver);
-    }
     virObjectUnref(caps);
     virObjectUnref(cfg);
 
@@ -821,11 +798,8 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 unlock:
     virObjectUnlock(vm);
 cleanup:
-    if (event) {
-        qemuDriverLock(driver);
+    if (event)
         qemuDomainEventQueue(driver, event);
-        qemuDriverUnlock(driver);
-    }
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return 0;
@@ -857,11 +831,8 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     virObjectUnlock(vm);
 
 cleanup:
-    if (event) {
-        qemuDriverLock(driver);
+    if (event)
         qemuDomainEventQueue(driver, event);
-        qemuDriverUnlock(driver);
-    }
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return 0;
@@ -929,14 +900,10 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
         virObjectUnlock(vm);
 
 cleanup:
-    if (watchdogEvent || lifecycleEvent) {
-        qemuDriverLock(driver);
-        if (watchdogEvent)
-            qemuDomainEventQueue(driver, watchdogEvent);
-        if (lifecycleEvent)
-            qemuDomainEventQueue(driver, lifecycleEvent);
-        qemuDriverUnlock(driver);
-    }
+    if (watchdogEvent)
+        qemuDomainEventQueue(driver, watchdogEvent);
+    if (lifecycleEvent)
+        qemuDomainEventQueue(driver, lifecycleEvent);
 
     virObjectUnref(caps);
     virObjectUnref(cfg);
@@ -999,16 +966,12 @@ qemuProcessHandleIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     virObjectUnlock(vm);
 
 cleanup:
-    if (ioErrorEvent || ioErrorEvent2 || lifecycleEvent) {
-        qemuDriverLock(driver);
-        if (ioErrorEvent)
-            qemuDomainEventQueue(driver, ioErrorEvent);
-        if (ioErrorEvent2)
-            qemuDomainEventQueue(driver, ioErrorEvent2);
-        if (lifecycleEvent)
-            qemuDomainEventQueue(driver, lifecycleEvent);
-        qemuDriverUnlock(driver);
-    }
+    if (ioErrorEvent)
+        qemuDomainEventQueue(driver, ioErrorEvent);
+    if (ioErrorEvent2)
+        qemuDomainEventQueue(driver, ioErrorEvent2);
+    if (lifecycleEvent)
+        qemuDomainEventQueue(driver, lifecycleEvent);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return 0;
@@ -1050,11 +1013,8 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     virObjectUnlock(vm);
 
-    if (event) {
-        qemuDriverLock(driver);
+    if (event)
         qemuDomainEventQueue(driver, event);
-        qemuDriverUnlock(driver);
-    }
 
     return 0;
 }
@@ -1117,11 +1077,8 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     event = virDomainEventGraphicsNewFromObj(vm, phase, localAddr, remoteAddr, authScheme, subject);
     virObjectUnlock(vm);
 
-    if (event) {
-        qemuDriverLock(driver);
+    if (event)
         qemuDomainEventQueue(driver, event);
-        qemuDriverUnlock(driver);
-    }
 
     return 0;
 
@@ -1192,11 +1149,8 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     virObjectUnlock(vm);
 cleanup:
-    if (event) {
-        qemuDriverLock(driver);
+    if (event)
         qemuDomainEventQueue(driver, event);
-        qemuDriverUnlock(driver);
-    }
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return 0;
@@ -1240,14 +1194,10 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     virObjectUnlock(vm);
 
 cleanup:
-    if (event || lifecycleEvent) {
-        qemuDriverLock(driver);
-        if (event)
-            qemuDomainEventQueue(driver, event);
-        if (lifecycleEvent)
-            qemuDomainEventQueue(driver, lifecycleEvent);
-        qemuDriverUnlock(driver);
-    }
+    if (event)
+        qemuDomainEventQueue(driver, event);
+    if (lifecycleEvent)
+        qemuDomainEventQueue(driver, lifecycleEvent);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return 0;
@@ -1293,14 +1243,10 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     virObjectUnlock(vm);
 
 cleanup:
-    if (event || lifecycleEvent) {
-        qemuDriverLock(driver);
-        if (event)
-            qemuDomainEventQueue(driver, event);
-        if (lifecycleEvent)
-            qemuDomainEventQueue(driver, lifecycleEvent);
-        qemuDriverUnlock(driver);
-    }
+    if (event)
+        qemuDomainEventQueue(driver, event);
+    if (lifecycleEvent)
+        qemuDomainEventQueue(driver, lifecycleEvent);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return 0;
@@ -1332,11 +1278,8 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     virObjectUnlock(vm);
 
 cleanup:
-    if (event) {
-        qemuDriverLock(driver);
+    if (event)
         qemuDomainEventQueue(driver, event);
-        qemuDriverUnlock(driver);
-    }
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return 0;
@@ -1382,14 +1325,10 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     virObjectUnlock(vm);
 
 cleanup:
-    if (event || lifecycleEvent) {
-        qemuDriverLock(driver);
-        if (event)
-            qemuDomainEventQueue(driver, event);
-        if (lifecycleEvent)
-            qemuDomainEventQueue(driver, lifecycleEvent);
-        qemuDriverUnlock(driver);
-    }
+    if (event)
+        qemuDomainEventQueue(driver, event);
+    if (lifecycleEvent)
+        qemuDomainEventQueue(driver, lifecycleEvent);
     virObjectUnref(caps);
     virObjectUnref(cfg);
 
@@ -1438,14 +1377,12 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm)
 
     ignore_value(virTimeMillisNow(&priv->monStart));
     virObjectUnlock(vm);
-    qemuDriverUnlock(driver);
 
     mon = qemuMonitorOpen(vm,
                           priv->monConfig,
                           priv->monJSON,
                           &monitorCallbacks);
 
-    qemuDriverLock(driver);
     virObjectLock(vm);
     priv->monStart = 0;
 
@@ -1469,12 +1406,12 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm)
     }
 
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorSetCapabilities(priv->mon);
     if (ret == 0 &&
         virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON))
         ret = virQEMUCapsProbeQMP(priv->qemuCaps, priv->mon);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
 error:
 
@@ -1850,9 +1787,9 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
         goto cleanup;
 
     priv = vm->privateData;
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorGetPtyPaths(priv->mon, paths);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
     if (ret == 0)
@@ -1900,12 +1837,12 @@ qemuProcessDetectVcpuPIDs(virQEMUDriverPtr driver,
     int ncpupids;
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     /* failure to get the VCPU<-> PID mapping or to execute the query
      * command will not be treated fatal as some versions of qemu don't
      * support this command */
     if ((ncpupids = qemuMonitorGetCPUInfo(priv->mon, &cpupids)) <= 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         virResetLastError();
 
         priv->nvcpupids = 1;
@@ -1916,7 +1853,7 @@ qemuProcessDetectVcpuPIDs(virQEMUDriverPtr driver,
         priv->vcpupids[0] = vm->pid;
         return 0;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     if (ncpupids != vm->def->vcpus) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -2309,10 +2246,10 @@ qemuProcessInitPasswords(virConnectPtr conn,
                 goto cleanup;
 
             alias = vm->def->disks[i]->info.alias;
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(driver, vm);
             ret = qemuMonitorSetDrivePassphrase(priv->mon, alias, secret);
             VIR_FREE(secret);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(driver, vm);
             if (ret < 0)
                 goto cleanup;
         }
@@ -2701,10 +2638,10 @@ qemuProcessInitPCIAddresses(virQEMUDriverPtr driver,
     int ret;
     qemuMonitorPCIAddress *addrs = NULL;
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     naddrs = qemuMonitorGetAllPCIAddresses(priv->mon,
                                            &addrs);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     ret = qemuProcessDetectPCIAddresses(vm, addrs, naddrs);
 
@@ -2862,7 +2799,7 @@ qemuProcessPrepareMonitorChr(virQEMUDriverConfigPtr cfg,
 /*
  * Precondition: Both driver and vm must be locked,
  * and a job must be active. This method will call
- * {Enter,Exit}MonitorWithDriver
+ * {Enter,Exit}Monitor
  */
 int
 qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
@@ -2887,7 +2824,7 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
     ret = qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob);
     if (ret == 0) {
         ret = qemuMonitorStartCPUs(priv->mon, conn);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
     }
 
     if (ret == 0) {
@@ -2916,7 +2853,7 @@ int qemuProcessStopCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
     ret = qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob);
     if (ret == 0) {
         ret = qemuMonitorStopCPUs(priv->mon);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
     }
 
     if (ret == 0) {
@@ -2979,9 +2916,9 @@ qemuProcessUpdateState(virQEMUDriverPtr driver, virDomainObjPtr vm)
     char *msg = NULL;
     int ret;
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorGetStatus(priv->mon, &running, &reason);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     if (ret < 0 || !virDomainObjIsActive(vm))
         return -1;
@@ -3264,7 +3201,6 @@ qemuProcessReconnect(void *opaque)
 
     VIR_FREE(data);
 
-    qemuDriverLock(driver);
     virObjectLock(obj);
 
     cfg = virQEMUDriverGetConfig(driver);
@@ -3383,8 +3319,6 @@ endjob:
     if (obj && virObjectUnref(obj))
         virObjectUnlock(obj);
 
-    qemuDriverUnlock(driver);
-
     virConnectClose(conn);
     virObjectUnref(cfg);
     virObjectUnref(caps);
@@ -3399,7 +3333,6 @@ error:
         if (!virDomainObjIsActive(obj)) {
             if (virObjectUnref(obj))
                 virObjectUnlock(obj);
-            qemuDriverUnlock(driver);
             return;
         }
 
@@ -3425,7 +3358,6 @@ error:
                 virObjectUnlock(obj);
         }
     }
-    qemuDriverUnlock(driver);
     virConnectClose(conn);
     virObjectUnref(caps);
     virObjectUnref(cfg);
@@ -3474,7 +3406,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj,
 
     qemuDomainObjRestoreJob(obj, &data->oldjob);
 
-    if (qemuDomainObjBeginJobWithDriver(src->driver, obj, QEMU_JOB_MODIFY) < 0)
+    if (qemuDomainObjBeginJob(src->driver, obj, QEMU_JOB_MODIFY) < 0)
         goto error;
 
     /* Since we close the connection later on, we have to make sure
@@ -4111,13 +4043,13 @@ int qemuProcessStart(virConnectPtr conn,
     /* qemu doesn't support setting this on the command line, so
      * enter the monitor */
     VIR_DEBUG("Setting network link states");
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (qemuProcessSetLinkStates(vm) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         goto cleanup;
     }
 
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     /* Technically, qemuProcessStart can be called from inside
      * QEMU_ASYNC_JOB_MIGRATION_IN, but we are okay treating this like
@@ -4131,12 +4063,12 @@ int qemuProcessStart(virConnectPtr conn,
                        vm->def->mem.cur_balloon);
         goto cleanup;
     }
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (qemuMonitorSetBalloon(priv->mon, cur_balloon) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         goto cleanup;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     if (!(flags & VIR_QEMU_PROCESS_START_PAUSED)) {
         VIR_DEBUG("Starting domain CPUs");
@@ -4205,8 +4137,7 @@ cleanup:
 
 
 int
-qemuProcessKill(virQEMUDriverPtr driver,
-                virDomainObjPtr vm, unsigned int flags)
+qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
 {
     int ret;
 
@@ -4227,20 +4158,9 @@ qemuProcessKill(virQEMUDriverPtr driver,
         return 0;
     }
 
-    if (driver)
-        qemuDriverUnlock(driver);
-
     ret = virProcessKillPainfully(vm->pid,
                                   !!(flags & VIR_QEMU_PROCESS_KILL_FORCE));
 
-    if (driver) {
-        virObjectRef(vm);
-        virObjectUnlock(vm);
-        qemuDriverLock(driver);
-        virObjectLock(vm);
-        virObjectUnref(vm);
-    }
-
     return ret;
 }
 
@@ -4346,8 +4266,9 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     }
 
     /* shut it off for sure */
-    ignore_value(qemuProcessKill(driver, vm, VIR_QEMU_PROCESS_KILL_FORCE|
-                                             VIR_QEMU_PROCESS_KILL_NOCHECK));
+    ignore_value(qemuProcessKill(vm,
+                                 VIR_QEMU_PROCESS_KILL_FORCE|
+                                 VIR_QEMU_PROCESS_KILL_NOCHECK));
 
     qemuDomainCleanupRun(driver, vm);
 
@@ -4646,20 +4567,20 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
     }
 
     VIR_DEBUG("Getting initial memory amount");
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(driver, vm);
     if (qemuMonitorGetBalloonInfo(priv->mon, &vm->def->mem.cur_balloon) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         goto cleanup;
     }
     if (qemuMonitorGetStatus(priv->mon, &running, &reason) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         goto cleanup;
     }
     if (qemuMonitorGetVirtType(priv->mon, &vm->def->virtType) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(driver, vm);
         goto cleanup;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(driver, vm);
 
     if (!virDomainObjIsActive(vm))
         goto cleanup;
@@ -4731,8 +4652,8 @@ qemuProcessAutoDestroy(virQEMUDriverPtr driver,
         qemuDomainObjDiscardAsyncJob(driver, dom);
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, dom,
-                                        QEMU_JOB_DESTROY) < 0)
+    if (qemuDomainObjBeginJob(driver, dom,
+                              QEMU_JOB_DESTROY) < 0)
         goto cleanup;
 
     VIR_DEBUG("Killing domain");
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index cbdab24..ce44fe5 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -84,8 +84,7 @@ typedef enum {
    VIR_QEMU_PROCESS_KILL_NOCHECK = 1 << 2, /* bypass the running vm check */
 } virQemuProcessKillMode;
 
-int qemuProcessKill(virQEMUDriverPtr driver,
-                    virDomainObjPtr vm, unsigned int flags);
+int qemuProcessKill(virDomainObjPtr vm, unsigned int flags);
 
 int qemuProcessAutoDestroyInit(virQEMUDriverPtr driver);
 void qemuProcessAutoDestroyShutdown(virQEMUDriverPtr driver);
-- 
1.8.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]