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
This commit is contained in:
Cedric Brandily 2014-11-25 13:44:18 +00:00
parent 06e131a23f
commit 0dd2911b6d
4 changed files with 11 additions and 8 deletions

View File

@ -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])

View File

@ -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

View File

@ -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):

View File

@ -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):