Merge "Fix making all user defined flavor routers HA"

This commit is contained in:
Zuul 2024-03-20 00:21:55 +00:00 committed by Gerrit Code Review
commit 4c9962e280
2 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,7 @@ from neutron_lib.callbacks import priority_group
from neutron_lib.callbacks import registry
from neutron_lib.callbacks import resources
from neutron.common.ovn import utils
from neutron.db import l3_attrs_db
@ -31,5 +32,8 @@ class OVN_L3_HA_db_mixin(l3_attrs_db.ExtraAttributesMixin):
# NOTE(ralonsoh): OVN L3 router HA flag is mandatory and True always,
# enforced by ``OvnDriver.ha_support`` set to ``MANDATORY``. This flag
# cannot be updated.
router = payload.latest_state
if not utils.is_ovn_provider_router(router):
return
router_db = payload.metadata['router_db']
self.set_extra_attr_value(router_db, 'ha', True)

View File

@ -48,3 +48,10 @@ class OVN_L3_HA_db_mixinTestCase(test_plugin.NeutronDbPluginV2TestCase):
router_db = self._create_router(router_dict)
router = router_obj.Router.get_object(self.ctx, id=router_db.id)
self.assertTrue(router.extra_attributes.ha)
def test_create_no_ovn_router(self):
router_dict = {'name': 'foo_router', 'admin_state_up': True,
'distributed': False, 'flavor_id': 'uuid'}
router_db = self._create_router(router_dict)
router = router_obj.Router.get_object(self.ctx, id=router_db.id)
self.assertFalse(router.extra_attributes.ha)