]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
DRBD: Log an error if libraries can't be loaded
authorPhilipp Marek <philipp.marek@linbit.com>
Mon, 19 Jan 2015 13:29:57 +0000 (14:29 +0100)
committerPhilipp Marek <philipp.marek@linbit.com>
Mon, 19 Jan 2015 14:21:19 +0000 (15:21 +0100)
Having a meaningful error message is better than a backtrace.

Change-Id: I0631228228db06efdedd65a44a286824b34e0b1a

cinder/volume/drivers/drbdmanagedrv.py

index a87f66371968ccf43fd131a65fe695f2b9f383ec..6d89512c890cada02c7943500ab44e48a1d51757 100644 (file)
@@ -127,6 +127,11 @@ class DrbdManageDriver(driver.VolumeDriver):
 
     def check_for_setup_error(self):
         """Verify that requirements are in place to use DRBDmanage driver."""
+        if not all((dbus, dm_exc, dm_const, dm_utils)):
+            msg = _('DRBDmanage driver setup error: some required '
+                    'libraries (dbus, drbdmanage.*) not found.')
+            LOG.error(msg)
+            raise exception.VolumeDriverException(message=msg)
         if self.odm.ping() != 0:
             message = _('Cannot ping DRBDmanage backend')
             raise exception.VolumeBackendAPIException(data=message)