Guest User

Untitled

a guest
Dec 23rd, 2015
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. from oslo_config import cfg
  2. from watcher.common.nova import NovaClient
  3.  
  4. from watcher.common.keystone import KeystoneClient
  5. from watcher.metrics_engine.cluster_model_collector.nova import \
  6.     NovaClusterModelCollector
  7.  
  8. cfg.CONF.keystone_authtoken.auth_uri = "http://10.50.0.108:5000/v3/"
  9. cfg.CONF.keystone_authtoken.admin_user = "admin"
  10. cfg.CONF.keystone_authtoken.admin_password = "openstacktest"
  11. cfg.CONF.keystone_authtoken.admin_tenant_name = "admin"
  12. cfg.CONF.keystone_authtoken.auth_version = "v3"
  13. cfg.CONF.debug = True
  14.  
  15. keystone = KeystoneClient()
  16. wrapper = NovaClient(keystone.get_credentials(),
  17.                      session=keystone.get_session())
  18.  
  19.  
  20. model_collector = NovaClusterModelCollector(wrapper=wrapper)
  21.  
  22. hypervisors = wrapper.get_hypervisors_list()
  23.  
  24. for hypervisor in hypervisors:
  25.     print(hypervisor)
  26.  
  27.  
  28. cluster_data_model = model_collector.get_latest_cluster_data_model()
  29.  
  30. print(cluster_data_model)
Add Comment
Please, Sign In to add comment