diff --git a/neutron/hacking/checks.py b/neutron/hacking/checks.py index 68dcfa1f9b8..f68f2063479 100644 --- a/neutron/hacking/checks.py +++ b/neutron/hacking/checks.py @@ -82,7 +82,7 @@ def _directory_to_check_translation(filename): "neutron/plugins/hyperv", #"neutron/plugins/ibm", "neutron/plugins/linuxbridge", - #"neutron/plugins/metaplugin", + "neutron/plugins/metaplugin", "neutron/plugins/midonet", "neutron/plugins/ml2", "neutron/plugins/mlnx", diff --git a/neutron/plugins/metaplugin/meta_neutron_plugin.py b/neutron/plugins/metaplugin/meta_neutron_plugin.py index e956eaee687..feff7e2f034 100644 --- a/neutron/plugins/metaplugin/meta_neutron_plugin.py +++ b/neutron/plugins/metaplugin/meta_neutron_plugin.py @@ -25,6 +25,7 @@ from neutron.db import extraroute_db from neutron.db import l3_db from neutron.db import models_v2 from neutron.extensions import flavor as ext_flavor +from neutron.i18n import _LE from neutron.openstack.common import log as logging from neutron.plugins.metaplugin.common import config # noqa from neutron.plugins.metaplugin import meta_db_v2 @@ -69,7 +70,7 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, def __init__(self, configfile=None): super(MetaPluginV2, self).__init__() - LOG.debug(_("Start initializing metaplugin")) + LOG.debug("Start initializing metaplugin") self.supported_extension_aliases = ['flavor', 'external-net'] if cfg.CONF.META.supported_extension_aliases: cfg_aliases = cfg.CONF.META.supported_extension_aliases.split(',') @@ -162,7 +163,7 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, _meta_flavor_filter_hook) 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() @@ -213,17 +214,17 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, flavor = self.default_flavor plugin = self._get_plugin(flavor) net = plugin.create_network(context, network) - LOG.debug(_("Created network: %(net_id)s with flavor " - "%(flavor)s"), {'net_id': net['id'], 'flavor': 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 Exception: - LOG.exception(_('Failed to add flavor bindings')) + LOG.exception(_LE('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 @@ -356,18 +357,18 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, flavor = self.default_l3_flavor plugin = self._get_l3_plugin(flavor) r_in_db = plugin.create_router(context, router) - LOG.debug(_("Created router: %(router_id)s with flavor " - "%(flavor)s"), + LOG.debug("Created router: %(router_id)s with flavor " + "%(flavor)s", {'router_id': r_in_db['id'], 'flavor': flavor}) try: meta_db_v2.add_router_flavor_binding(context.session, flavor, str(r_in_db['id'])) except Exception: - LOG.exception(_('Failed to add flavor bindings')) + LOG.exception(_LE('Failed to add flavor bindings')) plugin.delete_router(context, r_in_db['id']) raise FaildToAddFlavorBinding() - 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 diff --git a/neutron/plugins/metaplugin/proxy_neutron_plugin.py b/neutron/plugins/metaplugin/proxy_neutron_plugin.py index 1309adc0a86..35d4b4a5795 100644 --- a/neutron/plugins/metaplugin/proxy_neutron_plugin.py +++ b/neutron/plugins/metaplugin/proxy_neutron_plugin.py @@ -18,6 +18,7 @@ from oslo.config import cfg from neutron.db import db_base_plugin_v2 from neutron.db import external_net_db from neutron.db import l3_db +from neutron.i18n import _LE, _LW from neutron.openstack.common import log as logging from neutronclient.common import exceptions from neutronclient.v2_0 import client @@ -63,14 +64,14 @@ class ProxyPluginV2(db_base_plugin_v2.NeutronDbPluginV2, try: self._get_client().update_subnet(id, subnet) except Exception as e: - LOG.error(_("Update subnet failed: %s"), e) + LOG.error(_LE("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(_LW("Subnet in remote have already deleted")) return super(ProxyPluginV2, self).delete_subnet(context, id) def create_network(self, context, network): @@ -91,14 +92,14 @@ class ProxyPluginV2(db_base_plugin_v2.NeutronDbPluginV2, try: self._get_client().update_network(id, network) except Exception as e: - LOG.error(_("Update network failed: %s"), e) + LOG.error(_LE("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(_LW("Network in remote have already deleted")) return super(ProxyPluginV2, self).delete_network(context, id) def create_port(self, context, port): @@ -119,7 +120,7 @@ class ProxyPluginV2(db_base_plugin_v2.NeutronDbPluginV2, try: self._get_client().update_port(id, port) except Exception as e: - LOG.error(_("Update port failed: %s"), e) + LOG.error(_LE("Update port failed: %s"), e) return port_in_db def delete_port(self, context, id, l3_port_check=True): @@ -130,5 +131,5 @@ class ProxyPluginV2(db_base_plugin_v2.NeutronDbPluginV2, try: self._get_client().delete_port(id) except exceptions.PortNotFoundClient: - LOG.warn(_("Port in remote have already deleted")) + LOG.warn(_LW("Port in remote have already deleted")) return super(ProxyPluginV2, self).delete_port(context, id)