Add support for persistence of MariaDB data during reprovisioning

We should support arbitrary tags in upgrade tasks, update the
validation accordingly.

Change-Id: I3ebeb06b18306a8d1de11b3519e62b90a9cd6a78
Implements: blueprint upgrades-with-os
This commit is contained in:
Jiri Stransky 2019-01-16 11:48:06 +01:00
parent c2e2b62974
commit a64fa251e5
3 changed files with 44 additions and 15 deletions
common
docker/services/pacemaker/database
tools

@ -830,6 +830,7 @@ outputs:
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
loop_control:
loop_var: step
tags: always
post_upgrade_steps_tasks: |
{%- for role in roles %}
- import_tasks: {{role.name}}/post_upgrade_tasks.yaml

@ -35,6 +35,9 @@ parameters:
MysqlClustercheckPassword:
type: string
hidden: true
MysqlUpgradePersist:
type: boolean
default: false
RoleName:
default: ''
description: Role name on which the service is applied
@ -348,6 +351,38 @@ outputs:
# Got to check that pacemaker_is_active is working fine with bundle.
# TODO: pacemaker_is_active resource doesn't support bundle.
upgrade_tasks:
- vars:
mysql_upgrade_persist: {get_param: MysqlUpgradePersist}
when:
- step|int == 1
- mysql_upgrade_persist
tags:
- never
- system_upgrade_prepare
block:
- name: Ban galera from local node
command: /usr/sbin/pcs resource ban galera-bundle {{ansible_hostname}} --wait
- name: Persist mysql data
include_role:
name: tripleo-persist
tasks_from: persist.yml
vars:
tripleo_persist_dir: /var/lib/mysql
- vars:
mysql_upgrade_persist: {get_param: MysqlUpgradePersist}
when:
- step|int == 1
- mysql_upgrade_persist
tags:
- never
- system_upgrade_run
block:
- name: Restore mysql data
include_role:
name: tripleo-persist
tasks_from: restore.yml
vars:
tripleo_persist_dir: /var/lib/mysql
- when: step|int == 0
tags: common
block:

@ -264,7 +264,6 @@ CONFIG_RESOURCE_TYPES = [
'OS::Heat::StructuredConfig'
]
VALID_ANSIBLE_UPGRADE_TAGS = [ 'common', 'validation', 'pre-upgrade' ]
WORKFLOW_TASKS_EXCLUSIONS = [
'./docker/services/octavia/octavia-deployment-config.yaml',
'./docker/services/ceph-ansible/ceph-external.yaml',
@ -1194,21 +1193,15 @@ def validate_upgrade_tasks(upgrade_tasks):
for task in upgrade_tasks:
task_name = task.get("name", "")
if task.get("tags"):
if (task["tags"] not in VALID_ANSIBLE_UPGRADE_TAGS):
print('ERROR: Task (%s) includes unexpected \'tags: (%s)\' ' % (task_name, task["tags"]))
return 1
whenline = task.get("when", "")
if (type(whenline) == list):
if any('step|int ' in condition for condition in whenline) and ('step|int == ' not in whenline[0]):
print('ERROR: \'step|int ==\' condition should be evaluated first in when conditions for task (%s)' % (task))
return 1
else:
whenline = task.get("when", "")
if (type(whenline) == list):
if any('step|int ' in condition for condition in whenline) and ('step|int == ' not in whenline[0]):
print('ERROR: \'step|int ==\' condition should be evaluated first in when conditions for task (%s)' % (task))
return 1
else:
if (' and ' in whenline) and (' or ' not in whenline) \
and args.quiet < 2:
print("Warning: Consider specifying \'and\' conditions as a list to improve readability in task: \"%s\"" % (task_name))
if (' and ' in whenline) and (' or ' not in whenline) \
and args.quiet < 2:
print("Warning: Consider specifying \'and\' conditions as a list to improve readability in task: \"%s\"" % (task_name))
return 0
def validate_network_data_file(data_file_path):