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.
This commit is contained in:
Joshua Boniface 2018-07-17 00:14:46 -04:00
parent 01eec7b392
commit 35a6154d34
1 changed files with 5 additions and 1 deletions

View File

@ -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:
try:
last_hypervisor = zkhandler.readdata(self.zk_conn, '/domains/{}/lasthypervisor'.format(dom_uuid))
except:
continue
if last_hypervisor != self.name:
continue