]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Update i18n translation for neutron.db log msg's
authorGary Kotton <gkotton@vmware.com>
Mon, 10 Nov 2014 15:29:58 +0000 (07:29 -0800)
committerGary Kotton <gkotton@vmware.com>
Sat, 15 Nov 2014 08:17:25 +0000 (00:17 -0800)
Validate that hacking rules apply to directory neutron/db
Partial-bug: #1320867

Change-Id: Iffdaa28bf5d5d503623f1f6dec4a8003f48974d8

12 files changed:
neutron/db/agents_db.py
neutron/db/db_base_plugin_v2.py
neutron/db/dvr_mac_db.py
neutron/db/extraroute_db.py
neutron/db/firewall/firewall_db.py
neutron/db/l3_db.py
neutron/db/l3_dvr_db.py
neutron/db/l3_dvrscheduler_db.py
neutron/db/metering/metering_rpc.py
neutron/db/migration/alembic_migrations/heal_script.py
neutron/db/securitygroups_rpc_base.py
neutron/hacking/checks.py

index 6931ca90481f5d5d08b9c1b23ef700f2f7ae76bb..1d7b0bca396416b328d914030b8299503884d029 100644 (file)
@@ -28,6 +28,7 @@ from neutron.db import models_v2
 from neutron.extensions import agent as ext_agent
 from neutron import manager
 from neutron.openstack.common import excutils
+from neutron.openstack.common.gettextutils import _LW
 from neutron.openstack.common import log as logging
 from neutron.openstack.common import timeutils
 
@@ -95,8 +96,8 @@ class AgentDbMixin(ext_agent.AgentPluginBase):
                       '%(host)s' % {'agent_type': agent_type, 'host': host})
             return
         if self.is_agent_down(agent.heartbeat_timestamp):
-            LOG.warn(_('%(agent_type)s agent %(agent_id)s is not active')
-                     {'agent_type': agent_type, 'agent_id': agent.id})
+            LOG.warn(_LW('%(agent_type)s agent %(agent_id)s is not active'),
+                     {'agent_type': agent_type, 'agent_id': agent.id})
         return agent
 
     @classmethod
@@ -108,8 +109,8 @@ class AgentDbMixin(ext_agent.AgentPluginBase):
         try:
             conf = jsonutils.loads(agent_db.configurations)
         except Exception:
-            msg = _('Configuration for agent %(agent_type)s on host %(host)s'
-                    ' is invalid.')
+            msg = _LW('Configuration for agent %(agent_type)s on host %(host)s'
+                      ' is invalid.')
             LOG.warn(msg, {'agent_type': agent_db.agent_type,
                            'host': agent_db.host})
             conf = {}
@@ -229,7 +230,7 @@ class AgentExtRpcCallback(n_rpc.RpcCallback):
         time = kwargs['time']
         time = timeutils.parse_strtime(time)
         if self.START_TIME > time:
-            LOG.debug(_("Message with invalid timestamp received"))
+            LOG.debug("Message with invalid timestamp received")
             return
         agent_state = kwargs['agent_state']['agent_state']
         if not self.plugin:
index 70827c58afdf73c5b95422696503b7b4ac4a7579..2e8392b4dd2ac00432c8795bf89021bebd719cf6 100644 (file)
@@ -34,6 +34,7 @@ from neutron.extensions import l3
 from neutron import manager
 from neutron import neutron_plugin_base_v2
 from neutron.openstack.common import excutils
+from neutron.openstack.common.gettextutils import _LE, _LI
 from neutron.openstack.common import log as logging
 from neutron.openstack.common import uuidutils
 from neutron.plugins.common import constants as service_constants
@@ -138,17 +139,17 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
             mac_address = ':'.join(map(lambda x: "%02x" % x, mac))
             if NeutronDbPluginV2._check_unique_mac(context, network_id,
                                                    mac_address):
-                LOG.debug(_("Generated mac for network %(network_id)s "
-                            "is %(mac_address)s"),
+                LOG.debug("Generated mac for network %(network_id)s "
+                          "is %(mac_address)s",
                           {'network_id': network_id,
                            'mac_address': mac_address})
                 return mac_address
             else:
-                LOG.debug(_("Generated mac %(mac_address)s exists. Remaining "
-                            "attempts %(max_retries)s."),
+                LOG.debug("Generated mac %(mac_address)s exists. Remaining "
+                          "attempts %(max_retries)s.",
                           {'mac_address': mac_address,
                            'max_retries': max_retries - (i + 1)})
-        LOG.error(_("Unable to generate mac address after %s attempts"),
+        LOG.error(_LE("Unable to generate mac address after %s attempts"),
                   max_retries)
         raise n_exc.MacAddressGenerationFailure(net_id=network_id)
 
@@ -166,8 +167,8 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
     def _delete_ip_allocation(context, network_id, subnet_id, ip_address):
 
         # Delete the IP address from the IPAllocate table
-        LOG.debug(_("Delete allocated IP %(ip_address)s "
-                    "(%(network_id)s/%(subnet_id)s)"),
+        LOG.debug("Delete allocated IP %(ip_address)s "
+                  "(%(network_id)s/%(subnet_id)s)",
                   {'ip_address': ip_address,
                    'network_id': network_id,
                    'subnet_id': subnet_id})
@@ -257,8 +258,8 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
             models_v2.IPAllocationPool).options(
                 orm.noload('available_ranges')).with_lockmode('update')
         for subnet in sorted(subnets):
-            LOG.debug(_("Rebuilding availability ranges for subnet %s")
-                      subnet)
+            LOG.debug("Rebuilding availability ranges for subnet %s",
+                      subnet)
 
             # Create a set of all currently allocated addresses
             ip_qry_results = ip_qry.filter_by(subnet_id=subnet['id'])
@@ -517,14 +518,14 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
         to_add = self._test_fixed_ips_for_port(context, network_id, new_ips,
                                                device_owner)
         for ip in original_ips:
-            LOG.debug(_("Port update. Hold %s"), ip)
+            LOG.debug("Port update. Hold %s", ip)
             NeutronDbPluginV2._delete_ip_allocation(context,
                                                     network_id,
                                                     ip['subnet_id'],
                                                     ip['ip_address'])
 
         if to_add:
-            LOG.debug(_("Port update. Adding %s"), to_add)
+            LOG.debug("Port update. Adding %s", to_add)
             ips = self._allocate_fixed_ips(context, to_add, mac_address)
         return ips, prev_ips
 
@@ -615,9 +616,9 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
                              "subnet") %
                            {'cidr': new_subnet_cidr,
                             'network_id': network.id})
-                LOG.info(_("Validation for CIDR: %(new_cidr)s failed - "
-                           "overlaps with subnet %(subnet_id)s "
-                           "(CIDR: %(cidr)s)"),
+                LOG.info(_LI("Validation for CIDR: %(new_cidr)s failed - "
+                             "overlaps with subnet %(subnet_id)s "
+                             "(CIDR: %(cidr)s)"),
                          {'new_cidr': new_subnet_cidr,
                           'subnet_id': subnet.id,
                           'cidr': subnet.cidr})
@@ -635,31 +636,31 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
         subnet_first_ip = netaddr.IPAddress(subnet.first + 1)
         subnet_last_ip = netaddr.IPAddress(subnet.last - 1)
 
-        LOG.debug(_("Performing IP validity checks on allocation pools"))
+        LOG.debug("Performing IP validity checks on allocation pools")
         ip_sets = []
         for ip_pool in ip_pools:
             try:
                 start_ip = netaddr.IPAddress(ip_pool['start'])
                 end_ip = netaddr.IPAddress(ip_pool['end'])
             except netaddr.AddrFormatError:
-                LOG.info(_("Found invalid IP address in pool: "
-                           "%(start)s - %(end)s:"),
+                LOG.info(_LI("Found invalid IP address in pool: "
+                             "%(start)s - %(end)s:"),
                          {'start': ip_pool['start'],
                           'end': ip_pool['end']})
                 raise n_exc.InvalidAllocationPool(pool=ip_pool)
             if (start_ip.version != subnet.version or
                     end_ip.version != subnet.version):
-                LOG.info(_("Specified IP addresses do not match "
-                           "the subnet IP version"))
+                LOG.info(_LI("Specified IP addresses do not match "
+                             "the subnet IP version"))
                 raise n_exc.InvalidAllocationPool(pool=ip_pool)
             if end_ip < start_ip:
-                LOG.info(_("Start IP (%(start)s) is greater than end IP "
-                           "(%(end)s)"),
+                LOG.info(_LI("Start IP (%(start)s) is greater than end IP "
+                             "(%(end)s)"),
                          {'start': ip_pool['start'], 'end': ip_pool['end']})
                 raise n_exc.InvalidAllocationPool(pool=ip_pool)
             if start_ip < subnet_first_ip or end_ip > subnet_last_ip:
-                LOG.info(_("Found pool larger than subnet "
-                           "CIDR:%(start)s - %(end)s"),
+                LOG.info(_LI("Found pool larger than subnet "
+                             "CIDR:%(start)s - %(end)s"),
                          {'start': ip_pool['start'],
                           'end': ip_pool['end']})
                 raise n_exc.OutOfBoundsAllocationPool(
@@ -671,8 +672,8 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
                 ip_pool['start'],
                 ip_pool['end']).cidrs()))
 
-        LOG.debug(_("Checking for overlaps among allocation pools "
-                    "and gateway ip"))
+        LOG.debug("Checking for overlaps among allocation pools "
+                  "and gateway ip")
         ip_ranges = ip_pools[:]
 
         # Use integer cursors as an efficient way for implementing
@@ -682,8 +683,8 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
                 if ip_sets[l_cursor] & ip_sets[r_cursor]:
                     l_range = ip_ranges[l_cursor]
                     r_range = ip_ranges[r_cursor]
-                    LOG.info(_("Found overlapping ranges: %(l_range)s and "
-                               "%(r_range)s"),
+                    LOG.info(_LI("Found overlapping ranges: %(l_range)s and "
+                                 "%(r_range)s"),
                              {'l_range': l_range, 'r_range': r_range})
                     raise n_exc.OverlappingAllocationPools(
                         pool_1=l_range,
@@ -891,8 +892,8 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
         except Exception:
             context.session.rollback()
             with excutils.save_and_reraise_exception():
-                LOG.error(_("An exception occurred while creating "
-                            "the %(resource)s:%(item)s"),
+                LOG.error(_LE("An exception occurred while creating "
+                              "the %(resource)s:%(item)s"),
                           {'resource': resource, 'item': item})
         return objects
 
@@ -1431,8 +1432,8 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
                 self.delete_port(context, port_id)
             except n_exc.PortNotFound:
                 # Don't raise if something else concurrently deleted the port
-                LOG.debug(_("Ignoring PortNotFound when deleting port '%s'. "
-                            "The port has already been deleted."),
+                LOG.debug("Ignoring PortNotFound when deleting port '%s'. "
+                          "The port has already been deleted.",
                           port_id)
 
     def _delete_port(self, context, id):
index a0a2740e901cf51678eb64034c67f451cf7f5b7d..e839697ac370debba2abd563d1f5464dbf845a0d 100644 (file)
@@ -24,6 +24,7 @@ from neutron.db import model_base
 from neutron.extensions import dvr as ext_dvr
 from neutron.extensions import portbindings
 from neutron import manager
+from neutron.openstack.common.gettextutils import _LE
 from neutron.openstack.common import log as logging
 from oslo.config import cfg
 from sqlalchemy.orm import exc
@@ -93,7 +94,7 @@ class DVRDbMixin(ext_dvr.DVRMacAddressPluginBase):
                 LOG.debug("Generated DVR mac %(mac)s exists."
                           " Remaining attempts %(attempts_left)s.",
                           {'mac': mac_address, 'attempts_left': attempt})
-        LOG.error(_("MAC generation error after %s attempts"), max_retries)
+        LOG.error(_LE("MAC generation error after %s attempts"), max_retries)
         raise ext_dvr.MacAddressGenerationFailure(host=host)
 
     def delete_dvr_mac_address(self, context, host):
@@ -165,8 +166,8 @@ class DVRDbMixin(ext_dvr.DVRMacAddressPluginBase):
             internal_gateway_ports = self.plugin.get_ports(
                 context, filters=filter)
             if not internal_gateway_ports:
-                LOG.error(_("Could not retrieve gateway port "
-                            "for subnet %s"), subnet_info)
+                LOG.error(_LE("Could not retrieve gateway port "
+                              "for subnet %s"), subnet_info)
                 return {}
             internal_port = internal_gateway_ports[0]
             subnet_info['gateway_mac'] = internal_port['mac_address']
index 27cf11b9341eb2e58cec37ffcdf639131b981cb2..c9f95b0bd1c23e60da4a11f312cc3e06aa8105db 100644 (file)
@@ -122,7 +122,7 @@ class ExtraRoute_dbonly_mixin(l3_db.L3_NAT_dbonly_mixin):
             context, router['id'])
         added, removed = utils.diff_list_of_dict(old_routes,
                                                  routes)
-        LOG.debug(_('Added routes are %s'), added)
+        LOG.debug('Added routes are %s', added)
         for route in added:
             router_routes = RouterRoute(
                 router_id=router['id'],
@@ -130,7 +130,7 @@ class ExtraRoute_dbonly_mixin(l3_db.L3_NAT_dbonly_mixin):
                 nexthop=route['nexthop'])
             context.session.add(router_routes)
 
-        LOG.debug(_('Removed routes are %s'), removed)
+        LOG.debug('Removed routes are %s', removed)
         for route in removed:
             context.session.delete(
                 routes_dict[(route['destination'], route['nexthop'])])
index f00905ee7868377c71eef3d81723cc4a07e53453..33e54d8866aff6c4eb0d1954efa1b61c593de814 100644 (file)
@@ -264,7 +264,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
                     param="Source, destination port")
 
     def create_firewall(self, context, firewall):
-        LOG.debug(_("create_firewall() called"))
+        LOG.debug("create_firewall() called")
         fw = firewall['firewall']
         tenant_id = self._get_tenant_id_for_create(context, fw)
         # distributed routers may required a more complex state machine;
@@ -285,7 +285,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
         return self._make_firewall_dict(firewall_db)
 
     def update_firewall(self, context, id, firewall):
-        LOG.debug(_("update_firewall() called"))
+        LOG.debug("update_firewall() called")
         fw = firewall['firewall']
         with context.session.begin(subtransactions=True):
             count = context.session.query(Firewall).filter_by(id=id).update(fw)
@@ -294,7 +294,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
         return self.get_firewall(context, id)
 
     def delete_firewall(self, context, id):
-        LOG.debug(_("delete_firewall() called"))
+        LOG.debug("delete_firewall() called")
         with context.session.begin(subtransactions=True):
             # Note: Plugin should ensure that it's okay to delete if the
             # firewall is active
@@ -303,23 +303,23 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
                 raise firewall.FirewallNotFound(firewall_id=id)
 
     def get_firewall(self, context, id, fields=None):
-        LOG.debug(_("get_firewall() called"))
+        LOG.debug("get_firewall() called")
         fw = self._get_firewall(context, id)
         return self._make_firewall_dict(fw, fields)
 
     def get_firewalls(self, context, filters=None, fields=None):
-        LOG.debug(_("get_firewalls() called"))
+        LOG.debug("get_firewalls() called")
         return self._get_collection(context, Firewall,
                                     self._make_firewall_dict,
                                     filters=filters, fields=fields)
 
     def get_firewalls_count(self, context, filters=None):
-        LOG.debug(_("get_firewalls_count() called"))
+        LOG.debug("get_firewalls_count() called")
         return self._get_collection_count(context, Firewall,
                                           filters=filters)
 
     def create_firewall_policy(self, context, firewall_policy):
-        LOG.debug(_("create_firewall_policy() called"))
+        LOG.debug("create_firewall_policy() called")
         fwp = firewall_policy['firewall_policy']
         tenant_id = self._get_tenant_id_for_create(context, fwp)
         with context.session.begin(subtransactions=True):
@@ -334,7 +334,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
         return self._make_firewall_policy_dict(fwp_db)
 
     def update_firewall_policy(self, context, id, firewall_policy):
-        LOG.debug(_("update_firewall_policy() called"))
+        LOG.debug("update_firewall_policy() called")
         fwp = firewall_policy['firewall_policy']
         with context.session.begin(subtransactions=True):
             fwp_db = self._get_firewall_policy(context, id)
@@ -356,7 +356,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
         return self._make_firewall_policy_dict(fwp_db)
 
     def delete_firewall_policy(self, context, id):
-        LOG.debug(_("delete_firewall_policy() called"))
+        LOG.debug("delete_firewall_policy() called")
         with context.session.begin(subtransactions=True):
             fwp = self._get_firewall_policy(context, id)
             # Ensure that the firewall_policy  is not
@@ -368,23 +368,23 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
                 context.session.delete(fwp)
 
     def get_firewall_policy(self, context, id, fields=None):
-        LOG.debug(_("get_firewall_policy() called"))
+        LOG.debug("get_firewall_policy() called")
         fwp = self._get_firewall_policy(context, id)
         return self._make_firewall_policy_dict(fwp, fields)
 
     def get_firewall_policies(self, context, filters=None, fields=None):
-        LOG.debug(_("get_firewall_policies() called"))
+        LOG.debug("get_firewall_policies() called")
         return self._get_collection(context, FirewallPolicy,
                                     self._make_firewall_policy_dict,
                                     filters=filters, fields=fields)
 
     def get_firewalls_policies_count(self, context, filters=None):
-        LOG.debug(_("get_firewall_policies_count() called"))
+        LOG.debug("get_firewall_policies_count() called")
         return self._get_collection_count(context, FirewallPolicy,
                                           filters=filters)
 
     def create_firewall_rule(self, context, firewall_rule):
-        LOG.debug(_("create_firewall_rule() called"))
+        LOG.debug("create_firewall_rule() called")
         fwr = firewall_rule['firewall_rule']
         self._validate_fwr_protocol_parameters(fwr)
         tenant_id = self._get_tenant_id_for_create(context, fwr)
@@ -416,7 +416,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
         return self._make_firewall_rule_dict(fwr_db)
 
     def update_firewall_rule(self, context, id, firewall_rule):
-        LOG.debug(_("update_firewall_rule() called"))
+        LOG.debug("update_firewall_rule() called")
         fwr = firewall_rule['firewall_rule']
         fwr_db = self._get_firewall_rule(context, id)
         if fwr_db.firewall_policy_id:
@@ -452,7 +452,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
         return self._make_firewall_rule_dict(fwr_db)
 
     def delete_firewall_rule(self, context, id):
-        LOG.debug(_("delete_firewall_rule() called"))
+        LOG.debug("delete_firewall_rule() called")
         with context.session.begin(subtransactions=True):
             fwr = self._get_firewall_rule(context, id)
             if fwr.firewall_policy_id:
@@ -460,18 +460,18 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
             context.session.delete(fwr)
 
     def get_firewall_rule(self, context, id, fields=None):
-        LOG.debug(_("get_firewall_rule() called"))
+        LOG.debug("get_firewall_rule() called")
         fwr = self._get_firewall_rule(context, id)
         return self._make_firewall_rule_dict(fwr, fields)
 
     def get_firewall_rules(self, context, filters=None, fields=None):
-        LOG.debug(_("get_firewall_rules() called"))
+        LOG.debug("get_firewall_rules() called")
         return self._get_collection(context, FirewallRule,
                                     self._make_firewall_rule_dict,
                                     filters=filters, fields=fields)
 
     def get_firewalls_rules_count(self, context, filters=None):
-        LOG.debug(_("get_firewall_rules_count() called"))
+        LOG.debug("get_firewall_rules_count() called")
         return self._get_collection_count(context, FirewallRule,
                                           filters=filters)
 
@@ -480,7 +480,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
             raise firewall.FirewallRuleInfoMissing()
 
     def insert_rule(self, context, id, rule_info):
-        LOG.debug(_("insert_rule() called"))
+        LOG.debug("insert_rule() called")
         self._validate_insert_remove_rule_request(id, rule_info)
         firewall_rule_id = rule_info['firewall_rule_id']
         insert_before = True
@@ -526,7 +526,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin):
                                                  position)
 
     def remove_rule(self, context, id, rule_info):
-        LOG.debug(_("remove_rule() called"))
+        LOG.debug("remove_rule() called")
         self._validate_insert_remove_rule_request(id, rule_info)
         firewall_rule_id = rule_info['firewall_rule_id']
         if not firewall_rule_id:
index 65898cca46a70451093163910d5a590c6a975b1d..6a373161c3d2975bc1ae761120d48201edc77c48 100644 (file)
@@ -29,6 +29,7 @@ from neutron.db import models_v2
 from neutron.extensions import external_net
 from neutron.extensions import l3
 from neutron import manager
+from neutron.openstack.common.gettextutils import _LI
 from neutron.openstack.common import log as logging
 from neutron.openstack.common import uuidutils
 from neutron.plugins.common import constants
@@ -903,8 +904,8 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
                 raise l3.L3PortInUse(port_id=port_id,
                                      device_owner=port_db['device_owner'])
             else:
-                LOG.debug(_("Port %(port_id)s has owner %(port_owner)s, but "
-                            "no IP address, so it can be deleted"),
+                LOG.debug("Port %(port_id)s has owner %(port_owner)s, but "
+                          "no IP address, so it can be deleted",
                           {'port_id': port_db['id'],
                            'port_owner': port_db['device_owner']})
 
@@ -1018,13 +1019,14 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
             for port in ports:
                 fixed_ips = port.get('fixed_ips', [])
                 if len(fixed_ips) > 1:
-                    LOG.info(_("Ignoring multiple IPs on router port %s"),
+                    LOG.info(_LI("Ignoring multiple IPs on router port %s"),
                              port['id'])
                     continue
                 elif not fixed_ips:
                     # Skip ports without IPs, which can occur if a subnet
                     # attached to a router is deleted
-                    LOG.info(_("Skipping port %s as no IP is configure on it"),
+                    LOG.info(_LI("Skipping port %s as no IP is configure on "
+                                 "it"),
                              port['id'])
                     continue
                 yield (port, fixed_ips[0])
index e05125546207c8d2baffce7cc04edc42f1b41177..a68d8ca468f29a6d3e1e62f914fa2560d86628f3 100644 (file)
@@ -24,6 +24,7 @@ from neutron.db import l3_dvrscheduler_db as l3_dvrsched_db
 from neutron.db import models_v2
 from neutron.extensions import l3
 from neutron.extensions import portbindings
+from neutron.openstack.common.gettextutils import _LI
 from neutron.openstack.common import log as logging
 
 
@@ -73,8 +74,8 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
         """Allow centralized -> distributed state transition only."""
         if (router_db.extra_attributes.distributed and
             router_res.get('distributed') is False):
-            LOG.info(_("Centralizing distributed router %s "
-                       "is not supported"), router_db['id'])
+            LOG.info(_LI("Centralizing distributed router %s "
+                         "is not supported"), router_db['id'])
             raise NotImplementedError()
 
     def _update_distributed_attr(
@@ -438,8 +439,8 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
             f_port = self.get_agent_gw_ports_exist_for_network(
                 context, network_id, host, l3_agent_db['id'])
             if not f_port:
-                LOG.info(_('Agent Gateway port does not exist,'
-                           ' so create one: %s'), f_port)
+                LOG.info(_LI('Agent Gateway port does not exist,'
+                             ' so create one: %s'), f_port)
                 agent_port = self._core_plugin.create_port(
                     context,
                     {'port': {'tenant_id': '',
@@ -521,8 +522,8 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
                 port_type=DEVICE_OWNER_DVR_INTERFACE
             )
         )
-        LOG.info(_('SNAT interface port list does not exist,'
-                   ' so create one: %s'), port_list)
+        LOG.info(_LI('SNAT interface port list does not exist,'
+                     ' so create one: %s'), port_list)
         for intf in int_ports:
             if intf.fixed_ips:
                 # Passing the subnet for the port to make sure the IP's
index a8c9dae945de8ab19b2b1a8922a70d0a81d3f11a..d717b0d5d0c38e60e8d07bbdd24b1b99802c5d5e 100644 (file)
@@ -26,6 +26,7 @@ from neutron.db import agents_db
 from neutron.db import l3_agentschedulers_db as l3agent_sch_db
 from neutron.db import model_base
 from neutron.db import models_v2
+from neutron.openstack.common.gettextutils import _LW
 from neutron.openstack.common import log as logging
 from neutron.plugins.ml2 import db as ml2_db
 
@@ -293,7 +294,7 @@ class L3_DVRsch_db_mixin(l3agent_sch_db.L3AgentSchedulerDbMixin):
         """Schedule the snat router on l3 service agent."""
         active_l3_agents = self.get_l3_agents(context, active=True)
         if not active_l3_agents:
-            LOG.warn(_('No active L3 agents found for SNAT'))
+            LOG.warn(_LW('No active L3 agents found for SNAT'))
             return
         snat_candidates = self.get_snat_candidates(sync_router,
                                                    active_l3_agents)
index 5d6a91618c53a0cd38a558e1a31ac91f66f21eaf..7c1935154dbe84dc6e1c5cb8c44954ea866902c2 100644 (file)
@@ -15,6 +15,7 @@
 from neutron.common import constants as consts
 from neutron.common import utils
 from neutron import manager
+from neutron.openstack.common.gettextutils import _LE
 from neutron.openstack.common import log as logging
 from neutron.plugins.common import constants as service_constants
 
@@ -41,7 +42,7 @@ class MeteringRpcCallbacks(object):
         else:
             agents = l3_plugin.get_l3_agents(context, filters={'host': [host]})
             if not agents:
-                LOG.error(_('Unable to find agent %s.'), host)
+                LOG.error(_LE('Unable to find agent %s.'), host)
                 return
 
             routers = l3_plugin.list_routers_on_l3_agent(context, agents[0].id)
index e5bcc22af23aa48748cf79c44d03c36999ab296d..24de2148f048b1a353af350fe4620a551c937765 100644 (file)
@@ -27,6 +27,7 @@ from sqlalchemy.sql import text
 from sqlalchemy import types
 
 from neutron.db.migration.models import frozen as frozen_models
+from neutron.openstack.common.gettextutils import _LI
 
 LOG = logging.getLogger(__name__)
 
@@ -225,13 +226,15 @@ def check_foreign_keys(metadata):
         fk_models_set = set(fk_models.keys())
         for key in (fk_db_set - fk_models_set):
             dropped_fks.append(('drop_key', fk_db[key], table))
-            LOG.info(_("Detected removed foreign key %(fk)r on "
-                       "table %(table)r"), {'fk': fk_db[key], 'table': table})
+            LOG.info(_LI("Detected removed foreign key %(fk)r on "
+                         "table %(table)r"),
+                     {'fk': fk_db[key], 'table': table})
         for key in (fk_models_set - fk_db_set):
             added_fks.append(('add_key', fk_models[key]))
-            LOG.info(_("Detected added foreign key for column %(fk)r on table "
-                       "%(table)r"), {'fk': fk_models[key].column.name,
-                                      'table': table})
+            LOG.info(_LI("Detected added foreign key for column %(fk)r on "
+                         "table %(table)r"),
+                     {'fk': fk_models[key].column.name,
+                      'table': table})
     return (added_fks, dropped_fks)
 
 
@@ -250,7 +253,7 @@ def rename(table):
     if table in frozen_models.renamed_tables:
         if check_if_table_exists(frozen_models.renamed_tables[table]):
             op.rename_table(frozen_models.renamed_tables[table], table)
-            LOG.info(_("Table %(old_t)r was renamed to %(new_t)r"), {
+            LOG.info(_LI("Table %(old_t)r was renamed to %(new_t)r"), {
                 'old_t': table, 'new_t': frozen_models.renamed_tables[table]})
             return True
     return False
index 8c1df8bea088cc1323434911a4a6e34a2a8d0e6b..41dc5d3b18c7426dbfe0cf12221668bf6a97bd54 100644 (file)
@@ -23,6 +23,7 @@ from neutron.db import allowedaddresspairs_db as addr_pair
 from neutron.db import models_v2
 from neutron.db import securitygroups_db as sg_db
 from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common.gettextutils import _LW
 from neutron.openstack.common import log as logging
 
 LOG = logging.getLogger(__name__)
@@ -355,8 +356,8 @@ class SecurityGroupServerRpcMixin(sg_db.SecurityGroupDbMixin):
         try:
             mac_address = query.one()[0]
         except (exc.NoResultFound, exc.MultipleResultsFound):
-            LOG.warn(_('No valid gateway port on subnet %s is '
-                       'found for IPv6 RA'), subnet['id'])
+            LOG.warn(_LW('No valid gateway port on subnet %s is '
+                         'found for IPv6 RA'), subnet['id'])
             return
         lla_ip = str(ipv6.get_ipv6_addr_by_EUI64(
             q_const.IPV6_LLA_PREFIX,
index e31c997459b4d61005b8bbe8ab78e8fe94212c0c..47669c491ae76b67ff1b533052d58f6964c6b6f9 100644 (file)
@@ -45,7 +45,8 @@ def _directory_to_check_translation(filename):
     # do it on a directory by directory basis. The last patch of the
     # series will remove this and the entire code base will be validated.
     dirs = ["neutron/agent",
-            "neutron/cmd"]
+            "neutron/cmd",
+            "neutron/db"]
     return any([dir in filename for dir in dirs])