QEMU VM guest-ping fix 34/1034/2
authorMatus Fabian <matfabia@cisco.com>
Mon, 9 May 2016 07:17:44 +0000 (00:17 -0700)
committerStefan Kobza <skobza@cisco.com>
Mon, 9 May 2016 10:18:24 +0000 (10:18 +0000)
JIRA: CSIT-62

Change-Id: I0affda16af8f983895c50fbc306f45f30fbb69cd
Signed-off-by: Matus Fabian <matfabia@cisco.com>
resources/libraries/python/QemuUtils.py

index 6658c07..282b157 100644 (file)
@@ -214,7 +214,7 @@ class QemuUtils(object):
         logger.trace(stdout)
         if not stdout:
             return {}
-        return json.loads(stdout)
+        return json.loads(stdout.split('\n', 1)[0])
 
     def _wait_until_vm_boot(self, timeout=300):
         """Wait until QEMU VM is booted.
@@ -236,6 +236,9 @@ class QemuUtils(object):
             # Non-error return - VM booted
             elif out.get('return') is not None:
                 break
+            # Skip error and wait
+            elif out.get('error') is not None:
+                sleep(5)
             else:
                 raise RuntimeError('QGA guest-ping unexpected output {}'.format(
                     out))