[Q->T] Add FFU steps for manila

These steps were added for other overcloud
services in [1] and [2].

[1] https://review.opendev.org/713482/
[2] https://review.opendev.org/720490/

Depends-On: I6a98140b7df8d3460ff8ec54f8b7a0d5abbef515
Depends-On: I1229d3a0cd2f08dabdcd3b47d9823f6a939cfbdb
Resolves: rhbz#1849098
Closes-bug: #1884818
Change-Id: I0162e7dec09242a8d3981d1796f4cc6d911c7c4a
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
This commit is contained in:
Goutham Pacha Ravi 2020-06-23 11:46:30 -07:00 committed by Giulio Fidente
parent 1bac4f00fc
commit ea7c886e22
3 changed files with 91 additions and 14 deletions

View File

@ -0,0 +1,34 @@
#!/bin/bash
# Copyright 2020 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# manila-manage db sync is idempotent, as long as the code contains the version
# that the database is at. However, this helper script is to ensure that the
# command is always idempotent, and when the database is at a higher version
# than the version in the code, we'll just bail out rather than hard exiting.
set -e
DB_VERSION=$( sudo -u manila manila-manage db version )
REPO_VERSIONS=$( grep -h -r -Po "(?<=^revision \=).*" /usr/lib/python3.6/site-packages/manila/db/migrations/alembic/versions/ | tr -d \'\" | uniq )
REPO_MAX=$( for v in $REPO_VERSIONS; do grep -r -q -e "^down_revision.*$v" /usr/lib/python3.6/site-packages/manila/db/migrations/alembic/versions/ || echo $v; done )
if [[ $DB_VERSION == $REPO_MAX ]]; then
echo "Manila DB is already up to date: $DB_VERSION"
elif [[ $REPO_VERSIONS == *"$DB_VERSION"* ]]; then
# Package provides a newer version, we must upgrade
sudo -u manila manila-manage db sync
echo "Manila DB is upgraded to: $REPO_MAX"
else
echo "Manila DB version: $DB_VERSION is higher than the maximum provided by the package $REPO_MAX. Nothing to do"
fi

View File

@ -4,6 +4,10 @@ description: >
OpenStack containerized Manila API service
parameters:
ContainerManilaApiImageStein:
description: image
type: string
default: ''
ContainerManilaApiImage:
description: image
type: string
@ -36,6 +40,12 @@ parameters:
default: {}
description: Parameters specific to the role
type: json
DeployIdentifier:
default: ''
type: string
description: >
Setting this to a unique value will re-run any deployment tasks which
perform configuration on a Heat stack-update.
EnableInternalTLS:
type: boolean
default: false
@ -57,6 +67,7 @@ parameters:
conditions:
fast_forward_upgrade: {not: {equals: [{get_param: ContainerManilaApiImageStein},'']}}
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
manila_workers_zero: {equals : [{get_param: ManilaWorkers}, 0]}
@ -197,6 +208,12 @@ outputs:
- path: /var/log/manila
owner: manila:manila
recurse: true
container_config_scripts:
map_merge:
- {get_attr: [ContainersCommon, container_config_scripts]}
- manila_ffu_db_sync.sh:
mode: "0755"
content: { get_file: ../../container_config_scripts/manila_ffu_db_sync.sh }
docker_config:
step_2:
manila_init_logs:
@ -208,20 +225,45 @@ outputs:
- /var/log/containers/httpd/manila-api:/var/log/httpd:z
command: ['/bin/bash', '-c', 'chown -R manila:manila /var/log/manila']
step_3:
manila_api_db_sync:
user: root
image: *manila_api_image
net: host
detach: false
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/config-data/manila/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
- /var/lib/config-data/manila/etc/manila/:/etc/manila/:ro
- /var/log/containers/manila:/var/log/manila:z
- /var/log/containers/httpd/manila-api:/var/log/httpd:z
command: "/usr/bin/bootstrap_host_exec manila_api su manila -s /bin/bash -c '/usr/bin/manila-manage db sync'"
map_merge:
- manila_api_db_sync:
start_order: 1
user: root
image: *manila_api_image
net: host
detach: false
volumes: &manila_volumes
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/config-data/manila/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
- /var/lib/config-data/manila/etc/manila/:/etc/manila/:ro
- /var/log/containers/manila:/var/log/manila:z
- /var/log/containers/httpd/manila-api:/var/log/httpd:z
command: "/usr/bin/bootstrap_host_exec manila_api su manila -s /bin/bash -c '/usr/bin/manila-manage db sync'"
environment:
TRIPLEO_DEPLOY_IDENTIFIER: {get_param: DeployIdentifier}
- if:
- fast_forward_upgrade
- manila_api_db_sync_stein:
start_order: 0
image: &manila_api_image_stein {get_param: ContainerManilaApiImageStein}
net: host
privileged: false
detach: false
user: root
volumes:
list_concat:
- *manila_volumes
-
- /var/lib/container-config-scripts/:/container-config-scripts/:ro
command:
- '/usr/bin/bootstrap_host_exec'
- 'manila_api'
- '/container-config-scripts/manila_ffu_db_sync.sh'
environment:
TRIPLEO_DEPLOY_IDENTIFIER: {get_param: DeployIdentifier}
- {}
step_4:
manila_api:
image: *manila_api_image

View File

@ -14,6 +14,7 @@ parameter_defaults:
ContainerIronicApiImageStein: ''
ContainerIronicInspectorImageStein: ''
ContainerKeystoneImageStein: ''
ContainerManilaApiImageStein: ''
ContainerMistralApiImageStein: ''
ContainerNeutronApiImageStein: ''
ContainerNovaApiImageStein: ''