Advertisement
krishnanvenku

Python Nova Client Updated

Mar 11th, 2016
8,438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import json
  2. from novaclient import client
  3.  
  4. VERSION="2"
  5. USER="admin"
  6. PASSWORD="PASSWORD"
  7. TENANT="admin"
  8. AUTH_URL="http://X.X.X.X:5000/v2.0"
  9.  
  10. nt = client.Client(VERSION, USER, PASSWORD, TENANT, AUTH_URL)
  11.  
  12. print nt.flavors.list()
  13.  
  14. #THIS IS EQUIVALENT --ALL-TENANTS ARGUMENT GIVEN IN NOVA COMMAND
  15. #This will print the VMs of all the Tenants .
  16.  
  17. search_opts = {
  18.         'all_tenants': "1"
  19. }
  20.  
  21. for i in nt.servers.list(search_opts=search_opts):
  22.     print i.name, # Instance Name given at Horizon
  23.           i.user_id # User ID of the VM Owner
  24.           i.addresses #IP Address a dictionary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement