Revert changes to CephClusterFSID generation

This patch reverts the two commits listed below. There was a problem
with CephClusterFSID generation as it was created by the password
generation code in Mistral in Newton. However, this password generation
didn't work for upgrades as it didn't take into account upgrades and
passwords that were in use in an existing Heat stack.

This issue was resolved in I3ea6bbd0d9c5dd345b8a4a26a1788326e09d4209.
Now when a deployment plan is created, if there is an existing Heat
stack it takes the parameters from the Heat stack and uses those, rather
than regenerating. This change should also resolve the issue where the
CephClusterFSID was regenerated.

Revert "Generate CephClusterFSID for new stacks"
This reverts commit 20167e850a.

Revert "Revert "Add CephClusterFSID to generated passwords""
This reverts commit ad64050485.

Related-Bug: #1636555
Change-Id: I10b5613eda4bd47554a4f5e9f57218010b835fe7
This commit is contained in:
Dougal Matthews 2016-11-23 11:26:11 +00:00
parent 6239c4c2e7
commit e1c07fc453
4 changed files with 12 additions and 14 deletions

View File

@ -14,9 +14,7 @@
# 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
@ -152,8 +150,6 @@ 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

@ -63,6 +63,7 @@ PASSWORD_PARAMETER_NAMES = (
'CeilometerPassword',
'CephAdminKey',
'CephClientKey',
'CephClusterFSID',
'CephMonKey',
'CephRgwKey',
'CinderPassword',

View File

@ -194,7 +194,6 @@ 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')
@ -209,8 +208,7 @@ 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_uuid1):
mock_time):
mock_ctx.return_value = mock.MagicMock()
# setup swift
@ -242,15 +240,11 @@ 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 = {'CephClusterFSID': 'some-uuid1',
'DeployIdentifier': 1473366264,
expected_defaults = {'DeployIdentifier': 1473366264,
'StackAction': 'CREATE',
'UpdateIdentifier': '',
'random_existing_data': 'a_value'}

View File

@ -17,8 +17,11 @@ import logging
import os
import struct
import time
import uuid
import passlib.utils as passutils
import six
from tripleo_common import constants
@ -41,9 +44,13 @@ def generate_overcloud_passwords(mistralclient, stack_env=None):
# a Heat stack that already exists.
if stack_env and name in stack_env.get('parameter_defaults', {}):
passwords[name] = stack_env['parameter_defaults'][name]
# CephX keys aren't random strings
elif name.startswith("Ceph"):
passwords[name] = create_cephx_key()
if name == "CephClusterFSID":
# The FSID must be a UUID
passwords[name] = six.text_type(uuid.uuid1())
else:
# CephX keys aren't random strings
passwords[name] = create_cephx_key()
# The SnmpdReadonlyUserPassword is stored in a mistral env.
elif name == 'SnmpdReadonlyUserPassword':
passwords[name] = get_snmpd_readonly_user_password(mistralclient)