Browse Source

Remove deprecation warnings for agents_db

Change I7be4ce2513e49e6da46a7bdffb8538613f0be7c7 relocated the Agent
model (and a few other functions), but some references to old
functions/model still remain. These cause a considerable amount of
warnings when running unit tests and the code itself.

Change-Id: Id026cae75bfa56b1023f8a1c4e5db750cf0bff5f
Partial-Bug: #1597913
changes/50/385950/3
John Schwarz 5 years ago
parent
commit
013a48f49b
  1. 3
      neutron/db/agentschedulers_db.py
  2. 4
      neutron/db/l3_agentschedulers_db.py
  3. 4
      neutron/db/models/l3agent.py
  4. 4
      neutron/db/models/l3ha.py
  5. 4
      neutron/scheduler/dhcp_agent_scheduler.py

3
neutron/db/agentschedulers_db.py

@ -28,6 +28,7 @@ from sqlalchemy import orm
from sqlalchemy.orm import exc
from neutron._i18n import _, _LE, _LI, _LW
from neutron.agent.common import utils as agent_utils
from neutron.common import constants as n_const
from neutron.common import utils
from neutron import context as ncontext
@ -125,7 +126,7 @@ class AgentSchedulerDbMixin(agents_db.AgentDbMixin):
# filter is set, only agents which are 'up'
# (i.e. have a recent heartbeat timestamp)
# are eligible, even if active is False
return not agents_db.AgentDbMixin.is_agent_down(
return not agent_utils.is_agent_down(
agent['heartbeat_timestamp'])
def update_agent(self, context, id, agent):

4
neutron/db/l3_agentschedulers_db.py

@ -28,9 +28,9 @@ from sqlalchemy.orm import joinedload
from sqlalchemy import sql
from neutron._i18n import _, _LI
from neutron.agent.common import utils as agent_utils
from neutron.common import _deprecate
from neutron.common import utils as n_utils
from neutron.db import agents_db
from neutron.db import agentschedulers_db
from neutron.db.models import agent as agent_model
from neutron.db.models import l3_attrs
@ -397,7 +397,7 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
if active is not None:
l3_agents = [l3_agent for l3_agent in
l3_agents if not
agents_db.AgentDbMixin.is_agent_down(
agent_utils.is_agent_down(
l3_agent['heartbeat_timestamp'])]
return l3_agents

4
neutron/db/models/l3agent.py

@ -15,7 +15,7 @@ from neutron_lib.db import model_base
import sqlalchemy as sa
from sqlalchemy import orm
from neutron.db import agents_db
from neutron.db.models import agent as agent_model
LOWEST_BINDING_INDEX = 1
@ -33,7 +33,7 @@ class RouterL3AgentBinding(model_base.BASEV2):
router_id = sa.Column(sa.String(36),
sa.ForeignKey("routers.id", ondelete='CASCADE'),
primary_key=True)
l3_agent = orm.relation(agents_db.Agent)
l3_agent = orm.relation(agent_model.Agent)
l3_agent_id = sa.Column(sa.String(36),
sa.ForeignKey("agents.id", ondelete='CASCADE'),
primary_key=True)

4
neutron/db/models/l3ha.py

@ -18,7 +18,7 @@ import sqlalchemy as sa
from sqlalchemy import orm
from neutron.common import constants as n_const
from neutron.db import agents_db
from neutron.db.models import agent as agent_model
from neutron.db import models_v2
@ -49,7 +49,7 @@ class L3HARouterAgentPortBinding(model_base.BASEV2):
l3_agent_id = sa.Column(sa.String(36),
sa.ForeignKey("agents.id",
ondelete='CASCADE'))
agent = orm.relationship(agents_db.Agent)
agent = orm.relationship(agent_model.Agent)
state = sa.Column(sa.Enum(n_const.HA_ROUTER_STATE_ACTIVE,
n_const.HA_ROUTER_STATE_STANDBY,

4
neutron/scheduler/dhcp_agent_scheduler.py

@ -24,7 +24,7 @@ from oslo_log import log as logging
from sqlalchemy import sql
from neutron._i18n import _LI, _LW
from neutron.db import agents_db
from neutron.agent.common import utils as agent_utils
from neutron.db import api as db_api
from neutron.db.models import agent as agent_model
from neutron.db.models import segment as segment_model
@ -72,7 +72,7 @@ class AutoScheduler(object):
segments_on_host = {s.segment_id for s in query}
for dhcp_agent in dhcp_agents:
if agents_db.AgentDbMixin.is_agent_down(
if agent_utils.is_agent_down(
dhcp_agent.heartbeat_timestamp):
LOG.warning(_LW('DHCP agent %s is not active'),
dhcp_agent.id)

Loading…
Cancel
Save