Don't translate debug level scheduler logs

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).

Remove unnecessary debug level log translation in the scheduler to
comply with our translation policy. This has the added benefit of making
the scheduler slightly faster too.

Add a local hacking rule to enforce this.

Change-Id: Ie1068d2d2c7c37f27c62d0e4e5a64a1a504af9f5
This commit is contained in:
Joe Gordon
2014-04-17 15:07:29 -07:00
parent 0388c36ad8
commit a0c5f08715
3 changed files with 7 additions and 10 deletions

View File

@@ -16,7 +16,6 @@
from oslo.config import cfg
from nova import db
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler import filters
@@ -58,9 +57,9 @@ class AggregateImagePropertiesIsolation(filters.BaseHostFilter):
continue
prop = image_props.get(key)
if prop and prop not in options:
LOG.debug(_("%(host_state)s fails image aggregate properties "
LOG.debug("%(host_state)s fails image aggregate properties "
"requirements. Property %(prop)s does not "
"match %(options)s."),
"match %(options)s.",
{'host_state': host_state,
'prop': prop,
'options': options})

View File

@@ -15,7 +15,6 @@
# under the License.
from nova import db
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler import filters
from nova.scheduler.filters import extra_specs_ops
@@ -56,17 +55,17 @@ class AggregateInstanceExtraSpecsFilter(filters.BaseHostFilter):
key = scope[0]
aggregate_vals = metadata.get(key, None)
if not aggregate_vals:
LOG.debug(_("%(host_state)s fails instance_type extra_specs "
"requirements. Extra_spec %(key)s is not in aggregate."),
LOG.debug("%(host_state)s fails instance_type extra_specs "
"requirements. Extra_spec %(key)s is not in aggregate.",
{'host_state': host_state, 'key': key})
return False
for aggregate_val in aggregate_vals:
if extra_specs_ops.match(aggregate_val, req):
break
else:
LOG.debug(_("%(host_state)s fails instance_type extra_specs "
LOG.debug("%(host_state)s fails instance_type extra_specs "
"requirements. '%(aggregate_vals)s' do not "
"match '%(req)s'"),
"match '%(req)s'",
{'host_state': host_state, 'req': req,
'aggregate_vals': aggregate_vals})
return False

View File

@@ -14,7 +14,6 @@
# under the License.
from nova import db
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler import filters
@@ -45,6 +44,6 @@ class AggregateMultiTenancyIsolation(filters.BaseHostFilter):
if metadata != {}:
if tenant_id not in metadata["filter_tenant_id"]:
LOG.debug(_("%s fails tenant id on aggregate"), host_state)
LOG.debug("%s fails tenant id on aggregate", host_state)
return False
return True