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.
This commit is contained in:
parent
42514b9a50
commit
351076c15e
|
@ -353,6 +353,9 @@ class VMInstance(object):
|
||||||
self.inmigrate = True
|
self.inmigrate = True
|
||||||
self.logger.out('Migrating VM to node "{}"'.format(self.node), state='i', prefix='Domain {}'.format(self.domuuid))
|
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
|
aborted = False
|
||||||
|
|
||||||
def abort_migrate(reason):
|
def abort_migrate(reason):
|
||||||
|
@ -455,6 +458,9 @@ class VMInstance(object):
|
||||||
if self.node == self.lastnode or self.node == self.this_node.name:
|
if self.node == self.lastnode or self.node == self.this_node.name:
|
||||||
abort_migrate('Target node matches the current active node during final check')
|
abort_migrate('Target node matches the current active node during final check')
|
||||||
return
|
return
|
||||||
|
if self.node != target_node:
|
||||||
|
abort_migrate('Target node changed during preparation')
|
||||||
|
return
|
||||||
|
|
||||||
# A live migrate is attemped 3 times in succession
|
# A live migrate is attemped 3 times in succession
|
||||||
ticks = 0
|
ticks = 0
|
||||||
|
|
Loading…
Reference in New Issue