Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from novaclient import client
- #NOVA
- VERSION="2"
- USER="admin"
- PASSWORD="Password"
- TENANT="admin"
- AUTH_URL="http://X.X.X.X:5000/v2.0"
- tup=(UserID,DisplayName) #Get Tuple of UserID, Display name from Nova DB
- nt = client.Client(VERSION, USER, PASSWORD, TENANT, AUTH_URL)
- if nt is not None:
- search_opts = { 'all_tenants': "1" } # List Vms of all Tenants
- for i in nt.servers.list(search_opts=search_opts):
- if( i.user_id == tup[0] and i.name== tup[1]):#Compare User ID, Display Name of API with UserID, Display Name @ DB
- print i.addresses
- vm_ip=i.addresses # Got the IP Address , hooray !
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement