From be20ba02a78324196aad7dde7478139961b7c400 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 5 Jan 2020 15:21:16 -0500 Subject: [PATCH] Handle VM states in flush more accurately We don't want to block forever on a failure, so limit valid waiting states to just those we know it should be in during a migration. --- node-daemon/pvcd/NodeInstance.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node-daemon/pvcd/NodeInstance.py b/node-daemon/pvcd/NodeInstance.py index e0188972..b4913e4e 100644 --- a/node-daemon/pvcd/NodeInstance.py +++ b/node-daemon/pvcd/NodeInstance.py @@ -643,7 +643,7 @@ class NodeInstance(object): zkhandler.writedata(self.zk_conn, { '/domains/{}/node_autostart'.format(dom_uuid): 'True' }) # Wait for the VM to shut down - while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) != 'stop': + while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) in ['shutdown']: time.sleep(1) continue @@ -656,7 +656,7 @@ class NodeInstance(object): }) # Wait for the VM to migrate so the next VM's free RAM count is accurate (they migrate in serial anyways) - while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) != 'start': + while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) in ['migrate', 'unmigrate', 'shutdown']: time.sleep(1) zkhandler.writedata(self.zk_conn, { '/nodes/{}/runningdomains'.format(self.name): '' }) @@ -705,7 +705,7 @@ class NodeInstance(object): }) # Wait for the VM to migrate back - while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) != 'start': + while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) in ['migrate', 'unmigrate', 'shutdown']: time.sleep(1) zkhandler.writedata(self.zk_conn, { '/nodes/{}/domainstate'.format(self.name): 'ready' })