From 351076c15e4255c5f2dd5fce6cd0965b33ea4b68 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 21 Oct 2020 02:52:36 -0400 Subject: [PATCH] Check if node changed during final check Avoids situations where two migrates, to different nodes, happen in rapid succession. Aborts the migration if the current target node no longer matches what was set at the start of the execution. --- node-daemon/pvcnoded/VMInstance.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/node-daemon/pvcnoded/VMInstance.py b/node-daemon/pvcnoded/VMInstance.py index b6113b00..c4d74f9b 100644 --- a/node-daemon/pvcnoded/VMInstance.py +++ b/node-daemon/pvcnoded/VMInstance.py @@ -353,6 +353,9 @@ class VMInstance(object): self.inmigrate = True self.logger.out('Migrating VM to node "{}"'.format(self.node), state='i', prefix='Domain {}'.format(self.domuuid)) + # Used for sanity checking later + target_node = zkhandler.readdata(self.zk_conn, '/domains/{}/node'.format(self.domuuid)) + aborted = False def abort_migrate(reason): @@ -455,6 +458,9 @@ class VMInstance(object): if self.node == self.lastnode or self.node == self.this_node.name: abort_migrate('Target node matches the current active node during final check') return + if self.node != target_node: + abort_migrate('Target node changed during preparation') + return # A live migrate is attemped 3 times in succession ticks = 0