From d68438ad90fac4716e33bfc3f728fb52759b893b Mon Sep 17 00:00:00 2001 From: Niv Oppenhaim Date: Mon, 11 Jun 2018 12:09:48 +0000 Subject: [PATCH] add support for gnocchi client Change-Id: I65dd102635b1f6c6500a9c34da130aaea33708b2 --- lower-constraints.txt | 1 + requirements.txt | 1 + vitrage/os_clients.py | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/lower-constraints.txt b/lower-constraints.txt index 4915127ec..ab6e5dac2 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -25,6 +25,7 @@ fixtures==3.0.0 flake8==2.5.5 future==0.16.0 futurist==1.6.0 +gnocchiclient==3.3.1 greenlet==0.4.13 hacking==0.12.0 idna==2.6 diff --git a/requirements.txt b/requirements.txt index 4e3023226..90f4a21fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,6 +15,7 @@ python-novaclient>=10.1.0 # Apache-2.0 python-heatclient>=1.14.0 # Apache-2.0 python-mistralclient>=3.3.0 # Apache-2.0 python-openstackclient>=3.12.0 # Apache-2.0 +gnocchiclient>=3.3.1 # Apache-2.0 pyzabbix>=0.7.4 # LGPL networkx>=1.11 # BSD oslo.config>=5.2.0 # Apache-2.0 diff --git a/vitrage/os_clients.py b/vitrage/os_clients.py index 6af5567ec..d339d09ce 100644 --- a/vitrage/os_clients.py +++ b/vitrage/os_clients.py @@ -28,6 +28,7 @@ OPTS = [ cfg.StrOpt('glance_version', default='2', help='Glance version'), cfg.StrOpt('heat_version', default='1', help='Heat version'), cfg.StrOpt('mistral_version', default='2', help='Mistral version'), + cfg.StrOpt('gnocchi_version', default='1', help='Gnocchi version') ] _client_modules = { @@ -39,6 +40,7 @@ _client_modules = { 'neutron': 'neutronclient.v2_0.client', 'heat': 'heatclient.client', 'mistral': 'mistralclient.api.v2.client', + 'gnocchi': 'gnocchiclient.v1.client' } @@ -48,6 +50,18 @@ def driver_module(driver): return module +def gnocchi_client(conf): + """Get an instance of the gnocchi client""" + try: + gn_client = driver_module('gnocchi') + client = gn_client.Client( + session=keystone_client.get_session(conf)) + LOG.info('Gnocchi client created') + return client + except Exception: + LOG.exception('Create Gnocchi client - Got Exception') + + def aodh_client(conf): """Get an instance of aodh client""" try: