Expose failover_mode option for T1 Router in MP

This option is already exposed for Policy. In MP this option is only
accessable via update calls for now. This patch allows user to create T1
router with this option set to desired value, saving an addtional call.

Change-Id: I29f4122f5d5ba60732046b95af9b8de08819cbeb
This commit is contained in:
Shawn Wang 2020-01-22 18:30:55 -08:00
parent 3aca031d96
commit 9c5886b3d8
No known key found for this signature in database
GPG Key ID: C98A86CC967E89A7
2 changed files with 8 additions and 2 deletions

View File

@ -845,6 +845,7 @@ class LogicalRouterTestCase(BaseTestResource):
tier0_router = True
description = 'dummy'
tz_id = 'tz_id'
failover_mode = 'PREEMPTIVE'
allocation_pool = {
'allocation_pool_type': 'LoadBalancerAllocationPool',
'allocation_size': 'SMALL'
@ -854,7 +855,8 @@ class LogicalRouterTestCase(BaseTestResource):
router.create(fake_router['display_name'], None, None,
tier0_router,
description=description, transport_zone_id=tz_id,
allocation_pool=allocation_pool)
allocation_pool=allocation_pool,
failover_mode=failover_mode)
data = {
'display_name': fake_router['display_name'],
@ -862,6 +864,7 @@ class LogicalRouterTestCase(BaseTestResource):
'tags': None,
'description': description,
'advanced_config': {'transport_zone_id': tz_id},
'failover_mode': failover_mode,
'allocation_profile': {
'allocation_pool': allocation_pool
}

View File

@ -766,7 +766,8 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
def create(self, display_name, tags, edge_cluster_uuid=None, tier_0=False,
description=None, transport_zone_id=None,
allocation_pool=None, enable_standby_relocation=False):
allocation_pool=None, enable_standby_relocation=False,
failover_mode=None):
# TODO(salv-orlando): If possible do not manage edge clusters
# in the main plugin logic.
router_type = (nsx_constants.ROUTER_TYPE_TIER0 if tier_0 else
@ -781,6 +782,8 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
if transport_zone_id:
body['advanced_config'] = {
'transport_zone_id': transport_zone_id}
if failover_mode:
body['failover_mode'] = failover_mode
allocation_profile = {}
if allocation_pool:
allocation_profile['allocation_pool'] = allocation_pool