[libvirt] [RFC PATCH 07/10] qemu: agent: fix monitor close during first sync

John Ferlan jferlan at redhat.com
Wed Jan 10 17:23:32 UTC 2018


From: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>

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.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 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 5d125c413..e1440ec27 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;
         }
     }
-- 
2.13.6




More information about the libvir-list mailing list