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

[libvirt] [PATCH v2 RFC 2/4] qemu: remove liveness check from qemuDomainObjExitMonitor



As qemuProcessStop is called only in the context of some job and jobs
can not overlap now this check becomes useless. Previously async job
can continue to run while concurrent regular job is still waiting
for qemu response. Now it is not possible.
---
 src/qemu/qemu_domain.c | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2a51b5e..5aaa97a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3925,9 +3925,13 @@ qemuDomainObjEnterMonitor(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, virDomainObj
     virObjectUnlock(obj);
 }
 
-static void ATTRIBUTE_NONNULL(1)
-qemuDomainObjExitMonitorInternal(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                                 virDomainObjPtr obj)
+/* obj must NOT be locked before calling
+ *
+ * Should be paired with an earlier qemuDomainObjEnterMonitor call
+ */
+int
+qemuDomainObjExitMonitor(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
+                         virDomainObjPtr obj)
 {
     qemuDomainObjPrivatePtr priv = obj->privateData;
     bool hasRefs;
@@ -3944,32 +3948,11 @@ qemuDomainObjExitMonitorInternal(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
     priv->monStart = 0;
     if (!hasRefs)
         priv->mon = NULL;
-}
 
-
-/* obj must NOT be locked before calling
- *
- * Should be paired with an earlier qemuDomainObjEnterMonitor() call
- *
- * Returns -1 if the domain is no longer alive after exiting the monitor.
- * In that case, the caller should be careful when using obj's data,
- * e.g. the live definition in vm->def has been freed by qemuProcessStop
- * and replaced by the persistent definition, so pointers stolen
- * from the live definition could no longer be valid.
- */
-int qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
-                             virDomainObjPtr obj)
-{
-    qemuDomainObjExitMonitorInternal(driver, obj);
-    if (!virDomainObjIsActive(obj)) {
-        if (!virGetLastError())
-            virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                           _("domain is no longer running"));
-        return -1;
-    }
     return 0;
 }
 
+
 /*
  * obj must be locked before calling
  *
-- 
1.8.3.1


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