From 221dec49584d17806500f4690dd2c8bee101b617 Mon Sep 17 00:00:00 2001 From: gong yong sheng Date: Thu, 19 Jan 2017 00:10:13 +0800 Subject: [PATCH] Allow boot vdu from volume In this case, there will be no image property for server resource. Change-Id: I3e3d62f4ad60fdb4ceddd46b70386d4623367c51 Partial-bug: #1649459 --- translator/hot/tosca/tests/test_tosca_compute.py | 8 -------- translator/hot/tosca/tosca_compute.py | 5 ++++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/translator/hot/tosca/tests/test_tosca_compute.py b/translator/hot/tosca/tests/test_tosca_compute.py index c876ec27..09761ecf 100644 --- a/translator/hot/tosca/tests/test_tosca_compute.py +++ b/translator/hot/tosca/tests/test_tosca_compute.py @@ -70,7 +70,6 @@ class ToscaComputeTest(TestCase): #left intentionally ''' expectedprops = {'flavor': 'm1.large', - 'image': None, 'user_data_format': 'SOFTWARE_CONFIG'} self._tosca_compute_test( tpl_snippet, @@ -107,7 +106,6 @@ class ToscaComputeTest(TestCase): #left intentionally ''' expectedprops = {'flavor': None, - 'image': None, 'user_data_format': 'SOFTWARE_CONFIG'} self._tosca_compute_test( tpl_snippet, @@ -120,7 +118,6 @@ class ToscaComputeTest(TestCase): type: tosca.nodes.Compute ''' expectedprops = {'flavor': None, - 'image': None, 'user_data_format': 'SOFTWARE_CONFIG'} self._tosca_compute_test( tpl_snippet, @@ -137,7 +134,6 @@ class ToscaComputeTest(TestCase): #left intentionally ''' expectedprops = {'flavor': None, - 'image': None, 'user_data_format': 'SOFTWARE_CONFIG'} self._tosca_compute_test( tpl_snippet, @@ -155,7 +151,6 @@ class ToscaComputeTest(TestCase): mem_size: 4 GB ''' expectedprops = {'flavor': 'm1.large', - 'image': None, 'user_data_format': 'SOFTWARE_CONFIG'} self._tosca_compute_test( tpl_snippet, @@ -173,7 +168,6 @@ class ToscaComputeTest(TestCase): disk_size: 10 GB ''' expectedprops = {'flavor': 'm1.large', - 'image': None, 'user_data_format': 'SOFTWARE_CONFIG'} self._tosca_compute_test( tpl_snippet, @@ -190,7 +184,6 @@ class ToscaComputeTest(TestCase): num_cpus: 4 ''' expectedprops = {'flavor': 'm1.large', - 'image': None, 'user_data_format': 'SOFTWARE_CONFIG'} self._tosca_compute_test( tpl_snippet, @@ -216,7 +209,6 @@ class ToscaComputeTest(TestCase): 'num_cpus': 1} } expectedprops = {'flavor': 'm1.mock_flavor', - 'image': None, 'user_data_format': 'SOFTWARE_CONFIG'} self._tosca_compute_test(tpl_snippet, expectedprops) diff --git a/translator/hot/tosca/tosca_compute.py b/translator/hot/tosca/tosca_compute.py index 51f08339..2cbc14b5 100755 --- a/translator/hot/tosca/tosca_compute.py +++ b/translator/hot/tosca/tosca_compute.py @@ -87,7 +87,10 @@ class ToscaCompute(HotResource): if os_cap_props: image = self._best_image(os_cap_props) hot_properties['flavor'] = flavor - hot_properties['image'] = image + if image: + hot_properties['image'] = image + else: + hot_properties.pop('image', None) return hot_properties def _best_flavor(self, properties):