(2.10) Workaround for monitor bug related to greeting msg
authorDimitris Aragiorgis <dimara@grnet.gr>
Sat, 25 Jan 2014 18:13:14 +0000 (20:13 +0200)
committerDimitris Aragiorgis <dimara@grnet.gr>
Thu, 27 Mar 2014 08:01:08 +0000 (10:01 +0200)
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 <dimara@grnet.gr>

lib/hypervisor/hv_kvm.py

index d8d3ca1..072b796 100644 (file)
@@ -485,6 +485,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)