Support cold migration
Add grenade plugin under devstack folder to support cold migration verified by grenade job. Implement blueprint: cold-migration Co-Authored-By: wangxiyuan<wangxiyuan@huawei.com> Change-Id: I9c399ee7fcac0f9d3488084cb0c0718882952eaf
This commit is contained in:
parent
550e916600
commit
d1f5adb7e1
@ -32,7 +32,7 @@ if [ "$DEVSTACK_GATE_ZAQAR_BACKEND" == "swift" ]; then
|
||||
OVERRIDE_ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
|
||||
fi
|
||||
export DEVSTACK_LOCAL_CONFIG+=$"
|
||||
export ZAQAR_BACKEND=$DEVSTACK_GATE_ZAQAR_BACKEND"
|
||||
ZAQAR_BACKEND=$DEVSTACK_GATE_ZAQAR_BACKEND"
|
||||
export OVERRIDE_ENABLED_SERVICES
|
||||
|
||||
function run_devstack_gate() {
|
||||
|
69
devstack/upgrade/resource.sh
Executable file
69
devstack/upgrade/resource.sh
Executable file
@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2017 Catalyst IT Ltd.
|
||||
#
|
||||
# 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.
|
||||
|
||||
set -o errexit
|
||||
|
||||
source $GRENADE_DIR/grenaderc
|
||||
source $GRENADE_DIR/functions
|
||||
|
||||
source $TOP_DIR/openrc admin admin
|
||||
|
||||
ZAQAR_DEVSTACK_DIR=$(cd $(dirname "$0")/.. && pwd)
|
||||
source $ZAQAR_DEVSTACK_DIR/settings
|
||||
|
||||
set -o xtrace
|
||||
|
||||
|
||||
function create {
|
||||
# TODO(flwang): Create queue, create subscriptions, post messages,
|
||||
# delete queue
|
||||
:
|
||||
}
|
||||
|
||||
function verify {
|
||||
# TODO(flwang): Get queue, get messages, get subscriptions
|
||||
:
|
||||
}
|
||||
|
||||
function verify_noapi {
|
||||
:
|
||||
}
|
||||
|
||||
function destroy {
|
||||
# TODO(flwang): Purge queue, delete queue
|
||||
:
|
||||
}
|
||||
|
||||
# Dispatcher
|
||||
case $1 in
|
||||
"create")
|
||||
create
|
||||
;;
|
||||
"verify")
|
||||
verify
|
||||
;;
|
||||
"verify_noapi")
|
||||
verify_noapi
|
||||
;;
|
||||
"destroy")
|
||||
destroy
|
||||
;;
|
||||
"force_destroy")
|
||||
set +o errexit
|
||||
destroy
|
||||
;;
|
||||
esac
|
||||
|
19
devstack/upgrade/settings
Normal file
19
devstack/upgrade/settings
Normal file
@ -0,0 +1,19 @@
|
||||
# Grenade needs to know that Zaqar has a Grenade plugin. This is done in the
|
||||
# gate by setting GRENADE_PLUGINRC when using openstack-infra/devstack-gate.
|
||||
# That means that in the project openstack-infra/project-config we will need to
|
||||
# update the Zaqar grenade job(s) in jenkins/jobs/devstack-gate.yaml with
|
||||
# this:
|
||||
# export GRENADE_PLUGINRC="enable_grenade_plugin zaqar https://git.openstack.org/openstack/zaqar"
|
||||
# If openstack-infra/project-config is not updated then the Grenade tests will
|
||||
# never get run for Zaqar
|
||||
|
||||
register_project_for_upgrade zaqar
|
||||
|
||||
|
||||
if grep -q 'management_store *= *sqlalchemy' /etc/zaqar/zaqar.conf; then
|
||||
register_db_to_save zaqar
|
||||
fi
|
||||
|
||||
devstack_localrc base enable_service zaqar-wsgi zaqar-websocket zaqar
|
||||
|
||||
devstack_localrc target enable_service zaqar-wsgi zaqar-websocket zaqar
|
26
devstack/upgrade/shutdown.sh
Executable file
26
devstack/upgrade/shutdown.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
|
||||
source $GRENADE_DIR/grenaderc
|
||||
source $GRENADE_DIR/functions
|
||||
|
||||
# We need base DevStack functions for this
|
||||
source $BASE_DEVSTACK_DIR/functions
|
||||
source $BASE_DEVSTACK_DIR/stackrc # needed for status directory
|
||||
source $BASE_DEVSTACK_DIR/lib/tls
|
||||
|
||||
# Keep track of the DevStack directory
|
||||
ZAQAR_DEVSTACK_DIR=$(dirname "$0")/..
|
||||
source $ZAQAR_DEVSTACK_DIR/settings
|
||||
source $ZAQAR_DEVSTACK_DIR/plugin.sh
|
||||
|
||||
set -o xtrace
|
||||
|
||||
for serv in zaqar-websocket; do
|
||||
stop_process $serv
|
||||
done
|
||||
|
||||
uwsgi --stop $ZAQAR_UWSGI_MASTER_PIDFILE
|
108
devstack/upgrade/upgrade.sh
Executable file
108
devstack/upgrade/upgrade.sh
Executable file
@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ``upgrade-zaqar``
|
||||
|
||||
echo "*********************************************************************"
|
||||
echo "Begin $0"
|
||||
echo "*********************************************************************"
|
||||
|
||||
# Clean up any resources that may be in use
|
||||
cleanup() {
|
||||
set +o errexit
|
||||
|
||||
echo "*********************************************************************"
|
||||
echo "ERROR: Abort $0"
|
||||
echo "*********************************************************************"
|
||||
|
||||
# Kill ourselves to signal any calling process
|
||||
trap 2; kill -2 $$
|
||||
}
|
||||
|
||||
trap cleanup SIGHUP SIGINT SIGTERM
|
||||
|
||||
# Keep track of the grenade directory
|
||||
RUN_DIR=$(cd $(dirname "$0") && pwd)
|
||||
|
||||
# Source params
|
||||
source $GRENADE_DIR/grenaderc
|
||||
|
||||
source $TOP_DIR/openrc admin admin
|
||||
|
||||
# Import common functions
|
||||
source $GRENADE_DIR/functions
|
||||
|
||||
# This script exits on an error so that errors don't compound and you see
|
||||
# only the first error that occurred.
|
||||
set -o errexit
|
||||
|
||||
if grep -q 'management_store *= *mongodb' /etc/zaqar/zaqar.conf; then
|
||||
mongodump --db zaqar_mgmt --out $SAVE_DIR/zaqar-mongodb-mgmt-dump.$BASE_RELEASE
|
||||
fi
|
||||
|
||||
if grep -q 'message_store *= *mongodb' /etc/zaqar/zaqar.conf; then
|
||||
mongodump --db zaqar --out $SAVE_DIR/zaqar-mongodb-message-dump.$BASE_RELEASE
|
||||
fi
|
||||
|
||||
if grep -q 'message_store *= *redis' /etc/zaqar/zaqar.conf; then
|
||||
redis-cli save
|
||||
cp /var/lib/redis/dump.rdb $SAVE_DIR/zaqar-redis-message-dump-$BASE_RELEASE.rdb
|
||||
fi
|
||||
|
||||
# Upgrade Zaqar
|
||||
# =============
|
||||
|
||||
# Duplicate some setup bits from target DevStack
|
||||
source $TARGET_DEVSTACK_DIR/stackrc
|
||||
source $TARGET_DEVSTACK_DIR/lib/tls
|
||||
|
||||
# Keep track of the DevStack directory
|
||||
ZAQAR_DEVSTACK_DIR=$(dirname "$0")/..
|
||||
source $ZAQAR_DEVSTACK_DIR/settings
|
||||
source $ZAQAR_DEVSTACK_DIR/plugin.sh
|
||||
|
||||
# Print the commands being run so that we can see the command that triggers
|
||||
# an error. It is also useful for following allowing as the install occurs.
|
||||
set -o xtrace
|
||||
|
||||
function wait_for_keystone {
|
||||
if ! wait_for_service $SERVICE_TIMEOUT ${KEYSTONE_AUTH_URI}/v$IDENTITY_API_VERSION/; then
|
||||
die $LINENO "keystone did not start"
|
||||
fi
|
||||
}
|
||||
|
||||
# Save current config files for posterity
|
||||
[[ -d $SAVE_DIR/etc.zaqar ]] || cp -pr $ZAQAR_CONF_DIR $SAVE_DIR/etc.zaqar
|
||||
|
||||
stack_install_service zaqar
|
||||
|
||||
if grep -q 'management_store *= *sqlalchemy' /etc/zaqar/zaqar.conf; then
|
||||
zaqar-sql-db-manage --config-file $ZAQAR_CONF upgrade head || die $LINENO "DB sync error"
|
||||
fi
|
||||
|
||||
# calls upgrade-zaqar for specific release
|
||||
upgrade_project zaqar $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH
|
||||
|
||||
start_zaqar
|
||||
wait_for_keystone
|
||||
|
||||
|
||||
# Don't succeed unless the services come up
|
||||
ensure_services_started zaqar-server
|
||||
|
||||
if grep -q 'management_store *= *mongodb' /etc/zaqar/zaqar.conf; then
|
||||
mongodump --db zaqar_mgmt --out $SAVE_DIR/zaqar-mongodb-mgmt-dump.$TARGET_RELEASE
|
||||
fi
|
||||
|
||||
if grep -q 'message_store *= *mongodb' /etc/zaqar/zaqar.conf; then
|
||||
mongodump --db zaqar --out $SAVE_DIR/zaqar-mongodb-message-dump.$TARGET_RELEASE
|
||||
fi
|
||||
|
||||
if grep -q 'message_store *= *redis' /etc/zaqar/zaqar.conf; then
|
||||
redis-cli save
|
||||
cp /var/lib/redis/dump.rdb $SAVE_DIR/zaqar-redis-message-dump-$TARGET_RELEASE.rdb
|
||||
fi
|
||||
|
||||
set +o xtrace
|
||||
echo "*********************************************************************"
|
||||
echo "SUCCESS: End $0"
|
||||
echo "*********************************************************************"
|
0
zaqar_upgradetests/post_test_hook.sh
Executable file
0
zaqar_upgradetests/post_test_hook.sh
Executable file
0
zaqar_upgradetests/pre_test_hook.sh
Executable file
0
zaqar_upgradetests/pre_test_hook.sh
Executable file
Loading…
Reference in New Issue
Block a user