From df6e5312457bb114072177ab9040d994a37a7f55 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Sun, 18 May 2014 06:32:58 +1000 Subject: [PATCH] Add log translation hints. Oslo would like to see hints like this in all of our code by the end of juno. I'll slowly trickle the changes out over the release. Change-Id: I5aa89ec5e1abd7222967467261de9fecb3afa57b --- nova/virt/libvirt/utils.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py index 5378e335bc8b..6a7c95296617 100644 --- a/nova/virt/libvirt/utils.py +++ b/nova/virt/libvirt/utils.py @@ -27,6 +27,9 @@ from oslo.config import cfg from nova import exception from nova.openstack.common.gettextutils import _ +from nova.openstack.common.gettextutils import _LE +from nova.openstack.common.gettextutils import _LI +from nova.openstack.common.gettextutils import _LW from nova.openstack.common import log as logging from nova.openstack.common import processutils from nova.openstack.common import units @@ -68,13 +71,13 @@ def get_fc_hbas(): # and systool is not installed # 96 = nova.cmd.rootwrap.RC_NOEXECFOUND: if exc.exit_code == 96: - LOG.warn(_("systool is not installed")) + LOG.warn(_LW("systool is not installed")) return [] except OSError as exc: # This handles the case where rootwrap is NOT used # and systool is not installed if exc.errno == errno.ENOENT: - LOG.warn(_("systool is not installed")) + LOG.warn(_LW("systool is not installed")) return [] if out is None: @@ -233,11 +236,11 @@ def create_lvm_image(vg, lv, size, sparse=False): preallocated_space = 64 * units.Mi check_size(vg, lv, preallocated_space) if free_space < size: - LOG.warning(_('Volume group %(vg)s will not be able' - ' to hold sparse volume %(lv)s.' - ' Virtual volume size is %(size)db,' - ' but free space on volume group is' - ' only %(free_space)db.'), + LOG.warn(_LW('Volume group %(vg)s will not be able' + ' to hold sparse volume %(lv)s.' + ' Virtual volume size is %(size)db,' + ' but free space on volume group is' + ' only %(free_space)db.'), {'vg': vg, 'free_space': free_space, 'size': size, @@ -287,7 +290,7 @@ def remove_rbd_volumes(pool, *names): try: _run_rbd(*rbd_remove, attempts=3, run_as_root=True) except processutils.ProcessExecutionError: - LOG.warn(_("rbd remove %(name)s in pool %(pool)s failed"), + LOG.warn(_LW("rbd remove %(name)s in pool %(pool)s failed"), {'name': name, 'pool': pool}) @@ -391,7 +394,7 @@ def clear_logical_volume(path): volume_clear = CONF.libvirt.volume_clear if volume_clear not in ('none', 'shred', 'zero'): - LOG.error(_("ignoring unrecognized volume_clear='%s' value"), + LOG.error(_LE("ignoring unrecognized volume_clear='%s' value"), volume_clear) volume_clear = 'zero' @@ -715,5 +718,5 @@ def is_mounted(mount_path, source=None): except OSError as exc: #info since it's not required to have this tool. if exc.errno == errno.ENOENT: - LOG.info(_("findmnt tool is not installed")) + LOG.info(_LI("findmnt tool is not installed")) return False