]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix Cinder logs to show authentication error in RBD driver
authorYuriy Nesenenko <ynesenenko@mirantis.com>
Tue, 10 Mar 2015 10:27:51 +0000 (12:27 +0200)
committerYuriy Nesenenko <ynesenenko@mirantis.com>
Thu, 12 Mar 2015 15:11:41 +0000 (17:11 +0200)
The Cinder logs fail to report authentication error when working
with the RBD driver.

Change-Id: I3d190d6359c744efe0c6d0612bd0f2d2e6b0ab0d
Closes-Bug: #1389983

cinder/volume/drivers/rbd.py

index 55a626b746cd6ef9aba387fc9e6ea42764aefab5..8b3f93d832e9d82067b0c4b2afe38ab1a75fc317 100644 (file)
@@ -280,13 +280,12 @@ class RBDDriver(driver.VolumeDriver):
         if rados is None:
             msg = _('rados and rbd python libraries not found')
             raise exception.VolumeBackendAPIException(data=msg)
-        try:
-            with RADOSClient(self):
-                pass
-        except self.rados.Error:
-            msg = _('error connecting to ceph cluster')
-            LOG.exception(msg)
-            raise exception.VolumeBackendAPIException(data=msg)
+
+        # NOTE: Checking connection to ceph
+        # RADOSClient __init__ method invokes _connect_to_rados
+        # so no need to check for self.rados.Error here.
+        with RADOSClient(self):
+            pass
 
     def _ceph_args(self):
         args = []
@@ -315,11 +314,12 @@ class RBDDriver(driver.VolumeDriver):
                 client.connect()
             ioctx = client.open_ioctx(pool)
             return client, ioctx
-        except self.rados.Error as exc:
-            LOG.error(_LE("error connecting to ceph cluster."))
+        except self.rados.Error:
+            msg = _("Error connecting to ceph cluster.")
+            LOG.exception(msg)
             # shutdown cannot raise an exception
             client.shutdown()
-            raise exception.VolumeBackendAPIException(data=str(exc))
+            raise exception.VolumeBackendAPIException(data=msg)
 
     def _disconnect_from_rados(self, client, ioctx):
         # closing an ioctx cannot raise an exception