From: Yuriy Nesenenko Date: Tue, 10 Mar 2015 10:27:51 +0000 (+0200) Subject: Fix Cinder logs to show authentication error in RBD driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5e580c7af4ddede8be3e24be10754b70728e18c8;p=openstack-build%2Fcinder-build.git Fix Cinder logs to show authentication error in RBD driver The Cinder logs fail to report authentication error when working with the RBD driver. Change-Id: I3d190d6359c744efe0c6d0612bd0f2d2e6b0ab0d Closes-Bug: #1389983 --- diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index 55a626b74..8b3f93d83 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -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