Merge "Add Gnocchi datasource"

This commit is contained in:
Jenkins
2017-03-24 09:00:33 +00:00
committed by Gerrit Code Review
9 changed files with 254 additions and 3 deletions

View File

@@ -13,6 +13,7 @@
from ceilometerclient import client as ceclient
from cinderclient import client as ciclient
from glanceclient import client as glclient
from gnocchiclient import client as gnclient
from keystoneauth1 import loading as ka_loading
from keystoneclient import client as keyclient
from monascaclient import client as monclient
@@ -39,6 +40,7 @@ class OpenStackClients(object):
self._keystone = None
self._nova = None
self._glance = None
self._gnocchi = None
self._cinder = None
self._ceilometer = None
self._monasca = None
@@ -92,6 +94,17 @@ class OpenStackClients(object):
session=self.session)
return self._glance
@exception.wrap_keystone_exception
def gnocchi(self):
if self._gnocchi:
return self._gnocchi
gnocchiclient_version = self._get_client_option('gnocchi',
'api_version')
self._gnocchi = gnclient.Client(gnocchiclient_version,
session=self.session)
return self._gnocchi
@exception.wrap_keystone_exception
def cinder(self):
if self._cinder:

View File

@@ -130,7 +130,7 @@ class OperationNotPermitted(NotAuthorized):
msg_fmt = _("Operation not permitted")
class Invalid(WatcherException):
class Invalid(WatcherException, ValueError):
msg_fmt = _("Unacceptable parameters")
code = 400
@@ -149,6 +149,10 @@ class ResourceNotFound(ObjectNotFound):
code = 404
class InvalidParameter(Invalid):
msg_fmt = _("%(parameter)s has to be of type %(parameter_type)s")
class InvalidIdentity(Invalid):
msg_fmt = _("Expected a uuid or int but received %(identity)s")