Bug fixed in migration code
This commit is contained in:
parent
d13a4bcc37
commit
4b7d6d5099
1 changed files with 11 additions and 14 deletions
|
@ -57,6 +57,7 @@ class TransferVM(Process):
|
||||||
os.remove(self.src_sock_path)
|
os.remove(self.src_sock_path)
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
|
"sudo"
|
||||||
"ssh",
|
"ssh",
|
||||||
"-nNT",
|
"-nNT",
|
||||||
"-L",
|
"-L",
|
||||||
|
@ -73,9 +74,7 @@ class TransferVM(Process):
|
||||||
else:
|
else:
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
vmm = VMM()
|
vmm = VMM()
|
||||||
logger.debug(
|
logger.debug("Executing: ssh forwarding command: %s", command)
|
||||||
"Executing: ssh forwarding command: %s", command
|
|
||||||
)
|
|
||||||
vmm.execute_command(
|
vmm.execute_command(
|
||||||
self.src_uuid,
|
self.src_uuid,
|
||||||
command="migrate",
|
command="migrate",
|
||||||
|
@ -83,22 +82,20 @@ class TransferVM(Process):
|
||||||
)
|
)
|
||||||
|
|
||||||
while p.poll() is None:
|
while p.poll() is None:
|
||||||
success, output = vmm.execute_command(
|
success, output = vmm.execute_command(self.src_uuid, command="query-migrate")
|
||||||
self.src_uuid, command="query-migrate"
|
|
||||||
)
|
|
||||||
if success:
|
if success:
|
||||||
status = output["return"]["status"]
|
status = output["return"]["status"]
|
||||||
|
logger.info('Migration Status: {}'.format(status))
|
||||||
if status != "active":
|
|
||||||
print("Migration Status: ", status)
|
|
||||||
if status == "completed":
|
if status == "completed":
|
||||||
vmm.stop(self.src_uuid)
|
vmm.stop(self.src_uuid)
|
||||||
return
|
return
|
||||||
else:
|
elif status in ['failed', 'cancelled']:
|
||||||
print("Migration Status: ", status)
|
|
||||||
else:
|
|
||||||
return
|
return
|
||||||
time.sleep(0.2)
|
else:
|
||||||
|
logger.error("Couldn't be able to query VM {} that was in migration".format(self.src_uuid))
|
||||||
|
return
|
||||||
|
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
|
||||||
class VMM:
|
class VMM:
|
||||||
|
|
Loading…
Reference in a new issue