]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: fix response timeout for agent guest-sync
authorJonathon Jongsma <jjongsma@redhat.com>
Fri, 20 Mar 2020 22:28:10 +0000 (17:28 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 23 Mar 2020 13:40:01 +0000 (14:40 +0100)
The agent 'guest-sync' command historically had a 5s response timeout
which was different from other agent commands, which waited forever.
When we added the ability to customize the response timeout for guest
agent commands, we intended to continue to use 5s for 'guest-sync' when
the user specified a response timeout greater than 5s, and use the
user-specified timeout if it was below 5s. Unfortunately, when
attempting to determine whether the user-specified timeout was less than
5s, we were comparing against an enum value of
VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT (which is -1) rather than against
the actual time value that it represented (5).

This change makes it so that 'guest-sync' now uses the user-specified
tiemout if it is less than 5s.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_agent.c

index 0141ddcb5b2af8c39499fae2ba119386c408a54c..0300dff3e595f66df4b7b0915e1367ab408f1b34 100644 (file)
@@ -904,7 +904,7 @@ qemuAgentGuestSync(qemuAgentPtr agent)
 
     /* if user specified a custom agent timeout that is lower than the
      * default timeout, use the shorter timeout instead */
-    if ((agent->timeout >= 0) && (agent->timeout < timeout))
+    if ((agent->timeout >= 0) && (agent->timeout < QEMU_AGENT_WAIT_TIME))
         timeout = agent->timeout;
 
     memset(&sync_msg, 0, sizeof(sync_msg));