Skip to content
Snippets Groups Projects
Commit 1fcbcc17 authored by sguazt's avatar sguazt
Browse files

Chameleon: updated the authentication part used by Gnocchi client to fit...

Chameleon: updated the authentication part used by Gnocchi client to fit recent updates in Chameleon Cloud
parent 0b0d7855
No related branches found
No related tags found
No related merge requests found
......@@ -5,23 +5,19 @@ Chameleon Cloud monitor implementation (using Gnocchi API)
import datetime
from easycloud.core.metamonitor import MetaMonitor
from gnocchiclient.v1 import client
from keystoneauth1 import loading
#from keystoneauth1 import loading
from keystoneauth1 import session as ks_session
from keystoneauth1.identity import v3 as ks_v3
#from keystoneclient.v3 import client
import logging
import pytz
from tzlocal import get_localzone
__author__ = "Davide Monfrecola, Stefano Garione, Giorgio Gambino, Luca Banzato"
__copyright__ = "Copyright (C) 2019"
__credits__ = ["Andrea Lombardo", "Irene Lovotti"]
__license__ = "GPL v3"
__version__ = "0.10.0"
__maintainer__ = "Luca Banzato"
__email__ = "20005492@studenti.uniupo.it"
__status__ = "Prototype"
class ChameleonCloudMonitor(MetaMonitor):
"""
Chameleon Cloud Monitor.
"""
def __init__(self, conf, commands_queue, measurements_queue, metrics_file=None):
"""
......@@ -50,14 +46,24 @@ class ChameleonCloudMonitor(MetaMonitor):
"""
Connect to Gnocchi and initialize its client object
"""
_loader = loading.get_plugin_loader('password')
_auth = _loader.load_from_options(auth_url=self.conf.os_auth_url,
username=self.conf.os_username,
password=self.conf.os_password,
project_id=self.conf.os_project_id,
user_domain_name="default")
self.gnocchi_client = client.Client(adapter_options={
"region_name": self.conf.os_region}, session_options={"auth": _auth})
#_loader = loading.get_plugin_loader('password')
#_auth = _loader.load_from_options(auth_url=self.conf.os_auth_url,
# username=self.conf.os_username,
# password=self.conf.os_password,
# project_id=self.conf.os_project_id,
# user_domain_name="default")
#self.gnocchi_client = client.Client(adapter_options={
# "region_name": self.conf.os_region}, session_options={"auth": _auth})
auth = ks_v3.Password(auth_url=self.conf.os_auth_url,
username=self.conf.os_username,
password=self.conf.os_password,
project_name=self.conf.os_project_name,
user_domain_id='default',
project_domain_id='default')
sess = ks_session.Session(auth=auth)
self.gnocchi_client = client.Client(session=sess,
adapter_options={"region_name": self.conf.os_region})
def _get_metric_values(self, instance_id, metric, granularity, limit):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment