QMP may return multiple greeting messages upon connection. This is reported on qemu-devel. The fix is one-liner but until it get's released this is a quick and dirty workaround that flushes the client's buffer after getting the first greeting message.
Signed-off-by: Dimitris Aragiorgis <[email protected]> --- lib/hypervisor/hv_kvm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 42fbae0..c81a048 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -491,6 +491,10 @@ class QmpConnection(MonitorSocket): raise errors.HypervisorError("kvm: QMP communication error (wrong" " server greeting") + # This is needed because QMP can return more than one greetings + # see https://groups.google.com/d/msg/ganeti-devel/gZYcvHKDooU/SnukC8dgS5AJ + self._buf = "" + # Let's put the monitor in command mode using the qmp_capabilities # command, or else no command will be executable. # (As per the QEMU Protocol Specification 0.1 - section 4) -- 1.7.10.4
