From d8851b35a3ce21c8381b98b3b4d802326c2a258f Mon Sep 17 00:00:00 2001 From: Liuqing Jing Date: Thu, 18 Feb 2016 17:55:00 -0500 Subject: [PATCH] Add devstack support for senlin dashboard And record whole functions in devstack/lib/senlin Change-Id: I8b0135eac49b3265e7333748ad3db911ab114022 --- devstack/lib/senlin | 44 +++++++++++++++++++++++++++++++++++++++++--- devstack/plugin.sh | 14 ++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/devstack/lib/senlin b/devstack/lib/senlin index 0cfae23c4..123530934 100644 --- a/devstack/lib/senlin +++ b/devstack/lib/senlin @@ -11,16 +11,23 @@ # Dependencies: # # - functions +# - HORIZON_DIR # stack.sh # --------- +# - config_senlin_dashboard +# - configure_senlin +# - cleanup_senlin +# - cleanup_senlin_dashboard +# - create_senlin_cache_dir +# - create_senlin_accounts +# - init_senlin # - install_senlinclient # - install_senlin -# - configure_senlin -# - init_senlin +# - install_senlin_dashboard +# - is_senlin_enabled # - start_senlin # - stop_senlin -# - cleanup_senlin # Save trace setting XTRACE=$(set +o | grep xtrace) @@ -46,6 +53,10 @@ SENLINCLIENT_DIR=$DEST/python-senlinclient SENLINCLIENT_REPO=${SENLINCLIENT_REPO:-${GIT_BASE}/openstack/python-senlinclient.git} SENLINCLIENT_BRANCH=${SENLINCLIENT_BRANCH:-master} +SENLIN_DASHBOARD_DIR=$DEST/senlin-dashboard +SENLIN_DASHBOARD_REPO=${SENLIN_DASHBOARD_REPO:-${GIT_BASE}/openstack/senlin-dashboard.git} +SENLIN_DASHBOARD_BRANCH=${SENLIN_DASHBOARD_BRANCH:-master} + # Functions # --------- @@ -143,6 +154,33 @@ function install_senlinclient { fi } +# install_senlin_dashboard() - Collect source and prepare +function install_senlin_dashboard { + # NOTE(Liuqing): workaround for devstack bug: 1540328 + # https://bugs.launchpad.net/devstack/+bug/1540328 + # where devstack install 'test-requirements' but should not do it + # for senlin-dashboard project as it installs Horizon from url. + # Remove following two 'mv' commands when mentioned bug is fixed. + + git_clone $SENLIN_DASHBOARD_REPO $SENLIN_DASHBOARD_DIR $SENLIN_DASHBOARD_BRANCH + mv $SENLIN_DASHBOARD_DIR/test-requirements.txt $SENLIN_DASHBOARD_DIR/_test-requirements.txt + setup_develop $SENLIN_DASHBOARD_DIR + + mv $SENLIN_DASHBOARD_DIR/_test-requirements.txt $SENLIN_DASHBOARD_DIR/test-requirements.txt +} + +# configure_senlin_dashboard() - Set config files +function config_senlin_dashboard { + # Install Senlin Dashboard as plugin for Horizon + ln -sf $SENLIN_DASHBOARD_DIR/_50_senlin.py.example $HORIZON_DIR/openstack_dashboard/local/enabled/_50_senlin.py +} + +# cleanup_senlin_dashboard() - Remove residual data files, anything left over from previous +# runs that a clean run would need to clean up +function cleanup_senlin_dashboard { + sudo rm -rf $HORIZON_DIR/openstack_dashboard/local/enabled/_50_senlin.py +} + # install_senlin() - Collect source and prepare function install_senlin { git_clone $SENLIN_REPO $SENLIN_DIR $SENLIN_BRANCH diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 1a104341c..c66d72026 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -14,11 +14,21 @@ if is_service_enabled sl-api sl-eng; then install_senlin echo_summary "Installing senlinclient" install_senlinclient + if is_service_enabled horizon; then + echo_summary "Installing senlin dashboard" + install_senlin_dashboard + cleanup_senlin_dashboard + fi cleanup_senlin elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then echo_summary "Configuring senlin" configure_senlin + if is_service_enabled horizon; then + echo_summary "Configuring senlin dashboard" + config_senlin_dashboard + fi + if is_service_enabled key; then create_senlin_accounts fi @@ -38,6 +48,10 @@ if is_service_enabled sl-api sl-eng; then if [[ "$1" == "clean" ]]; then cleanup_senlin + + if is_service_enabled horizon; then + cleanup_senlin_dashboard + fi fi fi