Don't throw exception while defining new VM
This would throw an exception since we tried to find the current host of a VM that did not exist yet. If this happens, just get None.
This commit is contained in:
parent
8c252aeecc
commit
2d14fabe62
|
@ -334,7 +334,10 @@ def findTargetNode(zk_conn, dom_uuid):
|
||||||
def getNodes(zk_conn, node_limit, dom_uuid):
|
def getNodes(zk_conn, node_limit, dom_uuid):
|
||||||
valid_node_list = []
|
valid_node_list = []
|
||||||
full_node_list = zkhandler.listchildren(zk_conn, '/nodes')
|
full_node_list = zkhandler.listchildren(zk_conn, '/nodes')
|
||||||
current_node = zkhandler.readdata(zk_conn, '/domains/{}/node'.format(dom_uuid))
|
try:
|
||||||
|
current_node = zkhandler.readdata(zk_conn, '/domains/{}/node'.format(dom_uuid))
|
||||||
|
except kazoo.exceptions.NoNodeError:
|
||||||
|
current_node = None
|
||||||
|
|
||||||
for node in full_node_list:
|
for node in full_node_list:
|
||||||
if node_limit and node not in node_limit:
|
if node_limit and node not in node_limit:
|
||||||
|
|
Loading…
Reference in New Issue