summaryrefslogtreecommitdiffstats
path: root/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
diff options
context:
space:
mode:
Diffstat (limited to 'tosca2heat/heat-translator/translator/hot/translate_node_templates.py')
-rw-r--r--tosca2heat/heat-translator/translator/hot/translate_node_templates.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/tosca2heat/heat-translator/translator/hot/translate_node_templates.py b/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
index 1a1a4d7..78ab1c4 100644
--- a/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
+++ b/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
@@ -228,11 +228,11 @@ class TranslateNodeTemplates(object):
# BlockStorage Attachment is a special case,
# which doesn't match to Heat Resources 1 to 1.
if base_type == "tosca.nodes.Compute":
- volume_name = None
requirements = node.requirements
if requirements:
# Find the name of associated BlockStorage node
for requires in requirements:
+ volume_name = None
for value in requires.values():
if isinstance(value, dict):
for node_name in value.values():
@@ -250,11 +250,12 @@ class TranslateNodeTemplates(object):
volume_name = node_name
break
- suffix = suffix + 1
- attachment_node = self._get_attachment_node(
- node, suffix, volume_name)
- if attachment_node:
- self.hot_resources.append(attachment_node)
+ if volume_name:
+ suffix = suffix + 1
+ attachment_node = self._get_attachment_node(
+ node, suffix, volume_name)
+ if attachment_node:
+ self.hot_resources.append(attachment_node)
for i in self.tosca.inputs:
if (i.name == 'key_name' and
node.get_property_value('key_name') is None):
@@ -269,8 +270,12 @@ class TranslateNodeTemplates(object):
policy_type.type != 'tosca.policies.Scaling.Cluster':
TOSCA_TO_HOT_TYPE[policy_type.type] = \
TOSCA_TO_HOT_TYPE['tosca.policies.Scaling']
- if not policy.is_derived_from('tosca.policies.Scaling') and \
- policy_type.type not in TOSCA_TO_HOT_TYPE:
+ if policy.is_derived_from('tosca.policies.Monitoring'):
+ TOSCA_TO_HOT_TYPE[policy_type.type] = \
+ TOSCA_TO_HOT_TYPE['tosca.policies.Monitoring']
+ if not policy.is_derived_from('tosca.policies.Monitoring') and \
+ not policy.is_derived_from('tosca.policies.Scaling') and \
+ policy_type.type not in TOSCA_TO_HOT_TYPE:
raise UnsupportedTypeError(type=_('%s') % policy_type.type)
elif policy_type.type == 'tosca.policies.Scaling.Cluster':
self.hot_template_version = '2016-04-08'
@@ -587,7 +592,8 @@ class TranslateNodeTemplates(object):
for key_r, value_n in node.relationships.items():
if key_r.is_derived_from('tosca.relationships.AttachesTo'):
if value_n.is_derived_from('tosca.nodes.BlockStorage'):
- attach = True
+ if volume_name == value_n.name:
+ attach = True
if attach:
relationship_tpl = None
for req in node.requirements: