Merge "As of nova microversion 2.57, personality is deprecated"
This commit is contained in:
commit
90d5ecc7ad
@ -38,7 +38,8 @@ cfg.CONF.import_opt('default_user_data_format', 'heat.common.config')
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
NOVA_MICROVERSIONS = (MICROVERSION_TAGS, MICROVERSION_STR_NETWORK,
|
||||
MICROVERSION_NIC_TAGS) = ('2.26', '2.37', '2.42')
|
||||
MICROVERSION_NIC_TAGS, MICROVERSION_PERSONALITY_REMOVED
|
||||
) = ('2.26', '2.37', '2.42', '2.57')
|
||||
|
||||
|
||||
class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
|
||||
@ -1592,6 +1593,14 @@ class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
|
||||
# retrieve provider's absolute limits if it will be needed
|
||||
metadata = self.properties[self.METADATA]
|
||||
personality = self.properties[self.PERSONALITY]
|
||||
|
||||
if personality:
|
||||
if self.client_plugin().is_version_supported(
|
||||
MICROVERSION_PERSONALITY_REMOVED):
|
||||
msg = (_('Cannot use the personality parameter as nova no '
|
||||
'longer supports it. Use user_data instead.'))
|
||||
raise exception.StackValidationFailed(message=msg)
|
||||
|
||||
if metadata or personality:
|
||||
limits = self.client_plugin().absolute_limits()
|
||||
|
||||
|
@ -3160,6 +3160,8 @@ class ServersTest(common.HeatTestCase):
|
||||
(tmpl, stack) = self._setup_test_stack(stack_name)
|
||||
self.patchobject(nova.NovaClientPlugin, 'client',
|
||||
return_value=self.fc)
|
||||
self.patchobject(nova.NovaClientPlugin, 'is_version_supported',
|
||||
return_value=False)
|
||||
tmpl.t['Resources']['WebServer']['Properties'][
|
||||
'personality'] = {"/fake/path1": "fake contents1",
|
||||
"/fake/path2": "fake_contents2",
|
||||
@ -3179,11 +3181,39 @@ class ServersTest(common.HeatTestCase):
|
||||
self.assertEqual("The personality property may not contain "
|
||||
"greater than 5 entries.", str(exc))
|
||||
|
||||
def test_server_validate_personality_unsupported(self):
|
||||
stack_name = 'srv_val'
|
||||
(tmpl, stack) = self._setup_test_stack(stack_name)
|
||||
self.patchobject(nova.NovaClientPlugin, 'client',
|
||||
return_value=self.fc)
|
||||
self.patchobject(nova.NovaClientPlugin, 'is_version_supported',
|
||||
return_value=True)
|
||||
tmpl.t['Resources']['WebServer']['Properties'][
|
||||
'personality'] = {"/fake/path1": "fake contents1",
|
||||
"/fake/path2": "fake_contents2",
|
||||
"/fake/path3": "fake_contents3",
|
||||
"/fake/path4": "fake_contents4",
|
||||
"/fake/path5": "fake_contents5"}
|
||||
resource_defns = tmpl.resource_definitions(stack)
|
||||
server = servers.Server('server_create_image_err',
|
||||
resource_defns['WebServer'], stack)
|
||||
|
||||
self.patchobject(self.fc.limits, 'get', return_value=self.limits)
|
||||
self.patchobject(glance.GlanceClientPlugin, 'get_image',
|
||||
return_value=self.mock_image)
|
||||
exc = self.assertRaises(exception.StackValidationFailed,
|
||||
server.validate)
|
||||
self.assertEqual("Cannot use the personality parameter as nova "
|
||||
"no longer supports it. Use user_data instead.",
|
||||
str(exc))
|
||||
|
||||
def test_server_validate_personality_okay(self):
|
||||
stack_name = 'srv_val'
|
||||
(tmpl, stack) = self._setup_test_stack(stack_name)
|
||||
self.patchobject(nova.NovaClientPlugin, 'client',
|
||||
return_value=self.fc)
|
||||
self.patchobject(nova.NovaClientPlugin, 'is_version_supported',
|
||||
return_value=False)
|
||||
tmpl.t['Resources']['WebServer']['Properties'][
|
||||
'personality'] = {"/fake/path1": "fake contents1",
|
||||
"/fake/path2": "fake_contents2",
|
||||
@ -3204,6 +3234,8 @@ class ServersTest(common.HeatTestCase):
|
||||
(tmpl, stack) = self._setup_test_stack(stack_name)
|
||||
self.patchobject(nova.NovaClientPlugin, 'client',
|
||||
return_value=self.fc)
|
||||
self.patchobject(nova.NovaClientPlugin, 'is_version_supported',
|
||||
return_value=False)
|
||||
tmpl.t['Resources']['WebServer']['Properties'][
|
||||
'personality'] = {"/fake/path1": "a" * 10240}
|
||||
resource_defns = tmpl.resource_definitions(stack)
|
||||
@ -3220,6 +3252,8 @@ class ServersTest(common.HeatTestCase):
|
||||
self.patchobject(nova.NovaClientPlugin, 'client',
|
||||
return_value=self.fc)
|
||||
|
||||
self.patchobject(nova.NovaClientPlugin, 'is_version_supported',
|
||||
return_value=False)
|
||||
tmpl.t['Resources']['WebServer']['Properties'][
|
||||
'personality'] = {"/fake/path1": "a" * 10241}
|
||||
resource_defns = tmpl.resource_definitions(stack)
|
||||
@ -3241,6 +3275,8 @@ class ServersTest(common.HeatTestCase):
|
||||
stack_name, server_with_sw_config_personality)
|
||||
self.patchobject(nova.NovaClientPlugin, 'client',
|
||||
return_value=self.fc)
|
||||
self.patchobject(nova.NovaClientPlugin, 'is_version_supported',
|
||||
return_value=False)
|
||||
resource_defns = tmpl.resource_definitions(stack)
|
||||
server = servers.Server('server_create_image_err',
|
||||
resource_defns['server'], stack)
|
||||
@ -4267,6 +4303,8 @@ class ServersTest(common.HeatTestCase):
|
||||
'personality'] = {"/fake/path1": "a" * 10}
|
||||
self.patchobject(nova.NovaClientPlugin, 'client',
|
||||
return_value=self.fc)
|
||||
self.patchobject(nova.NovaClientPlugin, 'is_version_supported',
|
||||
return_value=False)
|
||||
resource_defns = tmpl.resource_definitions(stack)
|
||||
server = servers.Server('server_create_image_err',
|
||||
resource_defns['WebServer'], stack)
|
||||
@ -4284,6 +4322,8 @@ class ServersTest(common.HeatTestCase):
|
||||
'personality'] = {"/fake/path1": "a" * 10}
|
||||
self.patchobject(nova.NovaClientPlugin, 'client',
|
||||
return_value=self.fc)
|
||||
self.patchobject(nova.NovaClientPlugin, 'is_version_supported',
|
||||
return_value=False)
|
||||
resource_defns = tmpl.resource_definitions(stack)
|
||||
server = servers.Server('server_create_image_err',
|
||||
resource_defns['WebServer'], stack)
|
||||
|
Loading…
Reference in New Issue
Block a user