From 68c7481aa26245b48de467972f03ac5336e42bab Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 21 Jun 2021 23:35:52 -0400 Subject: [PATCH] Ensure offline migrations update SR-IOV NIC states --- daemon-common/vm.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/daemon-common/vm.py b/daemon-common/vm.py index 7ab78a7f..3357794e 100644 --- a/daemon-common/vm.py +++ b/daemon-common/vm.py @@ -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) + 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)) with lock: 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) + 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)) with lock: 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) + 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)) with lock: zkhandler.write([