Add support for nic and az in cluster grow

Added support for the nic and az parameter in cluster grow for
mongodb.

Redis and cassandra already fully supported these fields.

Change-Id: If1cecbd0a893bb493187cdad0c563e6ea681d250
Closes-Bug: #1641675
This commit is contained in:
Duk Loi 2016-05-07 12:03:25 -04:00 committed by Peter Stachowski
parent 8adfb7e4f2
commit eda431d228
3 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,4 @@
---
fixes:
- Pass instance nic and az to cluster grow. Add specific
Fix for mongodb to use the instance nic and az.

View File

@ -298,6 +298,11 @@ class Cluster(object):
instance['volume_size'] = int(node['volume']['size']) instance['volume_size'] = int(node['volume']['size'])
if 'modules' in node: if 'modules' in node:
instance['modules'] = node['modules'] instance['modules'] = node['modules']
if 'nics' in node:
instance['nics'] = node['nics']
if 'availability_zone' in node:
instance['availability_zone'] = (
node['availability_zone'])
instances.append(instance) instances.append(instance)
return self.grow(instances) return self.grow(instances)
elif action == 'shrink': elif action == 'shrink':

View File

@ -199,6 +199,8 @@ class MongoDbCluster(models.Cluster):
'query_router']) 'query_router'])
name = _check_option('name') name = _check_option('name')
related_to = _check_option('related_to') related_to = _check_option('related_to')
nics = _check_option('nics')
availability_zone = _check_option('availability_zone')
unused_keys = list(set(item.keys()).difference(set(used_keys))) unused_keys = list(set(item.keys()).difference(set(used_keys)))
if unused_keys: if unused_keys:
@ -214,6 +216,10 @@ class MongoDbCluster(models.Cluster):
instance['name'] = name instance['name'] = name
if related_to: if related_to:
instance['related_to'] = related_to instance['related_to'] = related_to
if nics:
instance['nics'] = nics
if availability_zone:
instance['availability_zone'] = availability_zone
return instance return instance
def action(self, context, req, action, param): def action(self, context, req, action, param):