diff options
author | Peter Stachowski <peter@tesora.com> | 2016-05-06 01:37:42 -0400 |
---|---|---|
committer | Peter Stachowski <peter@tesora.com> | 2016-09-08 18:55:20 +0000 |
commit | b928ec680a26fc97cac67fdec9deeb5be3e0bc4c (patch) | |
tree | 8f366f1c84c24cbb8a611b769f92262a74d83ecb | |
parent | 7c46c3734d4a8fe8261ea7a25600045904cdea4d (diff) | |
download | trove-b928ec680a26fc97cac67fdec9deeb5be3e0bc4c.tar.gz |
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
13 files changed, 35 insertions, 16 deletions
diff --git a/releasenotes/notes/module-support-for-clusters-87b41dd7648275bf.yaml b/releasenotes/notes/module-support-for-clusters-87b41dd7648275bf.yaml new file mode 100644 index 00000000..632a4a1f --- /dev/null +++ b/releasenotes/notes/module-support-for-clusters-87b41dd7648275bf.yaml @@ -0,0 +1,6 @@ +--- +features: + - Support was added for applying modules to + cluster instances through cluster-create + and cluster-grow. Bug 1578917 + diff --git a/trove/cluster/models.py b/trove/cluster/models.py index 88fbf8d5..1d2b52dc 100644 --- a/trove/cluster/models.py +++ b/trove/cluster/models.py @@ -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': diff --git a/trove/cluster/service.py b/trove/cluster/service.py index 0cb7afc0..8c167d61 100644 --- a/trove/cluster/service.py +++ b/trove/cluster/service.py @@ -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: diff --git a/trove/common/apischema.py b/trove/common/apischema.py index 5752c0ae..2afd8063 100644 --- a/trove/common/apischema.py +++ b/trove/common/apischema.py @@ -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 } diff --git a/trove/common/strategies/cluster/experimental/cassandra/api.py b/trove/common/strategies/cluster/experimental/cassandra/api.py index b9b91090..25b8fabc 100644 --- a/trove/common/strategies/cluster/experimental/cassandra/api.py +++ b/trove/common/strategies/cluster/experimental/cassandra/api.py @@ -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) diff --git a/trove/common/strategies/cluster/experimental/galera_common/api.py b/trove/common/strategies/cluster/experimental/galera_common/api.py index 50f82817..00762777 100644 --- a/trove/common/strategies/cluster/experimental/galera_common/api.py +++ b/trove/common/strategies/cluster/experimental/galera_common/api.py @@ -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] diff --git a/trove/common/strategies/cluster/experimental/mongodb/api.py b/trove/common/strategies/cluster/experimental/mongodb/api.py index 9bf6d671..c9969bc6 100644 --- a/trove/common/strategies/cluster/experimental/mongodb/api.py +++ b/trove/common/strategies/cluster/experimental/mongodb/api.py @@ -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)) diff --git a/trove/common/strategies/cluster/experimental/redis/api.py b/trove/common/strategies/cluster/experimental/redis/api.py index d9c72935..47865c26 100644 --- a/trove/common/strategies/cluster/experimental/redis/api.py +++ b/trove/common/strategies/cluster/experimental/redis/api.py @@ -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] diff --git a/trove/common/strategies/cluster/experimental/vertica/api.py b/trove/common/strategies/cluster/experimental/vertica/api.py index c3762a31..67fe1fe1 100644 --- a/trove/common/strategies/cluster/experimental/vertica/api.py +++ b/trove/common/strategies/cluster/experimental/vertica/api.py @@ -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 diff --git a/trove/tests/unittests/cluster/test_cluster_controller.py b/trove/tests/unittests/cluster/test_cluster_controller.py index f76eba39..192d5f97 100644 --- a/trove/tests/unittests/cluster/test_cluster_controller.py +++ b/trove/tests/unittests/cluster/test_cluster_controller.py @@ -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'} ] diff --git a/trove/tests/unittests/cluster/test_cluster_pxc_controller.py b/trove/tests/unittests/cluster/test_cluster_pxc_controller.py index b9599375..e19eff46 100644 --- a/trove/tests/unittests/cluster/test_cluster_pxc_controller.py +++ b/trove/tests/unittests/cluster/test_cluster_pxc_controller.py @@ -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'} ] diff --git a/trove/tests/unittests/cluster/test_cluster_redis_controller.py b/trove/tests/unittests/cluster/test_cluster_redis_controller.py index 1732be03..283159e8 100644 --- a/trove/tests/unittests/cluster/test_cluster_redis_controller.py +++ b/trove/tests/unittests/cluster/test_cluster_redis_controller.py @@ -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"} ] diff --git a/trove/tests/unittests/cluster/test_cluster_vertica_controller.py b/trove/tests/unittests/cluster/test_cluster_vertica_controller.py index bbfc729f..c9251a85 100644 --- a/trove/tests/unittests/cluster/test_cluster_vertica_controller.py +++ b/trove/tests/unittests/cluster/test_cluster_vertica_controller.py @@ -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'} ] |