Commit 4b3753be authored by Alain Takoudjou's avatar Alain Takoudjou

qemu backup: check running job exit after a timeout

Prevent the method to loop indefinitely
parent 77f49bd2
...@@ -138,12 +138,14 @@ class QemuQMPWrapper(object): ...@@ -138,12 +138,14 @@ class QemuQMPWrapper(object):
def _getRunningJobList(self, device): def _getRunningJobList(self, device):
result = self._queryBlockJobs(device) result = self._queryBlockJobs(device)
max_loop = 20
while result is None: while max_loop and result is None:
# If result is None retry to command until if return something. # If result is None retry to command until if return something.
max_loop -= 1
time.sleep(3) time.sleep(3)
result = self._queryBlockJobs(device) result = self._queryBlockJobs(device)
if result.get('return'): if result and result.get('return'):
return result['return'] return result['return']
else: else:
return return
......
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