From ed5026d6c9e5bd2ec51fee47849f8fe308dae105 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Tue, 30 Oct 2018 08:05:01 -0500 Subject: [PATCH] Add DevStack plugin At this point this only installs platform_utils Depends-On: https://review.openstack.org/613973 Change-Id: I5cfb89592b25d60adf717e97c1859af989c08d2f Signed-off-by: Dean Troyer --- .zuul.yaml | 48 +++++++++++++++++++++ devstack/lib/stx-integ | 86 ++++++++++++++++++++++++++++++++++++++ devstack/override-defaults | 1 + devstack/plugin.sh | 36 ++++++++++++++++ devstack/settings | 15 +++++++ tox.ini | 5 +++ 6 files changed, 191 insertions(+) create mode 100644 devstack/lib/stx-integ create mode 100644 devstack/override-defaults create mode 100755 devstack/plugin.sh create mode 100644 devstack/settings diff --git a/.zuul.yaml b/.zuul.yaml index bd858325b..1ff057e58 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -7,6 +7,8 @@ - build-openstack-releasenotes - openstack-tox-pep8 - openstack-tox-linters + - stx-devstack-integ: + voting: false gate: jobs: - build-openstack-releasenotes @@ -16,3 +18,49 @@ jobs: - publish-stx-tox - publish-stx-releasenotes + +- job: + name: stx-devstack-integ + parent: stx-devstack-base + timeout: 7800 + required-projects: + - openstack/stx-fault + vars: + tox_envlist: functional + devstack_services: + # Cinder services + c-api: false + c-bak: false + c-sch: false + c-vol: false + cinder: false + # Glance services + g-api: false + g-reg: false + # Nova services + n-api: false + n-api-meta: false + n-cauth: false + n-cond: false + n-cpu: false + n-novnc: false + n-obj: false + n-sch: false + placement-api: false + # Neutron services + q-agt: true + q-dhcp: false + q-l3: false + q-meta: false + q-metering: false + q-svc: false + horizon: false + # StarlingX services + platform-util: true + devstack_plugins: + stx-fault: git://git.starlingx.io/stx-fault + stx-integ: git://git.starlingx.io/stx-integ + devstack_localrc: + LIBS_FROM_GIT: keystone + files: + - ^devstack/.* diff --git a/devstack/lib/stx-integ b/devstack/lib/stx-integ new file mode 100644 index 000000000..ad1590a4a --- /dev/null +++ b/devstack/lib/stx-integ @@ -0,0 +1,86 @@ +#!/bin/bash +# +# lib/stx-integ +# Functions to control the configuration and operation of stx-integ + +# Dependencies: +# +# - ``functions`` file +# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined + +# ``plugin.sh`` calls the entry points in this order: +# +# - install_integ +# - configure_integ +# - init_integ +# - start_integ +# - stop_integ +# - cleanup_integ + +_XTRACE_STX_INTEG=$(set +o | grep xtrace) +set -o xtrace + +# Defaults +# -------- + +STXINTEG_DIR=${GITDIR[$STX_INTEG_NAME]} + +PLATFORM_UTIL_DIR=$STXINTEG_DIR/utilities/platform-util + +STX_BIN_DIR=$(get_python_exec_prefix) +PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") + +function install_platform_util { + pushd $PLATFORM_UTIL_DIR/platform-util + sudo python setup.py install --root=/ --install-lib=$PYTHON_SITE_DIR --prefix=/usr --install-data=/usr/share --single-version-externally-managed + popd + + local stx_integ_sbindir=/usr/local/sbin/ + local systemddir=/etc/systemd + sudo install -m 755 -d ${stx_integ_sbindir} + sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/patch-restart-mtce ${stx_integ_sbindir} + sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/patch-restart-processes ${stx_integ_sbindir} + sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/patch-restart-haproxy ${stx_integ_sbindir} + + sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/cgcs_tc_setup.sh ${STX_BIN_DIR} + sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/remotelogging_tc_setup.sh ${STX_BIN_DIR} + sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/connectivity_test ${STX_BIN_DIR} + + # sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/opt-platform.mount ${systemddir}/system + # sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/opt-platform.service ${systemddir}/system + # sudo install -m 755 $PLATFORM_UTIL_DIR/scripts/memcached.service ${systemddir}/system +} + +function cleanup_integ { + # Cleanup the service + stop_integ +} + +function configure_integ { + # Configure the service + : +} + +function init_integ { + # Initialize and start the service + : +} + +function install_integ { + # Install the service + if is_service_enabled platform-util; then + install_platform_util + fi +} + +function sart_integ { + # Shut the service down + : +} + +function stop_integ { + # Initialize and start the service + : +} + +$_XTRACE_STX_INTEG diff --git a/devstack/override-defaults b/devstack/override-defaults new file mode 100644 index 000000000..e8d84c2d2 --- /dev/null +++ b/devstack/override-defaults @@ -0,0 +1 @@ +# Plug-in overrides diff --git a/devstack/plugin.sh b/devstack/plugin.sh new file mode 100755 index 000000000..bbff62e80 --- /dev/null +++ b/devstack/plugin.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# ``stack.sh`` calls the entry points in this order: +# +echo_summary "integ devstack plugin.sh called: $1/$2" + +# check for service enabled +if is_service_enabled stx-integ; then + if [[ "$1" == "stack" && "$2" == "install" ]]; then + # Perform installation of source + echo_summary "Install stx-integ" + install_integ + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + # Configure after the other layer 1 and 2 services have been configured + echo_summary "Configure stx-integ" + configure_integ + elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + # Initialize and start the service + echo_summary "Initialize and start stx-integ" + init_integ + elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then + # do sanity test + echo_summary "do test-config" + fi + + if [[ "$1" == "unstack" ]]; then + # Shut down services + echo_summary "Stop stx-integ services" + stop_integ + fi + + if [[ "$1" == "clean" ]]; then + echo_summary "Clean stx-update" + cleanup_integ + fi +fi diff --git a/devstack/settings b/devstack/settings new file mode 100644 index 000000000..93dbe22ec --- /dev/null +++ b/devstack/settings @@ -0,0 +1,15 @@ +#!/bin/bash +# Devstack settings + +# Defaults +# -------- + +STX_INTEG_NAME=stx-integ + +######### Plugin Specific ########## +enable_service $STX_INTEG_NAME + +#platform_license + +# Initial source of lib script +source $DEST/stx-integ/devstack/lib/stx-integ diff --git a/tox.ini b/tox.ini index 147d74531..47b56ccd4 100644 --- a/tox.ini +++ b/tox.ini @@ -138,3 +138,8 @@ basepython = python3 envdir = {toxworkdir}/releasenotes deps = -r{toxinidir}/doc/requirements.txt commands = reno new {posargs} + +[testenv:functional] +basepython = python3 +whitelist_externals = cat +commands = cat /etc/group