On 04/18/2018 01:30 PM, Daniel P. Berrangé wrote:
When the agent code was first introduced back in
commit c160ce3316852a797d7b06b4ee101233866e69a9
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Wed Oct 5 18:31:54 2011 +0100
QEMU guest agent support
there was code that would loop and retry the connection when opening
the agent socket. At this time, the only thing done in between the
opening of the monitor socket & opening of the agent socket was a
call to set the monitor capabilities. This was a no-op on non-QMP
versions, so in theory there could be a race which let us connect
to the monitor while the agent socket was still not created by QEMU.
In the modern world, however, we long ago mandated the use of QMP
for managing QEMU, so we're guaranteed to have a set capabilities
QMP call. Once we've seen a reply to this, we're guaranteed that
QEMU has fully initialized all backends and is in its event loop.
We can thus be sure the QEMU agent socket is present and don't need
to retry connections to it, even without having the chardev FD passing
feature.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_agent.c | 84 +++++----------------------------------------------
1 file changed, 7 insertions(+), 77 deletions(-)
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
John