Remove Pike-only migration step

In Pike, plans were migrated from using Mistral environments for
storing parameters values to using a plan-environment.yaml file stored
together with the plan in Swift. New plans created from THT have this
file included automatically from Pike, and the migration step is no
longer necessary starting in Queens.

As of now, fast-forward upgrades will involve upgrading the undercloud
from N to N+1 until N+3 is reached so removing the step isn't an issue.

Change-Id: I4227df5c692ab09b88f84ad60bf241c0b8251f80
This commit is contained in:
Julie Pichon
2017-10-17 11:33:12 +01:00
parent 0df50b7eae
commit f488b516ec
2 changed files with 4 additions and 40 deletions

View File

@@ -1099,10 +1099,9 @@ class TestPostConfig(base.BaseTestCase):
@mock.patch('os.listdir')
@mock.patch('instack_undercloud.undercloud._create_mistral_config_'
'environment')
@mock.patch('instack_undercloud.undercloud._migrate_plans')
@mock.patch('instack_undercloud.undercloud._create_default_plan')
def test_post_config_mistral(self, mock_create, mock_migrate, mock_cmce,
mock_listdir, mock_isfile):
def test_post_config_mistral(self, mock_create, mock_cmce, mock_listdir,
mock_isfile):
instack_env = {}
mock_mistral = mock.Mock()
mock_swift = mock.Mock()
@@ -1140,19 +1139,15 @@ class TestPostConfig(base.BaseTestCase):
'/bar.yaml')],
mock_mistral.workbooks.create.mock_calls)
mock_cmce.assert_called_once_with(instack_env, mock_mistral)
mock_migrate.assert_called_once_with(mock_mistral, mock_swift,
['hut8'])
mock_create.assert_called_once_with(mock_mistral, ['hut8'])
@mock.patch('os.path.isfile', return_value=True)
@mock.patch('os.listdir')
@mock.patch('instack_undercloud.undercloud._create_mistral_config_'
'environment')
@mock.patch('instack_undercloud.undercloud._migrate_plans')
@mock.patch('instack_undercloud.undercloud._create_default_plan')
def test_post_config_mistral_with_tags(self, mock_create, mock_migrate,
mock_cmce, mock_listdir,
mock_isfile):
def test_post_config_mistral_with_tags(self, mock_create, mock_cmce,
mock_listdir, mock_isfile):
instack_env = {}
mock_mistral = mock.Mock()
mock_swift = mock.Mock()
@@ -1189,8 +1184,6 @@ class TestPostConfig(base.BaseTestCase):
'/bar.yaml')],
mock_mistral.workbooks.create.mock_calls)
mock_cmce.assert_called_once_with(instack_env, mock_mistral)
mock_migrate.assert_called_once_with(mock_mistral, mock_swift,
['hut8'])
mock_create.assert_called_once_with(mock_mistral, ['hut8'])

View File

@@ -29,14 +29,12 @@ import sys
import tempfile
import time
import uuid
import yaml
from ironicclient import client as ir_client
from keystoneauth1 import session
from keystoneauth1 import exceptions as ks_exceptions
from keystoneclient import discover
import keystoneauth1.identity.generic as ks_auth
from mistralclient.api import base as mistralclient_base
from mistralclient.api import client as mistralclient
from novaclient import client as novaclient
from novaclient import exceptions
@@ -1484,32 +1482,6 @@ def _create_mistral_config_environment(instack_env, mistral):
}))
def _migrate_plans(mistral, swift, plans):
"""Migrate plan environments from Mistral to Swift."""
plan_env_filename = 'plan-environment.yaml'
for plan in plans:
headers, objects = swift.get_container(plan)
if headers.get('x-container-meta-usage-tripleo') != 'plan':
continue
try:
swift.get_object(plan, plan_env_filename)
except swiftclient.ClientException:
LOG.info('Migrating environment for plan %s to Swift.' % plan)
try:
env = mistral.environments.get(plan).variables
except (mistralclient_base.APIException,
ks_exceptions.http.NotFound):
LOG.warning('Could not find plan "%s" environment in Mistral '
'- nothing to migrate.' % plan)
else:
yaml_string = yaml.safe_dump(env, default_flow_style=False)
swift.put_object(plan, plan_env_filename, yaml_string)
mistral.environments.delete(plan)
def _wait_for_mistral_execution(timeout_at, mistral, execution, message='',
fail_on_error=False):
while time.time() < timeout_at:
@@ -1653,7 +1625,6 @@ def _post_config_mistral(instack_env, mistral, swift):
plans = [container["name"] for container in swift.get_account()[1]]
_create_mistral_config_environment(instack_env, mistral)
_migrate_plans(mistral, swift, plans)
_create_default_plan(mistral, plans)
_create_logging_cron(mistral)