From 3ea5c6c7072517c47829fd24b78d237279fb42cd Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Tue, 8 Sep 2015 13:52:34 +0800 Subject: [PATCH] Switch to devstack plugin Start using devstack's feature 'Externally Hosted Plugins' [1], that allows to install Mistral using upstream Devstack without need to put some additional files manually. To enable Mistral with Devstack just put following in local[rc] file: enable_plugin mistral https://github.com/openstack/mistral [1] http://docs.openstack.org/developer/devstack/plugins.html#externally-hosted-plugins Implements blueprint devstack-plugin Change-Id: Ia2f188a6eb369a495a7e0f20534fdd02bafcf49a --- README.rst | 2 +- contrib/devstack/README.rst | 35 ----------------- contrib/devstack/extras.d/70-mistral.sh | 23 ----------- devstack/README.rst | 16 ++++++++ .../lib/mistral => devstack/plugin.sh | 38 +++++++++++-------- devstack/settings | 5 +++ functionaltests/pre_test_hook.sh | 22 ----------- 7 files changed, 45 insertions(+), 96 deletions(-) delete mode 100644 contrib/devstack/README.rst delete mode 100644 contrib/devstack/extras.d/70-mistral.sh create mode 100644 devstack/README.rst rename contrib/devstack/lib/mistral => devstack/plugin.sh (89%) mode change 100644 => 100755 create mode 100644 devstack/settings delete mode 100755 functionaltests/pre_test_hook.sh diff --git a/README.rst b/README.rst index 45368d92..254745a8 100644 --- a/README.rst +++ b/README.rst @@ -37,7 +37,7 @@ First of all, clone the repo and go to the repo directory:: **Devstack installation** -Information about how to install Mistral with devstack can be found here: https://github.com/openstack/mistral/tree/master/contrib/devstack +Information about how to install Mistral with devstack can be found here: https://github.com/openstack/mistral/tree/master/devstack **Virtualenv installation**:: diff --git a/contrib/devstack/README.rst b/contrib/devstack/README.rst deleted file mode 100644 index 57693b8e..00000000 --- a/contrib/devstack/README.rst +++ /dev/null @@ -1,35 +0,0 @@ -#. Follow Devstack documentation to setup a host for Devstack. Then clone - Devstack source code:: - - $ git clone https://github.com/openstack-dev/devstack - -#. Clone Mistral source code:: - - $ git clone https://github.com/openstack/mistral - -#. Copy Mistral integration scripts to Devstack:: - - $ cp mistral/contrib/devstack/lib/mistral ${DEVSTACK_DIR}/lib - $ cp mistral/contrib/devstack/extras.d/70-mistral.sh ${DEVSTACK_DIR}/extras.d/ - -#. Create/modify a ``localrc`` file as input to devstack:: - - $ cd devstack - $ touch localrc - -#. The Mistral service is not enabled by default, so it must be enabled in ``localrc`` - before running ``stack.sh``. This example of ``localrc`` - file shows all of the settings required for Mistral:: - - # Enable Mistral - enable_service mistral - -#. Deploy your OpenStack Cloud with Mistral:: - - $ ./stack.sh - - -Note: - -#. All needed keystone endpoints for Mistral will be automatically created during installation. -#. Python-mistralclient will be also cloned and installed automatically. diff --git a/contrib/devstack/extras.d/70-mistral.sh b/contrib/devstack/extras.d/70-mistral.sh deleted file mode 100644 index c3908ce7..00000000 --- a/contrib/devstack/extras.d/70-mistral.sh +++ /dev/null @@ -1,23 +0,0 @@ -# 70-mistral.sh - DevStack extras script to install Mistral - -if is_service_enabled mistral; then - if [[ "$1" == "source" ]]; then - # Initial source - source $TOP_DIR/lib/mistral - elif [[ "$1" == "stack" && "$2" == "install" ]]; then - echo_summary "Installing mistral" - install_mistral - elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - echo_summary "Configuring mistral" - configure_mistral - create_mistral_accounts - elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - echo_summary "Initializing mistral" - init_mistral - start_mistral - fi - - if [[ "$1" == "unstack" ]]; then - stop_mistral - fi -fi diff --git a/devstack/README.rst b/devstack/README.rst new file mode 100644 index 00000000..1c94fcb3 --- /dev/null +++ b/devstack/README.rst @@ -0,0 +1,16 @@ +====================== + Enabling in Devstack +====================== + +1. Download DevStack:: + + git clone https://github.com/openstack-dev/devstack.git + cd devstack + +2. Add this repo as an external repository:: + + > cat local.conf + [[local|localrc]] + enable_plugin mistral https://github.com/openstack/mistral + +3. run ``stack.sh`` diff --git a/contrib/devstack/lib/mistral b/devstack/plugin.sh old mode 100644 new mode 100755 similarity index 89% rename from contrib/devstack/lib/mistral rename to devstack/plugin.sh index 4f19e22d..dd78d270 --- a/contrib/devstack/lib/mistral +++ b/devstack/plugin.sh @@ -1,22 +1,9 @@ -# lib/mistral - -# Dependencies: -# ``functions`` file -# ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined - -# ``stack.sh`` calls the entry points in this order: -# -# install_mistral -# configure_mistral -# start_mistral -# stop_mistral - +# Setting configuration file for Mistral services # Save trace setting XTRACE=$(set +o | grep xtrace) set -o xtrace - # Defaults # -------- @@ -136,11 +123,12 @@ function install_mistral { # both functions (setup_develop and setup_package) are defined at: # http://git.openstack.org/cgit/openstack-dev/devstack/tree/functions-common setup_package $MISTRAL_DIR -e - + # installing python-nose. real_install_package python-nose } + function install_mistral_pythonclient { git_clone $MISTRAL_PYTHONCLIENT_REPO $MISTRAL_PYTHONCLIENT_DIR $MISTRAL_PYTHONCLIENT_BRANCH local tags=`git --git-dir=$MISTRAL_PYTHONCLIENT_DIR/.git tag -l | grep 2015` @@ -164,6 +152,26 @@ function stop_mistral { } +if is_service_enabled mistral; then + if [[ "$1" == "stack" && "$2" == "install" ]]; then + echo_summary "Installing mistral" + install_mistral + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + echo_summary "Configuring mistral" + configure_mistral + create_mistral_accounts + elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + echo_summary "Initializing mistral" + init_mistral + start_mistral + fi + + if [[ "$1" == "unstack" ]]; then + stop_mistral + fi +fi + + # Restore xtrace $XTRACE diff --git a/devstack/settings b/devstack/settings new file mode 100644 index 00000000..b1cc0a87 --- /dev/null +++ b/devstack/settings @@ -0,0 +1,5 @@ +# Devstack settings + +# We have to add Mistral to enabled services for screen_it to work + +enable_service mistral diff --git a/functionaltests/pre_test_hook.sh b/functionaltests/pre_test_hook.sh deleted file mode 100755 index 08c8b082..00000000 --- a/functionaltests/pre_test_hook.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/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 Mistral devstack integration -MISTRAL_BASE=/opt/stack/new/mistral/contrib/devstack -DEVSTACK_BASE=/opt/stack/new/devstack -cp $MISTRAL_BASE/lib/* $DEVSTACK_BASE/lib -cp $MISTRAL_BASE/extras.d/* $DEVSTACK_BASE/extras.d -