From 7cb0241a12bf27e5ac318ce6e1c3321cdca1c97b Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 20 Oct 2020 15:33:41 -0400 Subject: [PATCH] Attempt live migrates 3 times before proceeding --- node-daemon/pvcnoded/VMInstance.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/node-daemon/pvcnoded/VMInstance.py b/node-daemon/pvcnoded/VMInstance.py index 5cd9d3df..3a11730c 100644 --- a/node-daemon/pvcnoded/VMInstance.py +++ b/node-daemon/pvcnoded/VMInstance.py @@ -449,7 +449,19 @@ class VMInstance(object): return True do_migrate_shutdown = False - migrate_live_result = migrate_live() + migrate_live_result = False + + # A live migrate is attemped 3 times in succession + ticks = 0 + while True: + migrate_live_result = migrate_live() + if migrate_live_result: + break + time.sleep(0.5) + ticks += 1 + if ticks > 2: + break + if not migrate_live_result: if force_live: self.logger.out('Could not live migrate VM; live migration enforced, aborting', state='e', prefix='Domain {}'.format(self.domuuid)) @@ -474,7 +486,7 @@ class VMInstance(object): time.sleep(0.5) # Time for reader to acquire the lock if do_migrate_shutdown: - migrate_shutdown_result = migrate_live() + migrate_shutdown_result = migrate_shutdown() self.logger.out('Releasing write lock for synchronization phase C', state='i', prefix='Domain {}'.format(self.domuuid)) zkhandler.writedata(self.zk_conn, { '/locks/primary_node': self.domuuid })