Don't translate debug level logs in nova.volume

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Change-Id: Ib529afea4d1696d8905e2d533803562130950d83
This commit is contained in:
Gary Kotton 2014-04-25 01:03:05 -07:00
parent 8c663cfca4
commit e64f30f423
4 changed files with 7 additions and 8 deletions

View File

@ -208,6 +208,7 @@ def no_translate_debug_logs(logical_line, filename):
"""
dirs = ["nova/scheduler",
"nova/network",
"nova/volume",
]
if max([name in filename for name in dirs]):
if logical_line.startswith("LOG.debug(_("):

View File

@ -90,7 +90,7 @@ def cinderclient(context):
service_name=service_name,
endpoint_type=endpoint_type)
LOG.debug(_('Cinderclient connection created using URL: %s') % url)
LOG.debug('Cinderclient connection created using URL: %s', url)
c = cinder_client.Client(context.user_id,
context.auth_token,

View File

@ -16,7 +16,6 @@
import os
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova import utils
from nova.volume.encryptors import base
@ -51,7 +50,7 @@ class CryptsetupEncryptor(base.VolumeEncryptor):
:param passphrase: the passphrase used to access the volume
"""
LOG.debug(_("opening encrypted volume %s"), self.dev_path)
LOG.debug("opening encrypted volume %s", self.dev_path)
# NOTE(joel-coffman): cryptsetup will strip trailing newlines from
# input specified on stdin unless --key-file=- is specified.
@ -92,7 +91,7 @@ class CryptsetupEncryptor(base.VolumeEncryptor):
def _close_volume(self, **kwargs):
"""Closes the device (effectively removes the dm-crypt mapping)."""
LOG.debug(_("closing encrypted volume %s"), self.dev_path)
LOG.debug("closing encrypted volume %s", self.dev_path)
utils.execute('cryptsetup', 'remove', self.dev_name,
run_as_root=True, check_exit_code=True)

View File

@ -16,7 +16,6 @@
import re
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova import utils
@ -39,7 +38,7 @@ class LuksEncryptor(cryptsetup.CryptsetupEncryptor):
:param passphrase: the passphrase used to access the volume
"""
LOG.debug(_("formatting encrypted volume %s"), self.dev_path)
LOG.debug("formatting encrypted volume %s", self.dev_path)
# NOTE(joel-coffman): cryptsetup will strip trailing newlines from
# input specified on stdin unless --key-file=- is specified.
@ -64,7 +63,7 @@ class LuksEncryptor(cryptsetup.CryptsetupEncryptor):
:param passphrase: the passphrase used to access the volume
"""
LOG.debug(_("opening encrypted volume %s"), self.dev_path)
LOG.debug("opening encrypted volume %s", self.dev_path)
utils.execute('cryptsetup', 'luksOpen', '--key-file=-',
self.dev_path, self.dev_name, process_input=passphrase,
run_as_root=True, check_exit_code=True)
@ -101,6 +100,6 @@ class LuksEncryptor(cryptsetup.CryptsetupEncryptor):
def _close_volume(self, **kwargs):
"""Closes the device (effectively removes the dm-crypt mapping)."""
LOG.debug(_("closing encrypted volume %s"), self.dev_path)
LOG.debug("closing encrypted volume %s", self.dev_path)
utils.execute('cryptsetup', 'luksClose', self.dev_name,
run_as_root=True, check_exit_code=True)