]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Do not translate debug messages
authorThang Pham <thang.g.pham@gmail.com>
Thu, 7 Aug 2014 21:41:11 +0000 (17:41 -0400)
committerThang Pham <thang.g.pham@gmail.com>
Fri, 8 Aug 2014 02:30:18 +0000 (22:30 -0400)
LOG.debug messages do not need to be translated. The rdb driver
has a couple of debug messages that are translated. This patch
removes those debug translations.

Also, logging exception.ImageUnacceptable can contain non-ascii
characters. This patch fixes this by using six.text_type to
properly translate the exception.

Change-Id: I4ed36173f42b7bf487463f148ae94bd061f6bebb

cinder/volume/drivers/rbd.py

index 827675c1241e6513d0ab26dd4a16ec2f9bbf4c8e..6deae00cffe11b7cb651b0dd4f0b9fe83541f7bd 100644 (file)
@@ -18,6 +18,7 @@ import io
 import json
 import math
 import os
+import six
 import tempfile
 import urllib
 
@@ -747,18 +748,18 @@ class RBDDriver(driver.VolumeDriver):
         try:
             fsid, pool, image, snapshot = self._parse_location(image_location)
         except exception.ImageUnacceptable as e:
-            LOG.debug('not cloneable: %s', e)
+            LOG.debug('not cloneable: %s', six.text_type(e))
             return False
 
         if self._get_fsid() != fsid:
-            reason = _('%s is in a different ceph cluster') % image_location
+            reason = ('%s is in a different ceph cluster') % image_location
             LOG.debug(reason)
             return False
 
         if image_meta['disk_format'] != 'raw':
-            reason = _("rbd image clone requires image format to be "
-                       "'raw' but image {0} is '{1}'").format(
-                           image_location, image_meta['disk_format'])
+            reason = ("rbd image clone requires image format to be "
+                      "'raw' but image {0} is '{1}'").format(
+                          image_location, image_meta['disk_format'])
             LOG.debug(reason)
             return False