Merge "Use choices for exclusive_router_appliance_size"
This commit is contained in:
commit
43a52e0a58
@ -18,6 +18,7 @@ from oslo_config import cfg
|
||||
|
||||
from neutron.i18n import _LW
|
||||
from vmware_nsx.common import exceptions as nsx_exc
|
||||
from vmware_nsx.extensions import routersize
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -327,11 +328,11 @@ nsxv_opts = [
|
||||
help=_("Enable HA for NSX Edges")),
|
||||
cfg.StrOpt('exclusive_router_appliance_size',
|
||||
default="compact",
|
||||
choices=routersize.VALID_EDGE_SIZES,
|
||||
help=_("Edge appliance size to be used for creating exclusive "
|
||||
"router. Valid values: ['compact', 'large', 'xlarge', "
|
||||
"'quadlarge']. This edge_appliance_size will be picked "
|
||||
"up if --router-size parameter is not specified while "
|
||||
"doing neutron router-create")),
|
||||
"router. This edge_appliance_size will be picked up if "
|
||||
"--router-size parameter is not specified while doing "
|
||||
"neutron router-create")),
|
||||
]
|
||||
|
||||
# Register the configuration options
|
||||
|
@ -1403,16 +1403,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
raise n_exc.BadRequest(resource="router", msg=msg)
|
||||
else:
|
||||
if r.get('router_type') == nsxv_constants.EXCLUSIVE:
|
||||
appliance_size = cfg.CONF.nsxv.exclusive_router_appliance_size
|
||||
if appliance_size not in VALID_EDGE_SIZES:
|
||||
msg = (_("Invalid edge size specified in nsx.ini file. "
|
||||
"Specified value: %(specified)s; "
|
||||
"Valid values: %(valid)s") %
|
||||
{'specified': appliance_size,
|
||||
'valid': VALID_EDGE_SIZES})
|
||||
raise n_exc.BadRequest(resource="router", msg=msg)
|
||||
else:
|
||||
r[ROUTER_SIZE] = appliance_size
|
||||
r[ROUTER_SIZE] = cfg.CONF.nsxv.exclusive_router_appliance_size
|
||||
|
||||
def create_router(self, context, router, allow_metadata=True):
|
||||
r = router['router']
|
||||
|
@ -1961,18 +1961,6 @@ class TestExclusiveRouterTestCase(L3NatTest, L3NatTestCaseBase,
|
||||
router = self.deserialize(self.fmt, res)
|
||||
self.assertEqual('xlarge', router['router']['router_size'])
|
||||
|
||||
def test_router_create_fails_when_bad_edge_size_specified(self):
|
||||
data = {'router': {
|
||||
'tenant_id': 'whatever',
|
||||
'name': 'test_router',
|
||||
'router_type': 'exclusive'}}
|
||||
cfg.CONF.set_override('exclusive_router_appliance_size',
|
||||
'foobar', group='nsxv')
|
||||
router_req = self.new_create_request('routers', data, self.fmt)
|
||||
res = router_req.get_response(self.ext_api)
|
||||
router = self.deserialize(self.fmt, res)
|
||||
self.assertEqual("BadRequest", router['NeutronError']['type'])
|
||||
|
||||
def test_router_add_gateway_invalid_network_returns_404(self):
|
||||
# NOTE(salv-orlando): This unit test has been overriden
|
||||
# as the nsx plugin support the ext_gw_mode extension
|
||||
|
Loading…
x
Reference in New Issue
Block a user