]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add the driver name to get stats log output
authorWalter A. Boring IV <walter.boring@hp.com>
Mon, 9 Dec 2013 19:58:40 +0000 (11:58 -0800)
committerWalter A. Boring IV <walter.boring@hp.com>
Wed, 11 Dec 2013 23:26:07 +0000 (15:26 -0800)
When the manager call tries to update the driver
stats, it checks to ensure the driver is initialized.
When the driver hasn't been initialized, it logs
a warning without the driver name.  This is confusing
for multiple backends.   This patch adds the driver
name, version and the config group name, to the log output,
so the admin can see which driver is failing.

Change-Id: I82e8aa969e7baa55db9c8dddc1c08db2a1a41091
Closes-Bug: #1259279

cinder/volume/manager.py

index a0f4e071d5a558d3a9cb7e65029ae91632a48d02..14377a0b33b403479d01aca9ba5b9e1148abd179 100644 (file)
@@ -888,8 +888,18 @@ class VolumeManager(manager.SchedulerDependentManager):
     def _report_driver_status(self, context):
         LOG.info(_("Updating volume status"))
         if not self.driver.initialized:
-            LOG.warning(_('Unable to update stats, driver is '
-                          'uninitialized'))
+            if self.driver.configuration.config_group is None:
+                config_group = ''
+            else:
+                config_group = ('(config name %s)' %
+                                self.driver.configuration.config_group)
+
+            LOG.warning(_('Unable to update stats, %(driver_name)s '
+                          '-%(driver_version)s '
+                          '%(config_group)s driver is uninitialized.') %
+                        {'driver_name': self.driver.__class__.__name__,
+                         'driver_version': self.driver.get_version(),
+                         'config_group': config_group})
         else:
             volume_stats = self.driver.get_volume_stats(refresh=True)
             if volume_stats: