From 101af7b661bed9095eb0def76be1ab3b150c306e Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Thu, 4 Aug 2016 01:55:06 -0700 Subject: [PATCH] Remove neutron-lib warnings Addresses warnings for constants now supported in neutron lib. TrivialFix Change-Id: Ia450b8e6a71714a913219e806770652281f9f31d --- neutron/db/l3_hamode_db.py | 8 ++++---- .../tests/unit/scheduler/test_l3_agent_scheduler.py | 13 ++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/neutron/db/l3_hamode_db.py b/neutron/db/l3_hamode_db.py index 411249a0156..29d63ff3456 100644 --- a/neutron/db/l3_hamode_db.py +++ b/neutron/db/l3_hamode_db.py @@ -319,8 +319,8 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin, min_agents = cfg.CONF.min_l3_agents_per_router num_agents = len(self.get_l3_agents(context, active=True, - filters={'agent_modes': [n_const.L3_AGENT_MODE_LEGACY, - n_const.L3_AGENT_MODE_DVR_SNAT]})) + filters={'agent_modes': [constants.L3_AGENT_MODE_LEGACY, + constants.L3_AGENT_MODE_DVR_SNAT]})) max_agents = cfg.CONF.max_l3_agents_per_router if max_agents: if max_agents > num_agents: @@ -723,8 +723,8 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin, def get_ha_sync_data_for_host(self, context, host, agent, router_ids=None, active=None): agent_mode = self._get_agent_mode(agent) - dvr_agent_mode = (agent_mode in [n_const.L3_AGENT_MODE_DVR_SNAT, - n_const.L3_AGENT_MODE_DVR]) + dvr_agent_mode = (agent_mode in [constants.L3_AGENT_MODE_DVR_SNAT, + constants.L3_AGENT_MODE_DVR]) if (dvr_agent_mode and n_utils.is_extension_supported( self, constants.L3_DISTRIBUTED_EXT_ALIAS)): # DVR has to be handled differently diff --git a/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py b/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py index 3faba1c02fa..82057ee2a12 100644 --- a/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py +++ b/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py @@ -26,7 +26,6 @@ from oslo_utils import timeutils from sqlalchemy import orm import testscenarios -from neutron.common import constants as n_const from neutron import context as n_context from neutron.db import agents_db from neutron.db import db_base_plugin_v2 as db_v2 @@ -286,18 +285,18 @@ class L3SchedulerBaseMixin(object): def _register_l3_agents(self, plugin=None): self.agent1 = helpers.register_l3_agent( - 'host_1', n_const.L3_AGENT_MODE_LEGACY) + 'host_1', constants.L3_AGENT_MODE_LEGACY) self.agent_id1 = self.agent1.id self.agent2 = helpers.register_l3_agent( - 'host_2', n_const.L3_AGENT_MODE_LEGACY) + 'host_2', constants.L3_AGENT_MODE_LEGACY) self.agent_id2 = self.agent2.id def _register_l3_dvr_agents(self): self.l3_dvr_agent = helpers.register_l3_agent( - HOST_DVR, n_const.L3_AGENT_MODE_DVR) + HOST_DVR, constants.L3_AGENT_MODE_DVR) self.l3_dvr_agent_id = self.l3_dvr_agent.id self.l3_dvr_snat_agent = helpers.register_l3_agent( - HOST_DVR_SNAT, n_const.L3_AGENT_MODE_DVR_SNAT) + HOST_DVR_SNAT, constants.L3_AGENT_MODE_DVR_SNAT) self.l3_dvr_snat_id = self.l3_dvr_snat_agent.id def _set_l3_agent_admin_state(self, context, agent_id, state=True): @@ -1676,7 +1675,7 @@ class L3HAChanceSchedulerTestCase(L3HATestCaseMixin): def test_auto_schedule_ha_router_when_incompatible_agent_exist(self): handle_internal_only_routers_agent = helpers.register_l3_agent( - 'host_3', n_const.L3_AGENT_MODE_LEGACY, internal_only=False) + 'host_3', constants.L3_AGENT_MODE_LEGACY, internal_only=False) router = self._create_ha_router() self.plugin.auto_schedule_routers( @@ -1690,7 +1689,7 @@ class L3HAChanceSchedulerTestCase(L3HATestCaseMixin): def test_auto_schedule_ha_router_when_dvr_agent_exist(self): dvr_agent = helpers.register_l3_agent( - HOST_DVR, n_const.L3_AGENT_MODE_DVR) + HOST_DVR, constants.L3_AGENT_MODE_DVR) router = self._create_ha_router() self.plugin.auto_schedule_routers(self.adminContext, dvr_agent.host,