[libvirt] [PATCH 3/4] qemu: agent: fix monitor close during first sync

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Wed Oct 25 09:05:07 UTC 2017


Normally if first agent sync is failed we retry. First sync
can also be failed due to agent was closed. In this case we should
fail sync otherwise second attempt will hang.
---
 src/qemu/qemu_agent.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 5d125c4..e1440ec 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -987,17 +987,17 @@ qemuAgentGuestSync(qemuAgentPtr mon)
         goto cleanup;
 
     if (!sync_msg.rxObject) {
-        if (sync_msg.first) {
+        if (!mon->running) {
+            virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
+                           _("Guest agent disappeared while executing command"));
+            goto cleanup;
+        } else if (sync_msg.first) {
             VIR_FREE(sync_msg.txBuffer);
             memset(&sync_msg, 0, sizeof(sync_msg));
             goto retry;
         } else {
-            if (mon->running)
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Missing monitor reply object"));
-            else
-                virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
-                               _("Guest agent disappeared while executing command"));
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("Missing monitor reply object"));
             goto cleanup;
         }
     }
-- 
1.8.3.1




More information about the libvir-list mailing list