Merge "Allow HA routers to have automatic l3agent failover"

This commit is contained in:
Zuul 2024-03-06 09:32:43 +00:00 committed by Gerrit Code Review
commit 36c6da46e5
2 changed files with 2 additions and 6 deletions

View File

@ -14,8 +14,6 @@ from neutron_lib.db import api as db_api
from neutron_lib.objects import common_types
from oslo_versionedobjects import fields as obj_fields
from sqlalchemy import sql
from neutron.common import _constants as n_const
from neutron.db.models import agent as agent_model
from neutron.db.models import l3_attrs
@ -59,9 +57,7 @@ class RouterL3AgentBinding(base.NeutronDbObject):
agent_model.Agent.admin_state_up).outerjoin(
l3_attrs.RouterExtraAttributes,
l3_attrs.RouterExtraAttributes.router_id ==
l3agent.RouterL3AgentBinding.router_id).filter(
l3_attrs.RouterExtraAttributes.ha.in_(
[sql.false(), sql.null()])))
l3agent.RouterL3AgentBinding.router_id))
bindings = [cls._load_object(context, db_obj) for db_obj in
query.all()]
return bindings

View File

@ -1718,7 +1718,7 @@ class L3AgentSchedulerDbMixinTestCase(L3HATestCaseMixin):
self._set_l3_agent_dead(self.agent_id1)
with mock.patch.object(self.plugin, 'reschedule_router') as reschedule:
self.plugin.reschedule_routers_from_down_agents()
self.assertFalse(reschedule.called)
self.assertTrue(reschedule.called)
def test_list_l3_agents_hosting_ha_router(self):
router = self._create_ha_router()