Added Devstack integration
Note: this patch enables only murano-api service. Change-Id: I5f072b65c48ca3eebf244075491f058f8f50efad Partly-Implements: blueprint murano-api-devstack-gates
This commit is contained in:
parent
17cfe56728
commit
785872573e
17
contrib/devstack/README.md
Normal file
17
contrib/devstack/README.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
The contrib/devstack/ directory contains the files necessary to integrate Murano with Devstack.
|
||||||
|
|
||||||
|
To install:
|
||||||
|
|
||||||
|
$ DEVSTACK_DIR=.../path/to/devstack
|
||||||
|
$ cp lib/murano ${DEVSTACK_DIR}/lib
|
||||||
|
$ cp extras.d/70-murano.sh ${DEVSTACK_DIR}/extras.d
|
||||||
|
|
||||||
|
To configure Devstack to run Murano:
|
||||||
|
|
||||||
|
$ cd ${DEVSTACK_DIR}
|
||||||
|
$ echo "enable_service murano" >> localrc
|
||||||
|
$ echo "enable_service murano-api" >> localrc
|
||||||
|
|
||||||
|
Run devstack as normal:
|
||||||
|
|
||||||
|
$ ./stack.sh
|
23
contrib/devstack/extras.d/70-murano.sh
Normal file
23
contrib/devstack/extras.d/70-murano.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# murano.sh - DevStack extras script to install Murano
|
||||||
|
|
||||||
|
if is_service_enabled murano; then
|
||||||
|
if [[ "$1" == "source" ]]; then
|
||||||
|
# Initial source
|
||||||
|
source $TOP_DIR/lib/murano
|
||||||
|
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||||
|
echo_summary "Installing Murano"
|
||||||
|
install_murano
|
||||||
|
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||||
|
echo_summary "Configuring Murano"
|
||||||
|
configure_murano
|
||||||
|
create_murano_accounts
|
||||||
|
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||||
|
echo_summary "Initializing Murano"
|
||||||
|
init_murano
|
||||||
|
start_murano
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "unstack" ]]; then
|
||||||
|
stop_murano
|
||||||
|
fi
|
||||||
|
fi
|
166
contrib/devstack/lib/murano
Normal file
166
contrib/devstack/lib/murano
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
# lib/murano
|
||||||
|
|
||||||
|
# Dependencies:
|
||||||
|
# ``functions`` file
|
||||||
|
# ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
|
||||||
|
|
||||||
|
# ``stack.sh`` calls the entry points in this order:
|
||||||
|
#
|
||||||
|
# install_murano
|
||||||
|
# configure_murano
|
||||||
|
# start_murano
|
||||||
|
# stop_murano
|
||||||
|
|
||||||
|
|
||||||
|
# Save trace setting
|
||||||
|
XTRACE=$(set +o | grep xtrace)
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
# --------
|
||||||
|
|
||||||
|
# Set up default repos
|
||||||
|
MURANO_REPO=${MURANO_REPO:-${GIT_BASE}/stackforge/murano-api.git}
|
||||||
|
MURANO_BRANCH=${MURANO_BRANCH:-master}
|
||||||
|
|
||||||
|
MURANO_COMMON_REPO=${MURANO_COMMON_REPO:-${GIT_BASE}/stackforge/murano-common.git}
|
||||||
|
MURANO_COMMON_DIR=$DEST/murano-common
|
||||||
|
|
||||||
|
# Set up default directories
|
||||||
|
MURANO_DIR=$DEST/murano-api
|
||||||
|
MURANO_CONF_DIR=${MURANO_CONF_DIR:-/etc/murano}
|
||||||
|
MURANO_CONF_FILE=${MURANO_CONF_DIR}/murano-api.conf
|
||||||
|
MURANO_DEBUG=${MURANO_DEBUG:-True}
|
||||||
|
|
||||||
|
MURANO_SERVICE_HOST=${MURANO_SERVICE_HOST:-$SERVICE_HOST}
|
||||||
|
MURANO_SERVICE_PORT=${MURANO_SERVICE_PORT:-8082}
|
||||||
|
MURANO_SERVICE_PROTOCOL=${MURANO_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
||||||
|
|
||||||
|
# Support entry points installation of console scripts
|
||||||
|
if [[ -d $MURANO_DIR/bin ]]; then
|
||||||
|
MURANO_BIN_DIR=$MURANO_DIR/bin
|
||||||
|
else
|
||||||
|
MURANO_BIN_DIR=$(get_python_exec_prefix)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# create_murano_accounts() - Set up common required murano accounts
|
||||||
|
#
|
||||||
|
# Tenant User Roles
|
||||||
|
# ------------------------------
|
||||||
|
# service murano admin
|
||||||
|
function create_murano_accounts() {
|
||||||
|
|
||||||
|
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
|
||||||
|
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
|
||||||
|
|
||||||
|
MURANO_USER=$(openstack user create \
|
||||||
|
murano \
|
||||||
|
--password "$SERVICE_PASSWORD" \
|
||||||
|
--project $SERVICE_TENANT \
|
||||||
|
--email murano@example.com \
|
||||||
|
| grep " id " | get_field 2)
|
||||||
|
|
||||||
|
openstack role add \
|
||||||
|
$ADMIN_ROLE \
|
||||||
|
--project $SERVICE_TENANT \
|
||||||
|
--user $MURANO_USER
|
||||||
|
|
||||||
|
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
|
||||||
|
MURANO_SERVICE=$(openstack service create \
|
||||||
|
murano \
|
||||||
|
--type=application_catalog \
|
||||||
|
--description="Application Catalog" \
|
||||||
|
| grep " id " | get_field 2)
|
||||||
|
openstack endpoint create \
|
||||||
|
$MURANO_SERVICE \
|
||||||
|
--region RegionOne \
|
||||||
|
--publicurl "$MURANO_SERVICE_PROTOCOL://$MURANO_SERVICE_HOST:$MURANO_SERVICE_PORT/v1" \
|
||||||
|
--adminurl "$MURANO_SERVICE_PROTOCOL://$MURANO_SERVICE_HOST:$MURANO_SERVICE_PORT/v1" \
|
||||||
|
--internalurl "$MURANO_SERVICE_PROTOCOL://$MURANO_SERVICE_HOST:$MURANO_SERVICE_PORT/v1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Entry points
|
||||||
|
# ------------
|
||||||
|
|
||||||
|
# configure_murano() - Set config files, create data dirs, etc
|
||||||
|
function configure_murano {
|
||||||
|
if [[ ! -d $MURANO_CONF_DIR ]]; then
|
||||||
|
sudo mkdir -p $MURANO_CONF_DIR
|
||||||
|
fi
|
||||||
|
sudo chown $STACK_USER $MURANO_CONF_DIR
|
||||||
|
|
||||||
|
# Copy over Murano configuration file and configure common parameters.
|
||||||
|
cp $MURANO_DIR/etc/murano/murano-api.conf.sample $MURANO_CONF_FILE
|
||||||
|
cp $MURANO_DIR/etc/murano/murano-api-paste.ini $MURANO_CONF_DIR
|
||||||
|
|
||||||
|
iniset $MURANO_CONF_FILE DEFAULT debug $MURANO_DEBUG
|
||||||
|
iniset $MURANO_CONF_FILE DEFAULT use_syslog $SYSLOG
|
||||||
|
|
||||||
|
|
||||||
|
# Murano Api Configuration
|
||||||
|
#-------------------------
|
||||||
|
|
||||||
|
# Setup keystone_authtoken section
|
||||||
|
iniset $MURANO_CONF_FILE keystone_authtoken auth_host $KEYSTONE_AUTH_HOST
|
||||||
|
iniset $MURANO_CONF_FILE keystone_authtoken auth_port $KEYSTONE_AUTH_PORT
|
||||||
|
iniset $MURANO_CONF_FILE keystone_authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
|
||||||
|
iniset $MURANO_CONF_FILE keystone_authtoken cafile $KEYSTONE_SSL_CA
|
||||||
|
iniset $MURANO_CONF_FILE keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
|
||||||
|
iniset $MURANO_CONF_FILE keystone_authtoken admin_user murano
|
||||||
|
iniset $MURANO_CONF_FILE keystone_authtoken admin_password $SERVICE_PASSWORD
|
||||||
|
|
||||||
|
# configure the rpc service.
|
||||||
|
iniset_rpc_backend muranoapi $MURANO_CONF_FILE DEFAULT
|
||||||
|
|
||||||
|
# TODO(ruhe): get rid of this ugly workaround
|
||||||
|
inicomment $MURANO_CONF_FILE DEFAULT rpc_backend
|
||||||
|
|
||||||
|
# configure the database.
|
||||||
|
iniset $MURANO_CONF_FILE database connection `database_connection_url murano`
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# init_murano() - Initialize databases, etc.
|
||||||
|
function init_murano() {
|
||||||
|
# (re)create Murano database
|
||||||
|
recreate_database murano utf8
|
||||||
|
|
||||||
|
# TODO(ruhe): run DB migration script. it doesn't exist yet!!!
|
||||||
|
# $MURANO_BIN_DIR/murano-db-manage --config-file $MURANO_CONF_FILE upgrade head
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# install_murano() - Collect source and prepare
|
||||||
|
function install_murano() {
|
||||||
|
# temporary workaround until we get rid of this repo
|
||||||
|
git_clone $MURANO_COMMON_REPO $MURANO_COMMON_DIR $MURANO_BRANCH
|
||||||
|
setup_develop $MURANO_COMMON_DIR
|
||||||
|
|
||||||
|
git_clone $MURANO_REPO $MURANO_DIR $MURANO_BRANCH
|
||||||
|
setup_develop $MURANO_DIR
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# start_murano() - Start running processes, including screen
|
||||||
|
function start_murano() {
|
||||||
|
screen_it murano-api "cd $MURANO_DIR && $MURANO_BIN_DIR/murano-api --config-file $MURANO_CONF_DIR/murano-api.conf"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# stop_murano() - Stop running processes
|
||||||
|
function stop_murano() {
|
||||||
|
# Kill the Murano screen windows
|
||||||
|
screen -S $SCREEN_NAME -p murano-api -X kill
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Restore xtrace
|
||||||
|
$XTRACE
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# End:
|
0
functionaltests/__init__.py
Normal file
0
functionaltests/__init__.py
Normal file
21
functionaltests/post_test_hook.sh
Executable file
21
functionaltests/post_test_hook.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# This script is executed inside post_test_hook function in devstack gate.
|
||||||
|
|
||||||
|
# Install packages from test-requirements.txt
|
||||||
|
sudo pip install -r /opt/stack/new/murano-api/test-requirements.txt
|
||||||
|
|
||||||
|
cd /opt/stack/new/murano-api/functionaltests
|
||||||
|
sudo ./run_tests.sh
|
22
functionaltests/pre_test_hook.sh
Executable file
22
functionaltests/pre_test_hook.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# This script is executed inside pre_test_hook function in desvstack gate.
|
||||||
|
|
||||||
|
# Install Murano devstack integration
|
||||||
|
MURANO_BASE=/opt/stack/new/murano-api/contrib/devstack
|
||||||
|
DEVSTACK_BASE=/opt/stack/new/devstack
|
||||||
|
cp $MURANO_BASE/lib/* $DEVSTACK_BASE/lib
|
||||||
|
cp $MURANO_BASE/extras.d/* $DEVSTACK_BASE/extras.d
|
||||||
|
|
31
functionaltests/run_tests.sh
Executable file
31
functionaltests/run_tests.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# How many seconds to wait for the API to be responding before giving up
|
||||||
|
API_RESPONDING_TIMEOUT=20
|
||||||
|
|
||||||
|
if ! timeout ${API_RESPONDING_TIMEOUT} sh -c "while ! curl -s http://127.0.0.1:8082/v1/ 2>/dev/null | grep -q 'Authentication required' ; do sleep 1; done"; then
|
||||||
|
echo "Murano API failed to respond within ${API_RESPONDING_TIMEOUT} seconds"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Successfully contacted Murano API"
|
||||||
|
|
||||||
|
# Where tempest code lives
|
||||||
|
TEMPEST_DIR=${TEMPEST_DIR:-/opt/stack/new/tempest}
|
||||||
|
|
||||||
|
# Add tempest source tree to PYTHONPATH
|
||||||
|
export PYTHONPATH=$PYTHONPATH:$TEMPEST_DIR
|
||||||
|
|
||||||
|
nosetests -v .
|
Loading…
Reference in New Issue
Block a user