Merge "Fix making all user defined flavor routers HA"
This commit is contained in:
commit
4c9962e280
@ -17,6 +17,7 @@ from neutron_lib.callbacks import priority_group
|
|||||||
from neutron_lib.callbacks import registry
|
from neutron_lib.callbacks import registry
|
||||||
from neutron_lib.callbacks import resources
|
from neutron_lib.callbacks import resources
|
||||||
|
|
||||||
|
from neutron.common.ovn import utils
|
||||||
from neutron.db import l3_attrs_db
|
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,
|
# NOTE(ralonsoh): OVN L3 router HA flag is mandatory and True always,
|
||||||
# enforced by ``OvnDriver.ha_support`` set to ``MANDATORY``. This flag
|
# enforced by ``OvnDriver.ha_support`` set to ``MANDATORY``. This flag
|
||||||
# cannot be updated.
|
# cannot be updated.
|
||||||
|
router = payload.latest_state
|
||||||
|
if not utils.is_ovn_provider_router(router):
|
||||||
|
return
|
||||||
router_db = payload.metadata['router_db']
|
router_db = payload.metadata['router_db']
|
||||||
self.set_extra_attr_value(router_db, 'ha', True)
|
self.set_extra_attr_value(router_db, 'ha', True)
|
||||||
|
@ -48,3 +48,10 @@ class OVN_L3_HA_db_mixinTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
router_db = self._create_router(router_dict)
|
router_db = self._create_router(router_dict)
|
||||||
router = router_obj.Router.get_object(self.ctx, id=router_db.id)
|
router = router_obj.Router.get_object(self.ctx, id=router_db.id)
|
||||||
self.assertTrue(router.extra_attributes.ha)
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user