]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixing format for log messages
authorArkadyKanevsky <arkady_kanevsky@dell.com>
Wed, 27 Aug 2014 21:47:37 +0000 (16:47 -0500)
committerArkadyKanevsky <arkady_kanevsky@dell.com>
Sat, 27 Sep 2014 13:23:25 +0000 (08:23 -0500)
code_cleanup_batching for EQL driver
Follow log essage format for i18n - http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Closes-Bug: 1362337

Change-Id: Ic3726f725efa4d29204e8530a8f191b801a4aac8

cinder/volume/drivers/eqlx.py

index f7fbf16254fb051ad2efbd84a507d1426777eab7..ab54ca15620e1ac7e332f0f44ebd64da1854b6f2 100644 (file)
@@ -157,11 +157,11 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
         self._get_output(chan)
 
         cmd = 'stty columns 255'
-        LOG.debug("Setting CLI terminal width: '%s'", cmd)
+        LOG.debug("Setting CLI terminal width: '%s'.", cmd)
         chan.send(cmd + '\r')
         out = self._get_output(chan)
 
-        LOG.debug("Sending CLI command: '%s'", command)
+        LOG.debug("Sending CLI command: '%s'.", command)
         chan.send(command + '\r')
         out = self._get_output(chan)
 
@@ -199,7 +199,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
                 while attempts > 0:
                     attempts -= 1
                     try:
-                        LOG.info(_('EQL-driver: executing "%s"') % command)
+                        LOG.info(_('EQL-driver: executing "%s".'), command)
                         return self._ssh_execute(
                             ssh, command,
                             timeout=self.configuration.eqlx_cli_timeout)
@@ -215,7 +215,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
 
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_("Error running SSH command: %s") % command)
+                LOG.error(_('Error running SSH command: "%s".'), command)
 
     def _eql_execute(self, *args, **kwargs):
         return self._run_ssh(
@@ -247,7 +247,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
     def _update_volume_stats(self):
         """Retrieve stats info from eqlx group."""
 
-        LOG.debug("Updating volume stats")
+        LOG.debug('Updating volume stats.')
         data = {}
         backend_name = "eqlx"
         if self.configuration:
@@ -322,11 +322,11 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
                     out_tup = line.rstrip().partition(' ')
                     self._group_ip = out_tup[-1]
 
-            LOG.info(_("EQL-driver: Setup is complete, group IP is %s"),
+            LOG.info(_('EQL-driver: Setup is complete, group IP is "%s".'),
                      self._group_ip)
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to setup the Dell EqualLogic driver'))
+                LOG.error(_('Failed to setup the Dell EqualLogic driver.'))
 
     def create_volume(self, volume):
         """Create a volume."""
@@ -343,7 +343,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
             return self._get_volume_data(out)
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to create volume %s'), volume['name'])
+                LOG.error(_('Failed to create volume "%s".'), volume['name'])
 
     def add_multihost_access(self, volume):
         """Add multihost-access to a volume. Needed for live migration."""
@@ -353,7 +353,8 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
             self._eql_execute(*cmd)
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to add multi-host access for volume %s'),
+                LOG.error(_('Failed to add multihost-access'
+                          ' for volume "%s".'),
                           volume['name'])
 
     def delete_volume(self, volume):
@@ -363,11 +364,11 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
             self._eql_execute('volume', 'select', volume['name'], 'offline')
             self._eql_execute('volume', 'delete', volume['name'])
         except exception.VolumeNotFound:
-            LOG.warn(_('Volume %s was not found while trying to delete it'),
+            LOG.warn(_('Volume %s was not found while trying to delete it.'),
                      volume['name'])
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to delete volume %s'), volume['name'])
+                LOG.error(_('Failed to delete volume "%s".'), volume['name'])
 
     def create_snapshot(self, snapshot):
         """"Create snapshot of existing volume on appliance."""
@@ -382,7 +383,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
                               snapshot['name'])
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to create snapshot of volume %s'),
+                LOG.error(_('Failed to create snapshot of volume "%s".'),
                           snapshot['volume_name'])
 
     def create_volume_from_snapshot(self, volume, snapshot):
@@ -396,7 +397,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
             return self._get_volume_data(out)
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to create volume from snapshot %s'),
+                LOG.error(_('Failed to create volume from snapshot "%s".'),
                           snapshot['name'])
 
     def create_cloned_volume(self, volume, src_vref):
@@ -410,7 +411,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
             return self._get_volume_data(out)
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to create clone of volume %s'),
+                LOG.error(_('Failed to create clone of volume "%s".'),
                           volume['name'])
 
     def delete_snapshot(self, snapshot):
@@ -421,9 +422,9 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
         except Exception:
             with excutils.save_and_reraise_exception():
                 LOG.error(_('Failed to delete snapshot %(snap)s of '
-                            'volume %(vol)s'),
+                          'volume %(vol)s.'),
                           {'snap': snapshot['name'],
-                           'vol': snapshot['volume_name']})
+                          'vol': snapshot['volume_name']})
 
     def initialize_connection(self, volume, connector):
         """Restrict access to a volume."""
@@ -441,7 +442,8 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
             }
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to initialize connection to volume %s'),
+                LOG.error(_('Failed to initialize connection'
+                          ' to volume "%s".'),
                           volume['name'])
 
     def terminate_connection(self, volume, connector, force=False, **kwargs):
@@ -455,7 +457,8 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
                                   'access', 'delete', connection_id)
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to terminate connection to volume %s'),
+                LOG.error(_('Failed to terminate connection'
+                          ' to volume "%s".'),
                           volume['name'])
 
     def create_export(self, context, volume):
@@ -476,11 +479,11 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
         try:
             self._check_volume(volume)
         except exception.VolumeNotFound:
-            LOG.warn(_('Volume %s is not found!, it may have been deleted'),
+            LOG.warn(_('Volume %s is not found!, it may have been deleted.'),
                      volume['name'])
         except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_('Failed to ensure export of volume %s'),
+                LOG.error(_('Failed to ensure export of volume "%s".'),
                           volume['name'])
 
     def remove_export(self, context, volume):
@@ -500,9 +503,9 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
         except Exception:
             with excutils.save_and_reraise_exception():
                 LOG.error(_('Failed to extend_volume %(name)s from '
-                            '%(current_size)sGB to %(new_size)sGB'),
+                          '%(current_size)sGB to %(new_size)sGB.'),
                           {'name': volume['name'],
-                           'current_size': volume['size'],
+                          'current_size': volume['size'],
                            'new_size': new_size})
 
     def local_path(self, volume):