Add try block around cur hypervisor
On initial deploy this doesn't work since the value is empty; just set the value to None in this case.
This commit is contained in:
parent
962cc0f5b0
commit
fe93b1ed3c
4
pvc.py
4
pvc.py
|
@ -372,7 +372,11 @@ def findTargetHypervisor(zk_conn, search_field, dom_uuid):
|
||||||
def getHypervisors(zk_conn, dom_uuid):
|
def getHypervisors(zk_conn, dom_uuid):
|
||||||
valid_hypervisor_list = []
|
valid_hypervisor_list = []
|
||||||
full_hypervisor_list = zk_conn.get_children('/nodes')
|
full_hypervisor_list = zk_conn.get_children('/nodes')
|
||||||
|
|
||||||
|
try:
|
||||||
current_hypervisor = zk_conn.get('/domains/{}/hypervisor'.format(dom_uuid))[0].decode('ascii')
|
current_hypervisor = zk_conn.get('/domains/{}/hypervisor'.format(dom_uuid))[0].decode('ascii')
|
||||||
|
except:
|
||||||
|
current_hypervisor = None
|
||||||
|
|
||||||
for hypervisor in full_hypervisor_list:
|
for hypervisor in full_hypervisor_list:
|
||||||
daemon_state = zk_conn.get('/nodes/{}/daemonstate'.format(hypervisor))[0].decode('ascii')
|
daemon_state = zk_conn.get('/nodes/{}/daemonstate'.format(hypervisor))[0].decode('ascii')
|
||||||
|
|
Loading…
Reference in New Issue