Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from oslo_config import cfg
- from watcher.common.nova import NovaClient
- from watcher.common.keystone import KeystoneClient
- from watcher.metrics_engine.cluster_model_collector.nova import \
- NovaClusterModelCollector
- cfg.CONF.keystone_authtoken.auth_uri = "http://10.50.0.108:5000/v3/"
- cfg.CONF.keystone_authtoken.admin_user = "admin"
- cfg.CONF.keystone_authtoken.admin_password = "openstacktest"
- cfg.CONF.keystone_authtoken.admin_tenant_name = "admin"
- cfg.CONF.keystone_authtoken.auth_version = "v3"
- cfg.CONF.debug = True
- keystone = KeystoneClient()
- wrapper = NovaClient(keystone.get_credentials(),
- session=keystone.get_session())
- model_collector = NovaClusterModelCollector(wrapper=wrapper)
- hypervisors = wrapper.get_hypervisors_list()
- for hypervisor in hypervisors:
- print(hypervisor)
- cluster_data_model = model_collector.get_latest_cluster_data_model()
- print(cluster_data_model)
Add Comment
Please, Sign In to add comment