Change default backup edge size to compact

By defaut, nsxv uses compact size of edge to support dhcp and router
service. the patch changed the default backup edge size from large to
compact.
Close-bug: #1570676

Change-Id: I65262fbb4a4a58725069595b3f3043983f14985a
This commit is contained in:
linb 2016-04-15 09:41:51 +08:00
parent 36675790c7
commit 185b265d55
3 changed files with 23 additions and 21 deletions

View File

@ -412,17 +412,16 @@ nsxv_opts = [
help=_('(Optional) Maximum number of sub interfaces supported '
'per vnic in edge.')),
cfg.ListOpt('backup_edge_pool',
default=['service:large:4:10',
'service:compact:4:10',
'vdr:large:4:10'],
default=['service:compact:4:10',
'vdr:compact:4:10'],
help=_("Defines edge pool's management range with the format: "
"<edge_type>:[edge_size]:<min_edges>:<max_edges>."
"edge_type: service,vdr. "
"edge_size: compact, large, xlarge, quadlarge "
"and default is large. By default, edge pool manager "
"would manage service edge with compact&&large size "
"and distributed edge with large size as following: "
"service:large:4:10,service:compact:4:10,vdr:large:"
"and default is compact. By default, edge pool manager "
"would manage service edge with compact size "
"and distributed edge with compact size as following: "
"service:compact:4:10,vdr:compact:"
"4:10")),
cfg.IntOpt('retries',
default=20,

View File

@ -74,7 +74,7 @@ def parse_backup_edge_pool_opt():
'allowed': vcns_const.ALLOWED_EDGE_TYPES})
LOG.error(msg)
raise n_exc.Invalid(msg)
edge_size = edge_size or nsxv_constants.LARGE
edge_size = edge_size or nsxv_constants.COMPACT
if edge_size not in vcns_const.ALLOWED_EDGE_SIZES:
msg = (_("edge size '%(edge_size)s' is not allowed, "
"allowed types: %(allowed)s") %
@ -154,7 +154,7 @@ class EdgeManager(object):
status=plugin_const.ERROR)
def _deploy_edge(self, context, lrouter,
lswitch=None, appliance_size=nsxv_constants.LARGE,
lswitch=None, appliance_size=nsxv_constants.COMPACT,
edge_type=nsxv_constants.SERVICE_EDGE, async=True):
"""Create an edge for logical router support."""
router_id = lrouter['id']
@ -174,7 +174,7 @@ class EdgeManager(object):
return task
def _deploy_backup_edges_on_db(self, context, num,
appliance_size=nsxv_constants.LARGE,
appliance_size=nsxv_constants.COMPACT,
edge_type=nsxv_constants.SERVICE_EDGE):
router_ids = [(vcns_const.BACKUP_ROUTER_PREFIX +
_uuid())[:vcns_const.EDGE_NAME_LEN]
@ -188,7 +188,7 @@ class EdgeManager(object):
return router_ids
def _deploy_backup_edges_at_backend(self, context, router_ids,
appliance_size=nsxv_constants.LARGE,
appliance_size=nsxv_constants.COMPACT,
edge_type=nsxv_constants.SERVICE_EDGE):
eventlet.spawn_n(self._pool_creator, context, router_ids,
@ -248,7 +248,7 @@ class EdgeManager(object):
error_router_bindings)
def _get_backup_edge_bindings(self, context,
appliance_size=nsxv_constants.LARGE,
appliance_size=nsxv_constants.COMPACT,
edge_type=nsxv_constants.SERVICE_EDGE,
db_update_lock=False):
filters = {'appliance_size': [appliance_size],
@ -278,7 +278,7 @@ class EdgeManager(object):
def _check_backup_edge_pool(self,
minimum_pooled_edges,
maximum_pooled_edges,
appliance_size=nsxv_constants.LARGE,
appliance_size=nsxv_constants.COMPACT,
edge_type=nsxv_constants.SERVICE_EDGE):
"""Check edge pool's status and return one available edge for use."""
admin_ctx = q_context.get_admin_context()
@ -321,7 +321,7 @@ class EdgeManager(object):
return False
def _get_available_router_binding(self, context,
appliance_size=nsxv_constants.LARGE,
appliance_size=nsxv_constants.COMPACT,
edge_type=nsxv_constants.SERVICE_EDGE):
backup_router_bindings = self._get_backup_edge_bindings(
context, appliance_size=appliance_size, edge_type=edge_type)
@ -533,7 +533,7 @@ class EdgeManager(object):
@vcns.retry_upon_exception(db_base_exc.OperationalError, max_delay=10)
def _allocate_edge_appliance(self, context, resource_id, name,
appliance_size=nsxv_constants.LARGE,
appliance_size=nsxv_constants.COMPACT,
dist=False):
"""Try to allocate one available edge from pool."""

View File

@ -350,14 +350,14 @@ class EdgeManagerTestCase(EdgeUtilsTestCaseMixin):
self.assertEqual(expect_edge_pool_dicts, edge_pool_dicts)
def test_backup_edge_pool_with_vdr_conf(self):
cfg.CONF.set_override('backup_edge_pool', ['vdr::1:3'], 'nsxv')
cfg.CONF.set_override('backup_edge_pool', ['vdr:large:1:3'], 'nsxv')
edge_pool_dicts = edge_utils.parse_backup_edge_pool_opt()
expect_edge_pool_dicts = self.vdr_edge_pool_dicts
self.assertEqual(expect_edge_pool_dicts, edge_pool_dicts)
def test_backup_edge_pool_with_duplicate_conf(self):
cfg.CONF.set_override('backup_edge_pool',
['service:large:1:3', 'service::3:4'],
['service:compact:1:3', 'service::3:4'],
'nsxv')
self.assertRaises(n_exc.Invalid, edge_utils.parse_backup_edge_pool_opt)
@ -486,7 +486,8 @@ class EdgeManagerTestCase(EdgeUtilsTestCaseMixin):
1, 2, 0, 4, 0,
error_at_backend_status=plugin_const.ACTIVE,
size=nsxv_constants.LARGE)
backup_bindings = self.edge_manager._get_backup_edge_bindings(self.ctx)
backup_bindings = self.edge_manager._get_backup_edge_bindings(self.ctx,
appliance_size=nsxv_constants.LARGE)
self._verify_router_bindings(expect_backup_bindings, backup_bindings)
def test_get_available_router_bindings(self):
@ -653,7 +654,8 @@ class EdgeManagerTestCase(EdgeUtilsTestCaseMixin):
1, 2, 3, 4, 5, edge_type=nsxv_constants.VDR_EDGE))
self._populate_vcns_router_binding(pool_edges)
self.edge_manager._allocate_edge_appliance(
self.ctx, 'fake_id', 'fake_name')
self.ctx, 'fake_id', 'fake_name',
appliance_size=nsxv_constants.LARGE)
edge_id = (EDGE_AVAIL + nsxv_constants.LARGE + '-' +
nsxv_constants.SERVICE_EDGE + '-edge-' + str(0))
self.nsxv_manager.update_edge.assert_has_calls(
@ -686,7 +688,8 @@ class EdgeManagerTestCase(EdgeUtilsTestCaseMixin):
1, 2, 3, 4, 5, edge_type=nsxv_constants.VDR_EDGE))
self._populate_vcns_router_binding(pool_edges)
self.edge_manager._allocate_edge_appliance(
self.ctx, 'fake_id', 'fake_name', dist=True)
self.ctx, 'fake_id', 'fake_name', dist=True,
appliance_size=nsxv_constants.LARGE)
edge_id = (EDGE_AVAIL + nsxv_constants.LARGE + '-' +
nsxv_constants.VDR_EDGE + '-edge-' + str(0))
self.nsxv_manager.update_edge.assert_has_calls(
@ -710,7 +713,7 @@ class EdgeManagerTestCase(EdgeUtilsTestCaseMixin):
assert not self.nsxv_manager.delete_edge.called
self.nsxv_manager.update_edge.assert_has_calls(
[mock.call(mock.ANY, mock.ANY, mock.ANY, None,
appliance_size=nsxv_constants.LARGE, dist=False)])
appliance_size=nsxv_constants.COMPACT, dist=False)])
def test_free_edge_appliance_with_default_with_full(self):
self.edge_pool_dicts = {