[libvirt] [PATCH 5/5] qemu: agent: give better error messages whe agent monitor is down

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Fri Sep 16 10:35:36 UTC 2016


We can receive NULL as sync reply in two situations. First
is garbage sync reply and this situation is handled by
resending sync message. Second is different cases
of rebooting guest, destroing domain etc and we can
give more meaningful error message. Actually we have
this error message in qemuAgentCommand already which checks
for the same sitatuion. AFAIK case with mon->running
is just to be safe on adding some future(?) cases of
returning NULL reply.
---
 src/qemu/qemu_agent.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 8f47618..8aea3c4 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -992,8 +992,12 @@ qemuAgentGuestSync(qemuAgentPtr mon)
             memset(&sync_msg, 0, sizeof(sync_msg));
             goto retry;
         } else {
-            virReportError(VIR_ERR_AGENT_UNSYNCED, "%s",
-                           _("Missing monitor reply object"));
+            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"));
             goto cleanup;
         }
     }
-- 
1.8.3.1




More information about the libvir-list mailing list