[libvirt] libvirt guest-agent-command error

Michal Privoznik mprivozn at redhat.com
Thu Oct 29 15:45:52 UTC 2015


On 28.10.2015 12:11, Vasiliy Tolstov wrote:
> Hi. I'm debug some issues with guest-agent inside vm and find this
> bug, that affected me
> https://bugzilla.redhat.com/show_bug.cgi?id=1090551
> 
> Does anybody knows how to properly fix this ?
> 

If qemu-ga fails to reply within desired timeout I guess there's not
much that libvirt can do.

Previously, when qemu did not expose whether there's somebody listening
inside the guest for guest agent commands, I've came up with ping
algorithm. Prior to each command a harmless ping is sent. If the agent
does not reply within 30 seconds, we consider it broken and don't even
try issuing the real command. So if the qemu-ga is stuck somewhere on
breakpoint, this mechanism works exactly as intended.

I can imagine it can be painful when debugging, therefore you can do
this locally to disable the ping:

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 5735ed8..b8b87aa 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -934,7 +934,7 @@ static int qemuAgentSend(qemuAgentPtr mon,
  * Returns: 0 on success,
  *          -1 otherwise
  */
-static int
+static int ATTRIBUTE_UNUSED
 qemuAgentGuestSync(qemuAgentPtr mon)
 {
     int ret = -1;
@@ -1121,9 +1121,6 @@ qemuAgentCommand(qemuAgentPtr mon,
         return -1;
     }

-    if (qemuAgentGuestSync(mon) < 0)
-        return -1;
-
     memset(&msg, 0, sizeof(msg));

     if (!(cmdstr = virJSONValueToString(cmd, false)))


Happy hacking!

Michal




More information about the libvir-list mailing list