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.
This commit is contained in:
Joshua Boniface 2019-12-26 11:08:16 -05:00
parent b3483fa810
commit 20ae2186f9
1 changed files with 3 additions and 1 deletions

View File

@ -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):