]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Correct i18n message for metaplugin
authorHe Jie Xu <xuhj@linux.vnet.ibm.com>
Thu, 13 Dec 2012 14:00:02 +0000 (22:00 +0800)
committerHe Jie Xu <xuhj@linux.vnet.ibm.com>
Thu, 13 Dec 2012 14:05:16 +0000 (22:05 +0800)
Part of bp make-string-localizable

Change-Id: Idf7158a7888a764efd5755be04f71595a0f55b7a

quantum/plugins/metaplugin/meta_quantum_plugin.py
quantum/plugins/metaplugin/proxy_quantum_plugin.py

index a2b1935561e18f7be962b76cff66583ef2ce946f..1d3b4839fec597bcec60c3282f0fa0e3f4bc200a 100644 (file)
@@ -49,7 +49,7 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
                    l3_db.L3_NAT_db_mixin):
 
     def __init__(self, configfile=None):
-        LOG.debug("Start initializing metaplugin")
+        LOG.debug(_("Start initializing metaplugin"))
         options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
         options.update({'base': models_v2.model_base.BASEV2})
         sql_max_retries = cfg.CONF.DATABASE.sql_max_retries
@@ -96,12 +96,12 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
 
         self.default_flavor = cfg.CONF.META.default_flavor
         if not self.default_flavor in self.plugins:
-            raise exc.Invalid('default_flavor %s is not plugin list' %
+            raise exc.Invalid(_('default_flavor %s is not plugin list') %
                               self.default_flavor)
 
         self.default_l3_flavor = cfg.CONF.META.default_l3_flavor
         if not self.default_l3_flavor in self.l3_plugins:
-            raise exc.Invalid('default_l3_flavor %s is not plugin list' %
+            raise exc.Invalid(_('default_l3_flavor %s is not plugin list') %
                               self.default_l3_flavor)
 
         db.configure_db(options)
@@ -117,7 +117,7 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
         self.default_flavor = cfg.CONF.META.default_flavor
 
     def _load_plugin(self, plugin_provider):
-        LOG.debug("Plugin location:%s", plugin_provider)
+        LOG.debug(_("Plugin location: %s"), plugin_provider)
         plugin_klass = importutils.import_class(plugin_provider)
         return plugin_klass()
 
@@ -168,17 +168,17 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
             if not self._is_l3_plugin(plugin):
                 self._process_l3_create(context, network['network'], net['id'])
                 self._extend_network_dict_l3(context, net)
-            LOG.debug("Created network: %s with flavor %s " % (net['id'],
-                                                               flavor))
+            LOG.debug(_("Created network: %(net_id)s with flavor "
+                        "%(flavor)s"), {'net_id': net['id'], 'flavor': flavor})
             try:
                 meta_db_v2.add_network_flavor_binding(context.session,
                                                       flavor, str(net['id']))
             except:
-                LOG.exception('failed to add flavor bindings')
+                LOG.exception(_('Failed to add flavor bindings'))
                 plugin.delete_network(context, net['id'])
                 raise FaildToAddFlavorBinding()
 
-        LOG.debug("Created network: %s" % net['id'])
+        LOG.debug(_("Created network: %s"), net['id'])
         self._extend_network_dict(context, net)
         return net
 
@@ -298,12 +298,13 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
         plugin = self._get_l3_plugin(flavor)
         with context.session.begin(subtransactions=True):
             r_in_db = plugin.create_router(context, router)
-            LOG.debug("Created router: %s with flavor %s " % (r_in_db['id'],
-                                                              flavor))
+            LOG.debug(_("Created router: %(router_id)s with flavor "
+                        "%(flavor)s"),
+                      {'router_id': r_in_db['id'], 'flavor': flavor})
             meta_db_v2.add_router_flavor_binding(context.session,
                                                  flavor, str(r_in_db['id']))
 
-        LOG.debug("Created router: %s" % r_in_db['id'])
+        LOG.debug(_("Created router: %s"), r_in_db['id'])
         self._extend_router_dict(context, r_in_db)
         return r_in_db
 
index 08fac53e3aff9339d811111dd7c64a4354171da8..9164fbc36d1a6fbc71edba6ff3f6c938382419cb 100644 (file)
@@ -71,14 +71,14 @@ class ProxyPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
         try:
             self._get_client().update_subnet(id, subnet)
         except Exception as e:
-            LOG.error("update subnet failed: %e" % e)
+            LOG.error(_("Update subnet failed: %s"), e)
         return subnet_in_db
 
     def delete_subnet(self, context, id):
         try:
             self._get_client().delete_subnet(id)
         except exceptions.NotFound:
-            LOG.warn("subnet in remote have already deleted")
+            LOG.warn(_("Subnet in remote have already deleted"))
         return super(ProxyPluginV2, self).delete_subnet(context, id)
 
     def create_network(self, context, network):
@@ -99,14 +99,14 @@ class ProxyPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
         try:
             self._get_client().update_network(id, network)
         except Exception as e:
-            LOG.error("update network failed: %e" % e)
+            LOG.error(_("Update network failed: %s"), e)
         return network_in_db
 
     def delete_network(self, context, id):
         try:
             self._get_client().delete_network(id)
         except exceptions.NetworkNotFoundClient:
-            LOG.warn("network in remote have already deleted")
+            LOG.warn(_("Network in remote have already deleted"))
         return super(ProxyPluginV2, self).delete_network(context, id)
 
     def create_port(self, context, port):
@@ -127,7 +127,7 @@ class ProxyPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
         try:
             self._get_client().update_port(id, port)
         except Exception as e:
-            LOG.error("update port failed: %e" % e)
+            LOG.error(_("Update port failed: %s"), e)
         return port_in_db
 
     def delete_port(self, context, id, l3_port_check=True):
@@ -138,5 +138,5 @@ class ProxyPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
         try:
             self._get_client().delete_port(id)
         except exceptions.PortNotFoundClient:
-            LOG.warn("port in remote have already deleted")
+            LOG.warn(_("Port in remote have already deleted"))
         return super(ProxyPluginV2, self).delete_port(context, id)