Add support for modules in cluster create/grow

When the module support was added, passing the modules to the
actual create was not done on the server side. This has been added.

Partial Bug: #1578917

Change-Id: I80c8e230f8bff550851f5cad146aa5976f45e5c4
This commit is contained in:
Peter Stachowski 2016-05-06 01:37:42 -04:00
parent 7c46c3734d
commit b928ec680a
13 changed files with 35 additions and 16 deletions

View File

@ -0,0 +1,6 @@
---
features:
- Support was added for applying modules to
cluster instances through cluster-create
and cluster-grow. Bug 1578917

View File

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

View File

@ -158,6 +158,7 @@ class ClusterController(wsgi.Controller):
for node in nodes:
flavor_id = utils.get_id_from_href(node['flavorRef'])
volume_size = volume_type = nics = availability_zone = None
modules = None
if 'volume' in node:
volume_size = int(node['volume']['size'])
volume_type = node['volume'].get('volume_type')
@ -165,12 +166,15 @@ class ClusterController(wsgi.Controller):
nics = node['nics']
if 'availability_zone' in node:
availability_zone = node['availability_zone']
if 'modules' in node:
modules = node['modules']
instances.append({"flavor_id": flavor_id,
"volume_size": volume_size,
"volume_type": volume_type,
"nics": nics,
"availability_zone": availability_zone})
"availability_zone": availability_zone,
"modules": modules})
locality = body['cluster'].get('locality')
if locality:

View File

@ -288,6 +288,7 @@ cluster = {
"volume": volume,
"nics": nics,
"availability_zone": non_empty_string,
"modules": module_list,
"related_to": non_empty_string,
"type": non_empty_string
}

View File

@ -155,7 +155,8 @@ class CassandraCluster(models.Cluster):
availability_zone=instance_az,
configuration_id=None,
cluster_config=member_config,
locality=locality)
locality=locality,
modules=instance.get('modules'))
new_instances.append(new_instance)

View File

@ -139,7 +139,8 @@ class GaleraCommonCluster(cluster_models.Cluster):
nics=instance.get('nics', None),
configuration_id=None,
cluster_config=member_config,
locality=locality
locality=locality,
modules=instance.get('modules')
)
for instance in instances]

View File

@ -146,7 +146,8 @@ class MongoDbCluster(models.Cluster):
nics=nics[i],
configuration_id=None,
cluster_config=member_config,
locality=locality)
locality=locality,
modules=instances[i].get('modules'))
for i in range(1, num_configsvr + 1):
instance_name = "%s-%s-%s" % (name, "configsvr", str(i))

View File

@ -105,7 +105,8 @@ class RedisCluster(models.Cluster):
cluster_config={
"id": db_info.id,
"instance_type": "member"},
locality=locality
locality=locality,
modules=instance.get('modules')
)
for instance in instances]

View File

@ -133,17 +133,13 @@ class VerticaCluster(models.Cluster):
instance_name = "%s-member-%s" % (db_info.name,
str(i + num_existing + 1))
minstances.append(
inst_models.Instance.create(context, instance_name,
flavor_id,
datastore_version.image_id,
[], [], datastore,
datastore_version,
volume_size, None,
nics=nics[i],
availability_zone=azs[i],
configuration_id=None,
cluster_config=member_config,
locality=locality)
inst_models.Instance.create(
context, instance_name, flavor_id,
datastore_version.image_id, [], [], datastore,
datastore_version, volume_size, None,
nics=nics[i], availability_zone=azs[i],
configuration_id=None, cluster_config=member_config,
locality=locality, modules=instances[i].get('modules'))
)
return minstances

View File

@ -176,6 +176,7 @@ class TestClusterController(TestCase):
'volume_type': None,
'flavor_id': '1234',
'availability_zone': 'az',
'modules': None,
'nics': [
{'net-id': 'e89aa5fd-6b0a-436d-a75c-1545d34d5331'}
]

View File

@ -141,6 +141,7 @@ class TestClusterController(trove_testtools.TestCase):
'volume_type': None,
'flavor_id': '1234',
'availability_zone': 'az',
'modules': None,
'nics': [
{'net-id': 'e89aa5fd-6b0a-436d-a75c-1545d34d5331'}
]

View File

@ -156,6 +156,7 @@ class TestClusterController(trove_testtools.TestCase):
'volume_type': None,
"flavor_id": "1234",
"availability_zone": "az",
'modules': None,
"nics": [
{"net-id": "e89aa5fd-6b0a-436d-a75c-1545d34d5331"}
]
@ -165,6 +166,7 @@ class TestClusterController(trove_testtools.TestCase):
'volume_type': None,
"flavor_id": "1234",
"availability_zone": "az",
'modules': None,
"nics": [
{"net-id": "e89aa5fd-6b0a-436d-a75c-1545d34d5331"}
]
@ -174,6 +176,7 @@ class TestClusterController(trove_testtools.TestCase):
'volume_type': None,
"flavor_id": "1234",
"availability_zone": "az",
'modules': None,
"nics": [
{"net-id": "e89aa5fd-6b0a-436d-a75c-1545d34d5331"}
]

View File

@ -141,6 +141,7 @@ class TestClusterController(trove_testtools.TestCase):
'volume_type': None,
'flavor_id': '1234',
'availability_zone': 'az',
'modules': None,
'nics': [
{'net-id': 'e89aa5fd-6b0a-436d-a75c-1545d34d5331'}
]