]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Enforce log hints in neutron.plugins.plumgrid
authorCedric Brandily <zzelle@gmail.com>
Tue, 25 Nov 2014 13:44:18 +0000 (13:44 +0000)
committerCedric Brandily <zzelle@gmail.com>
Wed, 3 Dec 2014 16:21:33 +0000 (16:21 +0000)
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

neutron/hacking/checks.py
neutron/plugins/plumgrid/drivers/fake_plumlib.py
neutron/plugins/plumgrid/drivers/plumlib.py
neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py

index afd9a690bef74377772f757d0f2d394f9b4a29bd..343f47a115984a7f638227bbac534c25e93baa6d 100644 (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])
index 8fd252ffef870dd2c6b290f8df55694eaa678c62..90e5c4ccba03f0d246e4d08b76b55593faceda92 100644 (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
 
index 6b12e4851468969aa6588e41fe69a2855f9645b9..6056100c8cb5f06ee0a5cfb958c68201f327d25b 100644 (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):
index b879f6dfd3a1348c373dff3f4e8804b39850cf8d..35ec29745cfa65a7b2d13429592c4bb3bae15cea 100644 (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):