avoid iterationa nd use search option in nova

parent 474d9a9f
......@@ -93,16 +93,17 @@ def actionIDS(start_response, cmd, name, vlan, tunid, switchid=None, ryuip=None)
credentials = get_nova_credentials_v2()
nova_client = Client(**credentials)
server_list = nova_client.servers.list()
server_list = nova_client.servers.list(search_opts={"name": name})
ids = None
for server in server_list:
if server.name == name:
ids = server
break;
else:
print "No IDS Found"
sys.exit(0)
break;
if ids is None:
print "No IDS found"
return;
ids_dict = vars(ids);
network_info = ids_dict['addresses']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment