From 35a6154d347bbb1fddaab47f2a6511bce553924b Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 17 Jul 2018 00:14:46 -0400 Subject: [PATCH] Add try for lasthypervisor request Fixes a bug whereby lasthypervisor would be empty because a VM had never migrated before. This situation should never matter in an actually-migrated VM since the ZK value would be set and as such is simply discarded. --- pvcd/NodeInstance.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pvcd/NodeInstance.py b/pvcd/NodeInstance.py index 091213b1..eb8fbf6c 100644 --- a/pvcd/NodeInstance.py +++ b/pvcd/NodeInstance.py @@ -170,7 +170,11 @@ class NodeInstance(): ansiiprint.echo('Restoring node {} to active service.'.format(self.name), '', 'i') zkhandler.writedata(self.zk_conn, { '/nodes/{}/domainstate'.format(self.name): 'ready' }) for dom_uuid in self.s_domain: - last_hypervisor = zkhandler.readdata(self.zk_conn, '/domains/{}/lasthypervisor'.format(dom_uuid)) + try: + last_hypervisor = zkhandler.readdata(self.zk_conn, '/domains/{}/lasthypervisor'.format(dom_uuid)) + except: + continue + if last_hypervisor != self.name: continue