Ensure offline migrations update SR-IOV NIC states

This commit is contained in:
Joshua Boniface 2021-06-21 23:35:52 -04:00
parent 7d42fba373
commit 68c7481aa2
1 changed files with 12 additions and 0 deletions

View File

@ -630,6 +630,10 @@ def move_vm(zkhandler, domain, target_node, wait=False, force_live=False):
retmsg = 'Permanently migrating VM "{}" to node "{}".'.format(domain, target_node) retmsg = 'Permanently migrating VM "{}" to node "{}".'.format(domain, target_node)
if target_state not in ['migrate', 'migrate-live']:
# Update any SR-IOV NICs - with online migrations this is done by pvcnoded, but offline we must do it here
update_vm_sriov_nics(zkhandler, dom_uuid, zkhandler.read(('domain.node', dom_uuid)), target_node)
lock = zkhandler.exclusivelock(('domain.state', dom_uuid)) lock = zkhandler.exclusivelock(('domain.state', dom_uuid))
with lock: with lock:
zkhandler.write([ zkhandler.write([
@ -698,6 +702,10 @@ def migrate_vm(zkhandler, domain, target_node, force_migrate, wait=False, force_
retmsg = 'Migrating VM "{}" to node "{}".'.format(domain, target_node) retmsg = 'Migrating VM "{}" to node "{}".'.format(domain, target_node)
if target_state not in ['migrate', 'migrate-live']:
# Update any SR-IOV NICs - with online migrations this is done by pvcnoded, but offline we must do it here
update_vm_sriov_nics(zkhandler, dom_uuid, zkhandler.read(('domain.node', dom_uuid)), target_node)
lock = zkhandler.exclusivelock(('domain.state', dom_uuid)) lock = zkhandler.exclusivelock(('domain.state', dom_uuid))
with lock: with lock:
zkhandler.write([ zkhandler.write([
@ -741,6 +749,10 @@ def unmigrate_vm(zkhandler, domain, wait=False, force_live=False):
retmsg = 'Unmigrating VM "{}" back to node "{}".'.format(domain, target_node) retmsg = 'Unmigrating VM "{}" back to node "{}".'.format(domain, target_node)
if target_state not in ['migrate', 'migrate-live']:
# Update any SR-IOV NICs - with online migrations this is done by pvcnoded, but offline we must do it here
update_vm_sriov_nics(zkhandler, dom_uuid, zkhandler.read(('domain.node', dom_uuid)), target_node)
lock = zkhandler.exclusivelock(('domain.state', dom_uuid)) lock = zkhandler.exclusivelock(('domain.state', dom_uuid))
with lock: with lock:
zkhandler.write([ zkhandler.write([