From 20ae2186f96594415d774a899ee9fad3cdf189ae Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 26 Dec 2019 11:08:16 -0500 Subject: [PATCH] Run VM state actions in a thread Prevents blocking the main thread(s) while a VM is changing state. In particular, this caused some issues with nodes not responding to cancellation/reversal of a flush/ready state until the previous migration was finished, which could cause issues. This entire subset of actions is now threaded and so can run on its own in the background. --- node-daemon/pvcd/VMInstance.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/node-daemon/pvcd/VMInstance.py b/node-daemon/pvcd/VMInstance.py index 7e786d93..4b759603 100644 --- a/node-daemon/pvcd/VMInstance.py +++ b/node-daemon/pvcd/VMInstance.py @@ -133,7 +133,9 @@ class VMInstance(object): return False # Perform a management command - self.manage_vm_state() + self.logger.out('Updating state of VM {}'.format(self.domuuid), state='i') + state_thread = threading.Thread(target=self.manage_vm_state, args=(), kwargs={}) + state_thread.start() # Get data functions def getstate(self):