X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwcal%2Fplugins%2Fvala%2Frwcal_openstack%2Frift%2Frwcal%2Fopenstack%2Fcinder%2Fcinder_drv.py;h=9c4bdb230a28308ed95e263cf987ed7f69e6e805;hb=f314b4af9744068a7ed7a6a6314220c3aa857523;hp=76bc8fe0e2939389b0fe145330712120de187494;hpb=411ef48f19a20a7a15d29c391c23a3bf6042e000;p=osm%2FSO.git diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/cinder/cinder_drv.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/cinder/cinder_drv.py index 76bc8fe0..9c4bdb23 100644 --- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/cinder/cinder_drv.py +++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/cinder/cinder_drv.py @@ -18,6 +18,7 @@ import logging from cinderclient import client as ciclient import cinderclient.exceptions as CinderException +import keystoneauth1 class CinderAPIVersionException(Exception): @@ -29,12 +30,16 @@ class CinderAPIVersionException(Exception): return self.__repr__() def __repr__(self): - msg = "{} : Following Exception(s) have occured during Neutron API discovery".format(self.__class__) + msg = "{} : Following Exception(s) have occured during Cinder API discovery".format(self.__class__) for n,e in enumerate(self.errors): msg += "\n" msg += " {}: {}".format(n, str(e)) return msg +class CinderEndpointException(Exception): + "Cinder Endpoint is absent" + pass + class CinderDriver(object): """ CinderDriver Class for image management @@ -89,6 +94,12 @@ class CinderDriver(object): else: raise CinderAPIVersionException(errors) + try: + self._ci_drv.client.get_endpoint() + except keystoneauth1.exceptions.catalog.EndpointNotFound: + self.log.info("Cinder endpoint not found") + raise CinderEndpointException() + @property def cinder_endpoint(self): return self._ci_drv.client.get_endpoint() @@ -144,6 +155,8 @@ class CinderDriver(object): """ try: vol = self._ci_drv.volumes.get(volume_id) + except ciclient.exceptions.NotFound: + return None except Exception as e: self.log.error("Get volume operation failed. Exception: %s", str(e)) raise