From fcfdc2891acd1a14b7f73cc738a47b0a9d4d32e1 Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Thu, 9 Oct 2014 13:49:14 +0300 Subject: [PATCH] Support volume type in Sahara Node Group Template Latest python-saharaclient (already in Heat dependencies) has ability to specify cinder volume type when creating node group templates. This patch adds support for this feature to OS::Sahara::NodeGroupTemplate resource in Heat. Change-Id: Ib12bc9b8da31fdb342b76fcb523212776ac2e802 Closes-Bug: #1369574 --- heat/engine/resources/sahara_templates.py | 14 ++++++++++---- heat/tests/test_sahara_templates.py | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/heat/engine/resources/sahara_templates.py b/heat/engine/resources/sahara_templates.py index c36d299ad..8db219d5d 100644 --- a/heat/engine/resources/sahara_templates.py +++ b/heat/engine/resources/sahara_templates.py @@ -35,12 +35,12 @@ class SaharaNodeGroupTemplate(resource.Resource): support_status = support.SupportStatus(version='2014.2') PROPERTIES = ( - NAME, PLUGIN_NAME, HADOOP_VERSION, FLAVOR, - DESCRIPTION, VOLUMES_PER_NODE, VOLUMES_SIZE, + NAME, PLUGIN_NAME, HADOOP_VERSION, FLAVOR, DESCRIPTION, + VOLUMES_PER_NODE, VOLUMES_SIZE, VOLUME_TYPE, NODE_PROCESSES, FLOATING_IP_POOL, NODE_CONFIGS, ) = ( - 'name', 'plugin_name', 'hadoop_version', 'flavor', - 'description', 'volumes_per_node', 'volumes_size', + 'name', 'plugin_name', 'hadoop_version', 'flavor', 'description', + 'volumes_per_node', 'volumes_size', 'volume_type', 'node_processes', 'floating_ip_pool', 'node_configs', ) @@ -87,6 +87,10 @@ class SaharaNodeGroupTemplate(resource.Resource): constraints.Range(min=1), ], ), + VOLUME_TYPE: properties.Schema( + properties.Schema.STRING, + _("Type of the volume to create on Cinder backend."), + ), NODE_PROCESSES: properties.Schema( properties.Schema.LIST, _("List of processes to run on every node."), @@ -130,6 +134,7 @@ class SaharaNodeGroupTemplate(resource.Resource): self.properties[self.FLAVOR]) volumes_per_node = self.properties.get(self.VOLUMES_PER_NODE) volumes_size = self.properties.get(self.VOLUMES_SIZE) + volume_type = self.properties.get(self.VOLUME_TYPE) floating_ip_pool = self.properties.get(self.FLOATING_IP_POOL) if floating_ip_pool: floating_ip_pool = self.client_plugin( @@ -144,6 +149,7 @@ class SaharaNodeGroupTemplate(resource.Resource): description=description, volumes_per_node=volumes_per_node, volumes_size=volumes_size, + volume_type=volume_type, node_processes=node_processes, floating_ip_pool=floating_ip_pool, node_configs=node_configs) diff --git a/heat/tests/test_sahara_templates.py b/heat/tests/test_sahara_templates.py index 5eeba1b0c..4157c69e8 100644 --- a/heat/tests/test_sahara_templates.py +++ b/heat/tests/test_sahara_templates.py @@ -114,6 +114,7 @@ class SaharaNodeGroupTemplateTest(common.HeatTestCase): expected_kwargs = {'description': "", 'volumes_per_node': None, 'volumes_size': None, + 'volume_type': None, 'node_processes': ['namenode', 'jobtracker'], 'floating_ip_pool': 'some_pool_id', 'node_configs': None,