aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorCarsten Koester <ckoester@cisco.com>2016-05-23 13:02:00 -0400
committerCarsten Koester <ckoester@cisco.com>2016-05-23 13:11:07 -0400
commit76798663ee3e71defd75bdf0d1e32d8242e38e33 (patch)
tree0dce06f158a05c61458e2a94b106f95ff656c70e /resources/libraries/python
parent5db24a985316c70a707f2a11b30dd00f7a98dca7 (diff)
Add temporary fix for CSIT-90 by flushing QGA's input buffer
This is not a final fix. The final fix SHOULD send a "guest-sync" request as per" http://wiki.qemu.org/Features/QAPI/GuestAgent#QEMU_Guest_Agent_Protocol However, this temporary fix will eliminate the nested VM startup failures triggered by the nested VM's guest-agent receiving a partial guest-ping request. Change-Id: Ice409b7c966a527b03cb71c042b476e1771676d0 Signed-off-by: Carsten Koester <ckoester@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/QemuUtils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/resources/libraries/python/QemuUtils.py b/resources/libraries/python/QemuUtils.py
index 282b157eb8..d105dae89a 100644
--- a/resources/libraries/python/QemuUtils.py
+++ b/resources/libraries/python/QemuUtils.py
@@ -196,6 +196,21 @@ class QemuUtils(object):
self._node['host']))
return json.loads(out_list[2])
+ def _qemu_qga_flush(self):
+ """Flush the QGA parser state
+ """
+ qga_cmd = 'printf "\xFF" | sudo -S nc ' \
+ '-q 1 -U ' + self.__QGA_SOCK
+ (ret_code, stdout, stderr) = self._ssh.exec_command(qga_cmd)
+ if 0 != int(ret_code):
+ logger.debug('QGA execute failed {0}'.format(stderr))
+ raise RuntimeError('QGA execute "{0}" failed on {1}'.format(cmd,
+ self._node['host']))
+ logger.trace(stdout)
+ if not stdout:
+ return {}
+ return json.loads(stdout.split('\n', 1)[0])
+
def _qemu_qga_exec(self, cmd):
"""Execute QGA command.
@@ -229,6 +244,7 @@ class QemuUtils(object):
if time() - start > timeout:
raise RuntimeError('timeout, VM {0} not booted on {1}'.format(
self._qemu_opt['disk_image'], self._node['host']))
+ self._qemu_qga_flush()
out = self._qemu_qga_exec('guest-ping')
# Empty output - VM not booted yet
if not out: