Generate CephClusterFSID for new stacks

This parameter is needed for new deployments using Ceph, but it
should not change across updates/upgrades.

Change-Id: I2ac62d47922f7dc1d37b2da313fd35f08debfab4
Closes-Bug: #1636555
Related-Bug: #1643701
This commit is contained in:
Giulio Fidente 2016-11-21 22:49:12 +01:00
parent ad64050485
commit 20167e850a
2 changed files with 12 additions and 2 deletions

View File

@ -14,7 +14,9 @@
# under the License.
import json
import logging
import six
import time
import uuid
from heatclient.common import deployment_utils
from heatclient import exc as heat_exc
@ -150,6 +152,8 @@ class DeployStackAction(templates.ProcessTemplatesAction):
parameters['DeployIdentifier'] = int(time.time())
parameters['UpdateIdentifier'] = ''
parameters['StackAction'] = 'CREATE' if stack_is_new else 'UPDATE'
if stack_is_new:
parameters['CephClusterFSID'] = six.text_type(uuid.uuid1())
if 'parameter_defaults' not in wf_env.variables:
wf_env.variables['parameter_defaults'] = {}

View File

@ -194,6 +194,7 @@ class DeployStackActionTest(base.TestCase):
def setUp(self,):
super(DeployStackActionTest, self).setUp()
@mock.patch('uuid.uuid1')
@mock.patch('tripleo_common.actions.deployment.time')
@mock.patch('heatclient.common.template_utils.'
'process_multiple_environments_and_files')
@ -208,7 +209,8 @@ class DeployStackActionTest(base.TestCase):
mock_get_object_client, mock_get_workflow_client,
mock_get_template_contents,
mock_process_multiple_environments_and_files,
mock_time):
mock_time,
mock_uuid1):
mock_ctx.return_value = mock.MagicMock()
# setup swift
@ -240,11 +242,15 @@ class DeployStackActionTest(base.TestCase):
# freeze time at datetime.datetime(2016, 9, 8, 16, 24, 24)
mock_time.time.return_value = 1473366264
# fake an uuid1 for CephClusterFSID
mock_uuid1.return_value = 'some-uuid1'
action = deployment.DeployStackAction(1, 'overcloud')
action.run()
# verify parameters are as expected
expected_defaults = {'DeployIdentifier': 1473366264,
expected_defaults = {'CephClusterFSID': 'some-uuid1',
'DeployIdentifier': 1473366264,
'StackAction': 'CREATE',
'UpdateIdentifier': '',
'random_existing_data': 'a_value'}