Commit ded03013 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

fixup! Add support for Python 3

This is another fixup for commit
1c8269b2.

This is not covered by tests since they use a fake_send method.
parent c90ab036
......@@ -36,6 +36,7 @@ import time
import errno
import psutil
from operator import itemgetter
from slapos.util import str2bytes
def parseArgument():
"""
......@@ -168,15 +169,14 @@ class QemuQMPWrapper(object):
return response
def _send(self, message, retry=0, sleep=0.5):
self.socket.sendall(json.dumps(message))
for i in range(retry + 1):
self.socket.sendall(str2bytes(json.dumps(message)))
response = self._readResponse()
for i in range(0, retry):
if response is not None:
break
if i < retry:
print("Retrying send command after %s second(s)..." % sleep)
time.sleep(sleep)
self.socket.sendall(json.dumps(message))
response = self._readResponse()
return response
def _getVMStatus(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment