summaryrefslogtreecommitdiffstats
path: root/tosca2heat/heat-translator/translator/hot
diff options
context:
space:
mode:
authorshangxdy <shang.xiaodong@zte.com.cn>2016-08-28 17:25:28 +0800
committershangxdy <shang.xiaodong@zte.com.cn>2016-08-28 17:25:28 +0800
commitaef34ad9a966ca64aa365ee6aaada702b986f68b (patch)
tree70978e5e43f052afbfcf615ce0cd45ea1f4349c7 /tosca2heat/heat-translator/translator/hot
parent654a44a7d3727f7f6d3fb61f70f7e63f9b6d8524 (diff)
Fix BlockStorageAttachment bug when translate compute node
Currently, when translate compute node with local_storage and high_availability, there is not BlockStorageAttache resource created about block storage, and only BlockStorage created. If only local_storage requirement in compute node, the result is correct. The reason is the function logic of _get_attachment_node is error. and the patch will fixit. JIRA:PARSER-100 Change-Id: I36456089ae65102d4b17797d266c850d8c16b29d Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/heat-translator/translator/hot')
-rw-r--r--tosca2heat/heat-translator/translator/hot/translate_node_templates.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tosca2heat/heat-translator/translator/hot/translate_node_templates.py b/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
index f32d42b..4dd9556 100644
--- a/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
+++ b/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
@@ -533,14 +533,20 @@ class TranslateNodeTemplates(object):
def _get_attachment_node(self, node, suffix, volume_name):
attach = False
ntpl = self.nodetemplates
- for key, value in node.relationships.items():
- if key.is_derived_from('tosca.relationships.AttachesTo'):
- if value.is_derived_from('tosca.nodes.BlockStorage'):
+ 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 attach:
relationship_tpl = None
for req in node.requirements:
for key, val in req.items():
+ if isinstance(val, dict):
+ if value_n.name != val.get('node'):
+ continue
+ else:
+ if value_n.name != val:
+ continue
attach = val
relship = val.get('relationship')
for rkey, rval in val.items():