]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
StorPool: clean up the last uses of str.format()
authorPeter Penchev <openstack-dev@storpool.com>
Fri, 12 Jun 2015 07:41:52 +0000 (10:41 +0300)
committerPeter Penchev <openstack-dev@storpool.com>
Mon, 13 Jul 2015 20:19:47 +0000 (23:19 +0300)
Replace three logging uses of str.format() with parameters passed
directly to LOG.error(), simplifying them in the process by
avoiding the need to call six.text_type() ourselves.

Replace the remaining use with string concatenation.

Suggested by: Sean McGinnis in review 188725
Change-Id: Ie53c394d7f31fa1dccfa4ed5c4b514539c77aa05

cinder/volume/drivers/storpool.py

index d69feaf88fbff363c78f3c3bd5f6423f2625848c..ae49beaf86c636a9dc0bebc0c19451971cf44b64 100644 (file)
@@ -179,8 +179,9 @@ class StorPoolDriver(driver.TransferVD, driver.ExtendVD, driver.CloneableVD,
                 self._attach.api().snapshotDelete(snapname)
             except spapi.ApiError as e:
                 # ARGH!
-                LOG.error(_LE("Could not delete the temp snapshot {n}: {msg}").
-                          format(n=snapname, msg=six.text_type(e)))
+                LOG.error(_LE("Could not delete the temp snapshot %(name)s: "
+                              "%(msg)s"),
+                          {'name': snapname, 'msg': e})
 
     def create_export(self, context, volume):
         pass
@@ -221,8 +222,7 @@ class StorPoolDriver(driver.TransferVD, driver.ExtendVD, driver.CloneableVD,
         try:
             self._attach.api()
         except Exception as e:
-            LOG.error(_LE("StorPoolDriver API initialization failed: {e}").
-                      format(e=e))
+            LOG.error(_LE("StorPoolDriver API initialization failed: %s"), e)
             raise
 
     def get_volume_stats(self, refresh=False):
@@ -294,7 +294,7 @@ class StorPoolDriver(driver.TransferVD, driver.ExtendVD, driver.CloneableVD,
             self._attach.add(req_id, req)
         name = req['volume']
         self._attach.sync(req_id, None)
-        return {'device': {'path': '/dev/storpool/{v}'.format(v=name),
+        return {'device': {'path': '/dev/storpool/' + name,
                 'storpool_attach_req': req_id}}, volume
 
     def _detach_volume(self, context, attach_info, volume, properties,
@@ -336,8 +336,9 @@ class StorPoolDriver(driver.TransferVD, driver.ExtendVD, driver.CloneableVD,
                 self._attach.api().snapshotDelete(name)
             except spapi.ApiError as e:
                 LOG.error(
-                    _LE('Could not remove the temp snapshot {n} for {v}: {e}').
-                    format(n=name, v=volname, e=six.text_type(e)))
+                    _LE('Could not remove the temp snapshot %(name)s for '
+                        '%(vol)s: %(err)s'),
+                    {'name': name, 'vol': volname, 'err': e})
 
     def copy_volume_to_image(self, context, volume, image_service, image_meta):
         req_id = context.request_id
@@ -363,8 +364,9 @@ class StorPoolDriver(driver.TransferVD, driver.ExtendVD, driver.CloneableVD,
                 self._attach.api().snapshotDelete(name)
             except spapi.ApiError as e:
                 LOG.error(
-                    _LE('Could not remove the temp snapshot {n} for {v}: {e}').
-                    format(n=name, v=volname, e=six.text_type(e)))
+                    _LE('Could not remove the temp snapshot %(name)s for '
+                        '%(vol)s: %(err)s'),
+                    {'name': name, 'vol': volname, 'err': e})
 
     def copy_image_to_volume(self, context, volume, image_service, image_id):
         req_id = context.request_id