From a0c5f0871598022f3773eea3c7d621f5ff3843cd Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Thu, 17 Apr 2014 15:07:29 -0700 Subject: [PATCH] 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 --- .../filters/aggregate_image_properties_isolation.py | 5 ++--- nova/scheduler/filters/aggregate_instance_extra_specs.py | 9 ++++----- .../filters/aggregate_multitenancy_isolation.py | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/nova/scheduler/filters/aggregate_image_properties_isolation.py b/nova/scheduler/filters/aggregate_image_properties_isolation.py index 2101cf0e9..f9e96d064 100644 --- a/nova/scheduler/filters/aggregate_image_properties_isolation.py +++ b/nova/scheduler/filters/aggregate_image_properties_isolation.py @@ -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}) diff --git a/nova/scheduler/filters/aggregate_instance_extra_specs.py b/nova/scheduler/filters/aggregate_instance_extra_specs.py index d8fe8b1cc..e852212cb 100644 --- a/nova/scheduler/filters/aggregate_instance_extra_specs.py +++ b/nova/scheduler/filters/aggregate_instance_extra_specs.py @@ -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 diff --git a/nova/scheduler/filters/aggregate_multitenancy_isolation.py b/nova/scheduler/filters/aggregate_multitenancy_isolation.py index 1b8a25cfa..f5bdd75e2 100644 --- a/nova/scheduler/filters/aggregate_multitenancy_isolation.py +++ b/nova/scheduler/filters/aggregate_multitenancy_isolation.py @@ -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