Skip to content
Snippets Groups Projects
Commit 6b55524f authored by sguazt's avatar sguazt
Browse files

OpenStack: updated the authentication part used by Gnocchi and Ceilometer...

OpenStack: updated the authentication part used by Gnocchi and Ceilometer clients to fit recent updates in OpenStack
parent 1fcbcc17
No related branches found
No related tags found
No related merge requests found
......@@ -2,28 +2,22 @@
OpenStack monitor implementation (using Ceilometer/Gnocchi API)
"""
__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"
import datetime
from easycloud.core.metamonitor import MetaMonitor
#from keystoneauth1 import exceptions as ks_exception
from keystoneauth1 import loading as ks_loading
#from keystoneauth1 import session as ks_session
#from keystoneauth1 import loading as ks_loading
#from keystoneclient.v3 import client as ks_client_v3
from keystoneauth1 import session as ks_session
from keystoneauth1.identity import v3 as ks_v3
import logging
import pytz
from tzlocal import get_localzone
class OpenStackMonitor(MetaMonitor):
"""
OpenStack Monitor.
"""
def __init__(self, conf, commands_queue, measurements_queue):
"""
......@@ -291,16 +285,26 @@ class OpenStackGnocchiClientDriver():
"""
Connect to Gnocchi and initialize its client object
"""
loader = ks_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")
#loader = ks_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.client_ = gnocchiclient.client.Client("1",
# 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.client_ = gnocchiclient.client.Client("1",
adapter_options={
"region_name": self.conf.os_region},
session_options={"auth": _auth})
session=sess,
adapter_options={"region_name": self.conf_.os_region})
# For the complete metrics list available for each instance, please use the
# res_viewer.py script available in the module main directory, after
......
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