Make force_migrate not replace existing node
Previous to this, if once force-migrated a VM, the previous_node value would be updated to the current node, which is likely never what an administrator would want. Change this functionality so that the previous node value is not changed, and update the documentation to reflect this.
This commit is contained in:
@ -444,6 +444,10 @@ def migrate_vm(zk_conn, domain, target_node, selector, force_migrate, is_cli=Fal
|
||||
common.stopZKConnection(zk_conn)
|
||||
return False, 'ERROR: VM "{}" is already running on node "{}".'.format(domain, current_node)
|
||||
|
||||
# Don't overwrite an existing last_node when using force_migrate
|
||||
if last_node and force_migrate:
|
||||
current_node = last_node
|
||||
|
||||
zkhandler.writedata(zk_conn, {
|
||||
'/domains/{}/state'.format(dom_uuid): 'migrate',
|
||||
'/domains/{}/node'.format(dom_uuid): target_node,
|
||||
|
Reference in New Issue
Block a user