From: Cedric Brandily Date: Tue, 25 Nov 2014 13:44:18 +0000 (+0000) Subject: Enforce log hints in neutron.plugins.plumgrid X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=e2a3de6e61d6b6022e96097f3a423b3f90f77fb6;p=openstack-build%2Fneutron-build.git Enforce log hints in neutron.plugins.plumgrid This change enforces log hints use and removes debug level log translation, modifications are validated through a hacking rule and the change respects loggging guidelines. Validate that hacking rules apply to directories: - neutron/plugins/plumgrid Change-Id: Ie85abb93cdbe50bdd56c9f987784baf4c4dd631d Partial-bug: #1320867 --- diff --git a/neutron/hacking/checks.py b/neutron/hacking/checks.py index afd9a690b..343f47a11 100644 --- a/neutron/hacking/checks.py +++ b/neutron/hacking/checks.py @@ -92,7 +92,7 @@ def _directory_to_check_translation(filename): #"neutron/plugins/oneconvergence", #"neutron/plugins/opencontrail", "neutron/plugins/openvswitch", - #"neutron/plugins/plumgrid", + "neutron/plugins/plumgrid", "neutron/plugins/sriovnicagent", "neutron/plugins/vmware"] return any([dir in filename for dir in dirs]) diff --git a/neutron/plugins/plumgrid/drivers/fake_plumlib.py b/neutron/plugins/plumgrid/drivers/fake_plumlib.py index 8fd252ffe..90e5c4ccb 100644 --- a/neutron/plugins/plumgrid/drivers/fake_plumlib.py +++ b/neutron/plugins/plumgrid/drivers/fake_plumlib.py @@ -13,6 +13,7 @@ # under the License. from neutron.extensions import providernet as provider +from neutron.i18n import _LI from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) @@ -26,12 +27,12 @@ class Plumlib(): """ def __init__(self): - LOG.info(_('Python PLUMgrid Fake Library Started ')) + LOG.info(_LI('Python PLUMgrid Fake Library Started ')) pass def director_conn(self, director_plumgrid, director_port, timeout, director_admin, director_password): - LOG.info(_('Fake Director: %s'), + LOG.info(_LI('Fake Director: %s'), director_plumgrid + ':' + director_port) pass diff --git a/neutron/plugins/plumgrid/drivers/plumlib.py b/neutron/plugins/plumgrid/drivers/plumlib.py index 6b12e4851..6056100c8 100644 --- a/neutron/plugins/plumgrid/drivers/plumlib.py +++ b/neutron/plugins/plumgrid/drivers/plumlib.py @@ -20,6 +20,7 @@ to the PLUMgrid Network Management System called Director from plumgridlib import plumlib +from neutron.i18n import _LI from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) @@ -32,7 +33,7 @@ class Plumlib(object): """ def __init__(self): - LOG.info(_('Python PLUMgrid Library Started ')) + LOG.info(_LI('Python PLUMgrid Library Started ')) def director_conn(self, director_plumgrid, director_port, timeout, director_admin, director_password): diff --git a/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py b/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py index b879f6dfd..35ec29745 100644 --- a/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py +++ b/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py @@ -33,6 +33,7 @@ from neutron.db import quota_db # noqa from neutron.db import securitygroups_db from neutron.extensions import portbindings from neutron.extensions import securitygroup as sec_grp +from neutron.i18n import _LI, _LW from neutron.openstack.common import log as logging from neutron.plugins.plumgrid.common import exceptions as plum_excep from neutron.plugins.plumgrid.plumgrid_plugin import plugin_ver @@ -70,7 +71,7 @@ class NeutronPluginPLUMgridV2(db_base_plugin_v2.NeutronDbPluginV2, binding_set = "extension:port_binding:set" def __init__(self): - LOG.info(_('Neutron PLUMgrid Director: Starting Plugin')) + LOG.info(_LI('Neutron PLUMgrid Director: Starting Plugin')) super(NeutronPluginPLUMgridV2, self).__init__() self.plumgrid_init() @@ -88,7 +89,7 @@ class NeutronPluginPLUMgridV2(db_base_plugin_v2.NeutronDbPluginV2, plum_driver = cfg.CONF.plumgriddirector.driver # PLUMgrid Director info validation - LOG.info(_('Neutron PLUMgrid Director: %s'), director_plumgrid) + LOG.info(_LI('Neutron PLUMgrid Director: %s'), director_plumgrid) self._plumlib = importutils.import_object(plum_driver) self._plumlib.director_conn(director_plumgrid, director_port, timeout, director_admin, director_password) @@ -765,8 +766,8 @@ class NeutronPluginPLUMgridV2(db_base_plugin_v2.NeutronDbPluginV2, def _network_admin_state(self, network): if network["network"].get("admin_state_up") is False: - LOG.warning(_("Networks with admin_state_up=False are not " - "supported by PLUMgrid plugin yet.")) + LOG.warning(_LW("Networks with admin_state_up=False are not " + "supported by PLUMgrid plugin yet.")) return network def _allocate_pools_for_subnet(self, context, subnet):