Make exclusive router size updatable

Router size attribute of exclusive router should be updatable.

Change-Id: I6ac08f7f6e46cb5728634482d30063994cbc9495
This commit is contained in:
Kobi Samoray 2016-06-20 15:19:47 +03:00
parent bd03392d88
commit 5ea7727516
2 changed files with 11 additions and 1 deletions

View File

@ -20,7 +20,7 @@ ROUTER_SIZE = 'router_size'
VALID_EDGE_SIZES = ['compact', 'large', 'xlarge', 'quadlarge']
EXTENDED_ATTRIBUTES_2_0 = {
'routers': {
ROUTER_SIZE: {'allow_post': True, 'allow_put': False,
ROUTER_SIZE: {'allow_post': True, 'allow_put': True,
'validate': {'type:values': VALID_EDGE_SIZES},
'default': constants.ATTR_NOT_SPECIFIED,
'is_visible': True},

View File

@ -67,6 +67,16 @@ class RouterExclusiveDriver(router_driver.RouterBaseDriver):
context, router_id, self.get_type(), r['admin_state_up'])
if 'name' in r:
self.edge_manager.rename_lrouter(context, router_id, r['name'])
if r.get('router_size'):
edge_id = edge_utils.get_router_edge_id(context, router_id)
with locking.LockManager.get_lock(edge_id):
edge_cfg = self.vcns.get_edge(edge_id)[1]
if edge_cfg.get('appliances'):
edge_cfg['appliances']['applianceSize'] = r['router_size']
self.vcns.update_edge(edge_id, edge_cfg, async=False)
nsxv_db.update_nsxv_router_binding(
context.session, router_id,
appliance_size=r['router_size'])
return self.plugin.get_router(context, router_id)
def detach_router(self, context, router_id, router):