From 1dbe0d64bad085751423d0d9918ee5c5a068d908 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 17 Jul 2018 01:04:35 -0400 Subject: [PATCH] Thread the flush function Prevents a bug where the flush function blocks receiving migrations --- pvcd/NodeInstance.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pvcd/NodeInstance.py b/pvcd/NodeInstance.py index f23b1d8f..b88a2acc 100644 --- a/pvcd/NodeInstance.py +++ b/pvcd/NodeInstance.py @@ -64,11 +64,12 @@ class NodeInstance(): # toggle state management of this node if self.name == self.this_node: if self.domain_state == 'flush' and self.inflush == False: - self.flush() + # Do flushing in a thread so it doesn't block the migrates out + flush_thread = threading.Thread(target=flush, args=(self), kwargs={}) + flush_thread.start() if self.domain_state == 'unflush' and self.inflush == False: self.unflush() - @zk_conn.DataWatch('/nodes/{}/memfree'.format(self.name)) def watch_hypervisor_memfree(data, stat, event=""): try: