]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Correct i18n message for ovs plugin
authorHe Jie Xu <xuhj@linux.vnet.ibm.com>
Thu, 22 Nov 2012 14:23:28 +0000 (22:23 +0800)
committerHe Jie Xu <xuhj@linux.vnet.ibm.com>
Mon, 26 Nov 2012 02:09:46 +0000 (10:09 +0800)
Part of bp make-string-localizable

Change-Id: I891d0128fd9e24805cef2c1db99cf8e716c7b4a0

quantum/plugins/openvswitch/agent/ovs_quantum_agent.py
quantum/plugins/openvswitch/ovs_db_v2.py
quantum/plugins/openvswitch/ovs_quantum_plugin.py

index b9a0b7819f956d1a95fa8101cf9aa26d66d2b8a1..3ab8f25f5e6d3a7332381642c822c811f20d251b 100755 (executable)
@@ -186,18 +186,18 @@ class OVSQuantumAgent(object):
                 return network_id
 
     def network_delete(self, context, **kwargs):
-        LOG.debug("network_delete received")
+        LOG.debug(_("network_delete received"))
         network_id = kwargs.get('network_id')
-        LOG.debug("Delete %s", network_id)
+        LOG.debug(_("Delete %s"), network_id)
         # The network may not be defined on this agent
         lvm = self.local_vlan_map.get(network_id)
         if lvm:
             self.reclaim_local_vlan(network_id, lvm)
         else:
-            LOG.debug("Network %s not used on agent.", network_id)
+            LOG.debug(_("Network %s not used on agent."), network_id)
 
     def port_update(self, context, **kwargs):
-        LOG.debug("port_update received")
+        LOG.debug(_("port_update received"))
         port = kwargs.get('port')
         network_type = kwargs.get('network_type')
         segmentation_id = kwargs.get('segmentation_id')
@@ -208,7 +208,7 @@ class OVSQuantumAgent(object):
                             segmentation_id, port['admin_state_up'])
 
     def tunnel_update(self, context, **kwargs):
-        LOG.debug("tunnel_update received")
+        LOG.debug(_("tunnel_update received"))
         if not self.enable_tunneling:
             return
         tunnel_ip = kwargs.get('tunnel_ip')
@@ -237,10 +237,12 @@ class OVSQuantumAgent(object):
         '''
 
         if not self.available_local_vlans:
-            LOG.error("No local VLAN available for net-id=%s", net_uuid)
+            LOG.error(_("No local VLAN available for net-id=%s"), net_uuid)
             return
         lvid = self.available_local_vlans.pop()
-        LOG.info("Assigning %s as local vlan for net-id=%s", lvid, net_uuid)
+        LOG.info(_("Assigning %(vlan_id)s as local vlan for "
+                   "net-id=%(net_uuid)s"),
+                 {'vlan_id': lvid, 'net_uuid': net_uuid})
         self.local_vlan_map[net_uuid] = LocalVLANMapping(lvid, network_type,
                                                          physical_network,
                                                          segmentation_id)
@@ -260,8 +262,8 @@ class OVSQuantumAgent(object):
                     actions="mod_vlan_vid:%s,output:%s" %
                     (lvid, self.patch_int_ofport))
             else:
-                LOG.error("Cannot provision GRE network for net-id=%s "
-                          "- tunneling disabled", net_uuid)
+                LOG.error(_("Cannot provision GRE network for net-id=%s "
+                          "- tunneling disabled"), net_uuid)
         elif network_type == constants.TYPE_FLAT:
             if physical_network in self.phys_brs:
                 # outbound
@@ -277,9 +279,10 @@ class OVSQuantumAgent(object):
                     dl_vlan=0xffff,
                     actions="mod_vlan_vid:%s,normal" % lvid)
             else:
-                LOG.error("Cannot provision flat network for net-id=%s "
-                          "- no bridge for physical_network %s", net_uuid,
-                          physical_network)
+                LOG.error(_("Cannot provision flat network for "
+                            "net-id=%(net_uuid)s - no bridge for "
+                            "physical_network %(physical_network)s"),
+                          locals())
         elif network_type == constants.TYPE_VLAN:
             if physical_network in self.phys_brs:
                 # outbound
@@ -295,15 +298,17 @@ class OVSQuantumAgent(object):
                                      dl_vlan=segmentation_id,
                                      actions="mod_vlan_vid:%s,normal" % lvid)
             else:
-                LOG.error("Cannot provision VLAN network for net-id=%s "
-                          "- no bridge for physical_network %s", net_uuid,
-                          physical_network)
+                LOG.error(_("Cannot provision VLAN network for "
+                            "net-id=%(net_uuid)s - no bridge for "
+                            "physical_network %(physical_network)s"),
+                          locals())
         elif network_type == constants.TYPE_LOCAL:
             # no flows needed for local networks
             pass
         else:
-            LOG.error("Cannot provision unknown network type %s for "
-                      "net-id=%s", network_type, net_uuid)
+            LOG.error(_("Cannot provision unknown network type "
+                        "%(network_type)s for net-id=%(net_uuid)s"),
+                      locals())
 
     def reclaim_local_vlan(self, net_uuid, lvm):
         '''Reclaim a local VLAN.
@@ -311,7 +316,9 @@ class OVSQuantumAgent(object):
         :param net_uuid: the network uuid associated with this vlan.
         :param lvm: a LocalVLANMapping object that tracks (vlan, lsw_id,
             vif_ids) mapping.'''
-        LOG.info("Reclaiming vlan = %s from net-id = %s", lvm.vlan, net_uuid)
+        LOG.info(_("Reclaiming vlan = %(vlan_id)s from net-id = %(net_uuid)s"),
+                 {'vlan_id': lvm.vlan,
+                  'net_uuid': net_uuid})
 
         if lvm.network_type == constants.TYPE_GRE:
             if self.enable_tunneling:
@@ -343,8 +350,10 @@ class OVSQuantumAgent(object):
             # no flows needed for local networks
             pass
         else:
-            LOG.error("Cannot reclaim unknown network type %s for net-id=%s",
-                      lvm.network_type, net_uuid)
+            LOG.error(_("Cannot reclaim unknown network type "
+                        "%(network_type)s for net-id=%(net_uuid)s"),
+                      {'network_type': lvm.network_type,
+                       'net_uuid': net_uuid})
 
         del self.local_vlan_map[net_uuid]
         self.available_local_vlans.add(lvm.vlan)
@@ -446,10 +455,10 @@ class OVSQuantumAgent(object):
         self.patch_int_ofport = self.tun_br.add_patch_port("patch-int",
                                                            "patch-tun")
         if int(self.patch_tun_ofport) < 0 or int(self.patch_int_ofport) < 0:
-            LOG.error("Failed to create OVS patch port. Cannot have tunneling "
-                      "enabled on this agent, since this version of OVS does "
-                      "not support tunnels or patch ports. "
-                      "Agent terminated!")
+            LOG.error(_("Failed to create OVS patch port. Cannot have "
+                        "tunneling enabled on this agent, since this version "
+                        "of OVS does not support tunnels or patch ports. "
+                        "Agent terminated!"))
             exit(1)
         self.tun_br.remove_all_flows()
         self.tun_br.add_flow(priority=1, actions="drop")
@@ -466,13 +475,15 @@ class OVSQuantumAgent(object):
         self.phys_ofports = {}
         ip_wrapper = ip_lib.IPWrapper(self.root_helper)
         for physical_network, bridge in bridge_mappings.iteritems():
-            LOG.info("Mapping physical network %s to bridge %s",
-                     physical_network, bridge)
+            LOG.info(_("Mapping physical network %(physical_network)s to "
+                       "bridge %(bridge)s"),
+                     locals())
             # setup physical bridge
             if not ip_lib.device_exists(bridge, self.root_helper):
-                LOG.error("Bridge %s for physical network %s does not exist. "
-                          "Agent terminated!",
-                          bridge, physical_network)
+                LOG.error(_("Bridge %(bridge)s for physical network "
+                            "%(physical_network)s does not exist. Agent "
+                            "terminated!"),
+                          locals())
                 sys.exit(1)
             br = ovs_lib.OVSBridge(bridge, self.root_helper)
             br.remove_all_flows()
@@ -522,23 +533,25 @@ class OVSQuantumAgent(object):
             else:
                 self.port_dead(vif_port)
         else:
-            LOG.debug("No VIF port for port %s defined on agent.", port_id)
+            LOG.debug(_("No VIF port for port %s defined on agent."), port_id)
 
     def treat_devices_added(self, devices):
         resync = False
         for device in devices:
-            LOG.info("Port %s added", device)
+            LOG.info(_("Port %s added"), device)
             try:
                 details = self.plugin_rpc.get_device_details(self.context,
                                                              device,
                                                              self.agent_id)
             except Exception as e:
-                LOG.debug("Unable to get port details for %s: %s", device, e)
+                LOG.debug(_("Unable to get port details for "
+                            "%(device)s: %(e)s"), locals())
                 resync = True
                 continue
             port = self.int_br.get_vif_port_by_id(details['device'])
             if 'port_id' in details:
-                LOG.info("Port %s updated. Details: %s", device, details)
+                LOG.info(_("Port %(device)s updated. Details: %(details)s"),
+                         locals())
                 self.treat_vif_port(port, details['port_id'],
                                     details['network_id'],
                                     details['network_type'],
@@ -546,7 +559,7 @@ class OVSQuantumAgent(object):
                                     details['segmentation_id'],
                                     details['admin_state_up'])
             else:
-                LOG.debug("Device %s not defined on plugin", device)
+                LOG.debug(_("Device %s not defined on plugin"), device)
                 if (port and int(port.ofport) != -1):
                     self.port_dead(port)
         return resync
@@ -554,20 +567,21 @@ class OVSQuantumAgent(object):
     def treat_devices_removed(self, devices):
         resync = False
         for device in devices:
-            LOG.info("Attachment %s removed", device)
+            LOG.info(_("Attachment %s removed"), device)
             try:
                 details = self.plugin_rpc.update_device_down(self.context,
                                                              device,
                                                              self.agent_id)
             except Exception as e:
-                LOG.debug("port_removed failed for %s: %s", device, e)
+                LOG.debug(_("port_removed failed for %(device)s: %(e)s"),
+                          locals())
                 resync = True
                 continue
             if details['exists']:
-                LOG.info("Port %s updated.", device)
+                LOG.info(_("Port %s updated."), device)
                 # Nothing to do regarding local networking
             else:
-                LOG.debug("Device %s not defined on plugin", device)
+                LOG.debug(_("Device %s not defined on plugin"), device)
                 self.port_unbound(device)
         return resync
 
@@ -591,7 +605,8 @@ class OVSQuantumAgent(object):
                     tun_name = 'gre-%s' % tunnel['id']
                     self.tun_br.add_tunnel_port(tun_name, tunnel['ip_address'])
         except Exception as e:
-            LOG.debug("Unable to sync tunnel IP %s: %s", self.local_ip, e)
+            LOG.debug(_("Unable to sync tunnel IP %(local_ip)s: %(e)s"),
+                      {'local_ip': self.local_ip, 'e': e})
             resync = True
         return resync
 
@@ -604,26 +619,26 @@ class OVSQuantumAgent(object):
             try:
                 start = time.time()
                 if sync:
-                    LOG.info("Agent out of sync with plugin!")
+                    LOG.info(_("Agent out of sync with plugin!"))
                     ports.clear()
                     sync = False
 
                 # Notify the plugin of tunnel IP
                 if self.enable_tunneling and tunnel_sync:
-                    LOG.info("Agent tunnel out of sync with plugin!")
+                    LOG.info(_("Agent tunnel out of sync with plugin!"))
                     tunnel_sync = self.tunnel_sync()
 
                 port_info = self.update_ports(ports)
 
                 # notify plugin about port deltas
                 if port_info:
-                    LOG.debug("Agent loop has new devices!")
+                    LOG.debug(_("Agent loop has new devices!"))
                     # If treat devices fails - must resync with plugin
                     sync = self.process_network_ports(port_info)
                     ports = port_info['current']
 
             except:
-                LOG.exception("Error in agent event loop")
+                LOG.exception(_("Error in agent event loop"))
                 sync = True
                 tunnel_sync = True
 
@@ -632,8 +647,10 @@ class OVSQuantumAgent(object):
             if (elapsed < self.polling_interval):
                 time.sleep(self.polling_interval - elapsed)
             else:
-                LOG.debug("Loop iteration exceeded interval (%s vs. %s)!",
-                          self.polling_interval, elapsed)
+                LOG.debug(_("Loop iteration exceeded interval "
+                            "(%(polling_interval)s vs. %(elapsed)s)!"),
+                          {'polling_interval': self.polling_interval,
+                           'elapsed': elapsed})
 
     def daemon_loop(self):
         self.rpc_loop()
@@ -675,13 +692,13 @@ def main():
     try:
         agent_config = create_agent_config_map(cfg.CONF)
     except ValueError as e:
-        LOG.error('%s Agent terminated!', e)
+        LOG.error(_('%s Agent terminated!'), e)
         sys.exit(1)
 
     plugin = OVSQuantumAgent(**agent_config)
 
     # Start everything.
-    LOG.info("Agent initialized successfully, now running... ")
+    LOG.info(_("Agent initialized successfully, now running... "))
     plugin.daemon_loop()
     sys.exit(0)
 
index bf1c822953a6dd71eae963aa8ba55ad3beb83c29..27dea91ec3f7b7f55af6ee7dd4ab0be40453ce85 100644 (file)
@@ -90,9 +90,11 @@ def sync_vlan_allocations(network_vlan_ranges):
                         # it's not allocatable, so check if its allocated
                         if not alloc.allocated:
                             # it's not, so remove it from table
-                            LOG.debug("removing vlan %s on physical network "
-                                      "%s from pool" %
-                                      (alloc.vlan_id, physical_network))
+                            LOG.debug(_("Removing vlan %(vlan_id)s on "
+                                        "physical network "
+                                        "%(physical_network)s from pool"),
+                                      {'vlan_id': alloc.vlan_id,
+                                       'physical_network': physical_network})
                             session.delete(alloc)
                 del allocations[physical_network]
 
@@ -106,9 +108,10 @@ def sync_vlan_allocations(network_vlan_ranges):
         for allocs in allocations.itervalues():
             for alloc in allocs:
                 if not alloc.allocated:
-                    LOG.debug("removing vlan %s on physical network %s"
-                              " from pool" %
-                              (alloc.vlan_id, physical_network))
+                    LOG.debug(_("Removing vlan %(vlan_id)s on physical "
+                                "network %(physical_network)s from pool"),
+                              {'vlan_id': alloc.vlan_id,
+                               'physical_network': physical_network})
                     session.delete(alloc)
 
 
@@ -130,8 +133,10 @@ def reserve_vlan(session):
                  filter_by(allocated=False).
                  first())
         if alloc:
-            LOG.debug("reserving vlan %s on physical network %s from pool" %
-                      (alloc.vlan_id, alloc.physical_network))
+            LOG.debug(_("Reserving vlan %(vlan_id)s on physical network "
+                        "%(physical_network)s from pool"),
+                      {'vlan_id': alloc.vlan_id,
+                       'physical_network': alloc.physical_network})
             alloc.allocated = True
             return (alloc.physical_network, alloc.vlan_id)
     raise q_exc.NoNetworkAvailable()
@@ -151,12 +156,13 @@ def reserve_specific_vlan(session, physical_network, vlan_id):
                 else:
                     raise q_exc.VlanIdInUse(vlan_id=vlan_id,
                                             physical_network=physical_network)
-            LOG.debug("reserving specific vlan %s on physical network %s "
-                      "from pool" % (vlan_id, physical_network))
+            LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
+                        "network %(physical_network)s from pool"), locals())
             alloc.allocated = True
         except exc.NoResultFound:
-            LOG.debug("reserving specific vlan %s on physical network %s "
-                      "outside pool" % (vlan_id, physical_network))
+            LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
+                        "network %(physical_network)s outside pool"),
+                      locals())
             alloc = ovs_models_v2.VlanAllocation(physical_network, vlan_id)
             alloc.allocated = True
             session.add(alloc)
@@ -177,12 +183,17 @@ def release_vlan(session, physical_network, vlan_id, network_vlan_ranges):
                     break
             if not inside:
                 session.delete(alloc)
-            LOG.debug("releasing vlan %s on physical network %s %s pool" %
-                      (vlan_id, physical_network,
-                       inside and "to" or "outside"))
+                LOG.debug(_("Releasing vlan %(vlan_id)s on physical network "
+                            "%(physical_network)s outside pool"),
+                          locals())
+            else:
+                LOG.debug(_("Releasing vlan %(vlan_id)s on physical network "
+                            "%(physical_network)s to pool"),
+                          locals())
         except exc.NoResultFound:
-            LOG.warning("vlan_id %s on physical network %s not found" %
-                        (vlan_id, physical_network))
+            LOG.warning(_("vlan_id %(vlan_id)s on physical network "
+                          "%(physical_network)s not found"),
+                        locals())
 
 
 def sync_tunnel_allocations(tunnel_id_ranges):
@@ -193,8 +204,9 @@ def sync_tunnel_allocations(tunnel_id_ranges):
     for tunnel_id_range in tunnel_id_ranges:
         tun_min, tun_max = tunnel_id_range
         if tun_max + 1 - tun_min > 1000000:
-            LOG.error("Skipping unreasonable tunnel ID range %s:%s" %
-                      tunnel_id_range)
+            LOG.error(_("Skipping unreasonable tunnel ID range "
+                        "%(tun_min)s:%(tun_max)s"),
+                      locals())
         else:
             tunnel_ids |= set(xrange(tun_min, tun_max + 1))
 
@@ -211,7 +223,7 @@ def sync_tunnel_allocations(tunnel_id_ranges):
                 # it's not allocatable, so check if its allocated
                 if not alloc.allocated:
                     # it's not, so remove it from table
-                    LOG.debug("removing tunnel %s from pool" %
+                    LOG.debug(_("Removing tunnel %s from pool"),
                               alloc.tunnel_id)
                     session.delete(alloc)
 
@@ -238,7 +250,7 @@ def reserve_tunnel(session):
                  filter_by(allocated=False).
                  first())
         if alloc:
-            LOG.debug("reserving tunnel %s from pool" % alloc.tunnel_id)
+            LOG.debug(_("Reserving tunnel %s from pool"), alloc.tunnel_id)
             alloc.allocated = True
             return alloc.tunnel_id
     raise q_exc.NoNetworkAvailable()
@@ -252,10 +264,11 @@ def reserve_specific_tunnel(session, tunnel_id):
                      one())
             if alloc.allocated:
                 raise q_exc.TunnelIdInUse(tunnel_id=tunnel_id)
-            LOG.debug("reserving specific tunnel %s from pool" % tunnel_id)
+            LOG.debug(_("Reserving specific tunnel %s from pool"), tunnel_id)
             alloc.allocated = True
         except exc.NoResultFound:
-            LOG.debug("reserving specific tunnel %s outside pool" % tunnel_id)
+            LOG.debug(_("Reserving specific tunnel %s outside pool"),
+                      tunnel_id)
             alloc = ovs_models_v2.TunnelAllocation(tunnel_id)
             alloc.allocated = True
             session.add(alloc)
@@ -276,10 +289,11 @@ def release_tunnel(session, tunnel_id, tunnel_id_ranges):
                     break
             if not inside:
                 session.delete(alloc)
-            LOG.debug("releasing tunnel %s %s pool" %
-                      (tunnel_id, inside and "to" or "outside"))
+                LOG.debug(_("Releasing tunnel %s outside pool"), tunnel_id)
+            else:
+                LOG.debug(_("Releasing tunnel %s to pool"), tunnel_id)
         except exc.NoResultFound:
-            LOG.warning("tunnel_id %s not found" % tunnel_id)
+            LOG.warning(_("tunnel_id %s not found"), tunnel_id)
 
 
 def get_port(port_id):
index f37ea634d26c29b20c6cad389a99c86ea5dee445..f7416b139b3e5831db3353eff52af3d7585ae98f 100644 (file)
@@ -64,7 +64,8 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
         """Agent requests device details"""
         agent_id = kwargs.get('agent_id')
         device = kwargs.get('device')
-        LOG.debug("Device %s details requested from %s", device, agent_id)
+        LOG.debug(_("Device %(device)s details requested from %(agent_id)s"),
+                  locals())
         port = ovs_db_v2.get_port(device)
         if port:
             binding = ovs_db_v2.get_network_binding(None, port['network_id'])
@@ -79,7 +80,7 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
             ovs_db_v2.set_port_status(port['id'], q_const.PORT_STATUS_ACTIVE)
         else:
             entry = {'device': device}
-            LOG.debug("%s can not be found in database", device)
+            LOG.debug(_("%s can not be found in database"), device)
         return entry
 
     def update_device_down(self, rpc_context, **kwargs):
@@ -87,7 +88,8 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
         # (TODO) garyk - live migration and port status
         agent_id = kwargs.get('agent_id')
         device = kwargs.get('device')
-        LOG.debug("Device %s no longer exists on %s", device, agent_id)
+        LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
+                  locals())
         port = ovs_db_v2.get_port(device)
         if port:
             entry = {'device': device,
@@ -97,7 +99,7 @@ class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
         else:
             entry = {'device': device,
                      'exists': False}
-            LOG.debug("%s can not be found in database", device)
+            LOG.debug(_("%s can not be found in database"), device)
         return entry
 
     def tunnel_sync(self, rpc_context, **kwargs):
@@ -197,8 +199,8 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
                                             constants.TYPE_VLAN,
                                             constants.TYPE_GRE,
                                             constants.TYPE_NONE]:
-            LOG.error("Invalid tenant_network_type: %s. "
-                      "Agent terminated!",
+            LOG.error(_("Invalid tenant_network_type: %s. "
+                      "Agent terminated!"),
                       self.tenant_network_type)
             sys.exit(1)
         self.enable_tunneling = cfg.CONF.OVS.enable_tunneling
@@ -207,8 +209,8 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
             self._parse_tunnel_id_ranges()
             ovs_db_v2.sync_tunnel_allocations(self.tunnel_id_ranges)
         elif self.tenant_network_type == constants.TYPE_GRE:
-            LOG.error("Tunneling disabled but tenant_network_type is 'gre'. "
-                      "Agent terminated!")
+            LOG.error(_("Tunneling disabled but tenant_network_type is 'gre'. "
+                      "Agent terminated!"))
             sys.exit(1)
         self.setup_rpc()
 
@@ -235,13 +237,13 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
                                                  int(vlan_min),
                                                  int(vlan_max))
                 except ValueError as ex:
-                    LOG.error("Invalid network VLAN range: '%s' - %s. "
-                              "Agent terminated!",
-                              entry, ex)
+                    LOG.error(_("Invalid network VLAN range: "
+                                "'%(range)s' - %(e)s. Agent terminated!"),
+                              {'range': entry, 'e': ex})
                     sys.exit(1)
             else:
                 self._add_network(entry)
-        LOG.info("Network VLAN ranges: %s", self.network_vlan_ranges)
+        LOG.info(_("Network VLAN ranges: %s"), self.network_vlan_ranges)
 
     def _add_network_vlan_range(self, physical_network, vlan_min, vlan_max):
         self._add_network(physical_network)
@@ -258,10 +260,11 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
                 tun_min, tun_max = entry.split(':')
                 self.tunnel_id_ranges.append((int(tun_min), int(tun_max)))
             except ValueError as ex:
-                LOG.error("Invalid tunnel ID range: '%s' - %s. "
-                          "Agent terminated!", entry, ex)
+                LOG.error(_("Invalid tunnel ID range: "
+                            "'%(range)s' - %(e)s. Agent terminated!"),
+                          {'range': entry, 'e': ex})
                 sys.exit(1)
-        LOG.info("Tunnel ID ranges: %s", self.tunnel_id_ranges)
+        LOG.info(_("Tunnel ID ranges: %s"), self.tunnel_id_ranges)
 
     # TODO(rkukura) Use core mechanism for attribute authorization
     # when available.
@@ -354,14 +357,14 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
             else:
                 segmentation_id = None
         else:
-            msg = _("provider:network_type %s not supported" % network_type)
+            msg = _("provider:network_type %s not supported") % network_type
             raise q_exc.InvalidInput(error_message=msg)
 
         if network_type in [constants.TYPE_VLAN, constants.TYPE_FLAT]:
             if physical_network_set:
                 if physical_network not in self.network_vlan_ranges:
-                    msg = _("unknown provider:physical_network %s" %
-                            physical_network)
+                    msg = _("Unknown provider:physical_network "
+                            "%s") % physical_network
                     raise q_exc.InvalidInput(error_message=msg)
             elif 'default' in self.network_vlan_ranges:
                 physical_network = 'default'
@@ -425,7 +428,7 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
             self._extend_network_dict_provider(context, net)
             self._extend_network_dict_l3(context, net)
             # note - exception will rollback entire transaction
-        LOG.debug("Created network: %s", net['id'])
+        LOG.debug(_("Created network: %s"), net['id'])
         return net
 
     def update_network(self, context, id, network):