@@ -120,15 +120,24 @@ def migrate(vm, env=None):
# Helper functions
def mig_finished():
o = vm.monitor.info("migrate")
- return "status: active" not in o
+ if isinstance(o, str):
+ return "status: active" not in o
+ else:
+ return o.get("status") != "active"
def mig_succeeded():
o = vm.monitor.info("migrate")
- return "status: completed" in o
+ if isinstance(o, str):
+ return "status: completed" in o
+ else:
+ return o.get("status") == "completed"
def mig_failed():
o = vm.monitor.info("migrate")
- return "status: failed" in o
+ if isinstance(o, str):
+ return "status: failed" in o
+ else:
+ return o.get("status") == "failed"
# Clone the source VM and ask the clone to wait for incoming migration
dest_vm = vm.clone()