From 91fb27b217238f854c477e252bcc18cd213b0673 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 5 Feb 2015 07:24:47 -0500 Subject: [PATCH] convert devstack support to external plugin This uses the defined external plugin interface for devstack to run the ec2-api service. Change-Id: I1d7507c904dc0df452049433ceac34793595176f --- contrib/devstack/README.rst | 20 --------------- contrib/devstack/extras.d/70-ec2-api.sh | 24 ------------------ devstack/README.rst | 13 ++++++++++ .../lib/ec2-api => devstack/plugin.sh | 25 ++++++++++++++----- devstack/settings | 4 +++ 5 files changed, 36 insertions(+), 50 deletions(-) delete mode 100644 contrib/devstack/README.rst delete mode 100644 contrib/devstack/extras.d/70-ec2-api.sh create mode 100644 devstack/README.rst rename contrib/devstack/lib/ec2-api => devstack/plugin.sh (94%) mode change 100644 => 100755 create mode 100644 devstack/settings diff --git a/contrib/devstack/README.rst b/contrib/devstack/README.rst deleted file mode 100644 index 6ca48424..00000000 --- a/contrib/devstack/README.rst +++ /dev/null @@ -1,20 +0,0 @@ -1. Follow Devstack documentation to setup a host for Devstack. Then clone - Devstack source code. - -2. Copy ec2-api integration scripts to Devstack:: - - $ cp lib/ec2-api ${DEVSTACK_DIR}/lib - $ cp extras.d/70-ec2-api.sh ${DEVSTACK_DIR}/extras.d - -3. Create a ``localrc`` file as input to devstack. - -4. The ec2-api services are not enabled by default, so they must be - enabled in ``localrc`` before running ``stack.sh``. This example ``localrc`` - file shows all of the settings required for ec2-api:: - - # Enable ec2-api - enable_service ec2-api - -5. Deploy your OpenStack Cloud with ec2-api:: - - $ ./stack.sh diff --git a/contrib/devstack/extras.d/70-ec2-api.sh b/contrib/devstack/extras.d/70-ec2-api.sh deleted file mode 100644 index ebc7c7f8..00000000 --- a/contrib/devstack/extras.d/70-ec2-api.sh +++ /dev/null @@ -1,24 +0,0 @@ -# ec2-api.sh - DevStack extras script to install ec2-api - -if is_service_enabled ec2-api; then - if [[ "$1" == "source" ]]; then - # Initial source - source $TOP_DIR/lib/ec2-api - elif [[ "$1" == "stack" && "$2" == "install" ]]; then - echo_summary "Installing ec2-api" - install_ec2api - elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - echo_summary "Configuring ec2-api" - configure_ec2api - create_ec2api_accounts - elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - echo_summary "Initializing ec2-api" - init_ec2api - start_ec2api - fi - - if [[ "$1" == "unstack" ]]; then - stop_ec2api - cleanup_ec2api - fi -fi diff --git a/devstack/README.rst b/devstack/README.rst new file mode 100644 index 00000000..1fbd6201 --- /dev/null +++ b/devstack/README.rst @@ -0,0 +1,13 @@ +====================== + Enabling in Devstack +====================== + +1. Download DevStack + +2. Add this repo as an external repository:: + + > cat local.conf + [[local|localrc]] + enable_plugin ec2-api https://github.com/stackforge/ec2-api + +3. run ``stack.sh`` diff --git a/contrib/devstack/lib/ec2-api b/devstack/plugin.sh old mode 100644 new mode 100755 similarity index 94% rename from contrib/devstack/lib/ec2-api rename to devstack/plugin.sh index d8c97df7..9408373f --- a/contrib/devstack/lib/ec2-api +++ b/devstack/plugin.sh @@ -20,10 +20,6 @@ set -o xtrace # Defaults # -------- -# Set up default repos -EC2API_REPO=${EC2API_REPO:-${GIT_BASE}/stackforge/ec2-api.git} -EC2API_BRANCH=${EC2API_BRANCH:-master} - # Set up default directories EC2API_DIR=$DEST/ec2-api EC2API_CONF_DIR=${EC2API_CONF_DIR:-/etc/ec2api} @@ -211,8 +207,6 @@ function init_ec2api() { # install_ec2api() - Collect source and prepare function install_ec2api() { - git_clone $EC2API_REPO $EC2API_DIR $EC2API_BRANCH - # TODO(ruhe): use setup_develop once ec2api requirements match with global-requirement.txt # both functions (setup_develop and setup_package) are defined at: # http://git.openstack.org/cgit/openstack-dev/devstack/tree/functions-common @@ -238,6 +232,25 @@ function cleanup_ec2api() { sudo rm -rf $EC2API_KEYSTONE_SIGNING_DIR } +# main dispatcher +if [[ "$1" == "stack" && "$2" == "install" ]]; then + echo_summary "Installing ec2-api" + install_ec2api +elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + echo_summary "Configuring ec2-api" + configure_ec2api + create_ec2api_accounts +elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + echo_summary "Initializing ec2-api" + init_ec2api + start_ec2api +fi + +if [[ "$1" == "unstack" ]]; then + stop_ec2api + cleanup_ec2api +fi + # Restore xtrace $XTRACE diff --git a/devstack/settings b/devstack/settings new file mode 100644 index 00000000..c07f7d6f --- /dev/null +++ b/devstack/settings @@ -0,0 +1,4 @@ +# Devstack settings + +# we have to add ec2-api to enabled services for screen_it to work +enable_service ec2-api \ No newline at end of file