summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2018-12-06 17:46:10 -0600
committerDean Troyer <dtroyer@gmail.com>2019-02-04 13:03:38 -0600
commit68c99f6f660def8ba9e9451ac9e0b293cb0ae835 (patch)
tree34c559bb2a6c0ff1b5099ab30cfd56789c769ef6
parent579ac41e6adf181ba8d7386a69c2518dd7fe513f (diff)
DevStack cleanups
* Pull binary build steps into separate functions * Add build.sh to call binary builds without the rest of DevStack * Add new stx-fault-build job and tox build environment * Make stx-fault-devstack voting (still only devstack/*) Change-Id: I6692fc1f75db413860ede2657f4f1501b95c10c0 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
Notes
Notes (review): Code-Review+2: Eric MacDonald <eric.macdonald@windriver.com> Code-Review+2: Al Bailey <al.bailey@windriver.com> Workflow+1: Al Bailey <al.bailey@windriver.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 06 Feb 2019 14:26:19 +0000 Reviewed-on: https://review.openstack.org/623590 Project: openstack/stx-fault Branch: refs/heads/master
-rw-r--r--.zuul.yaml19
-rwxr-xr-xdevstack/build.sh35
-rw-r--r--devstack/lib/stx-fault126
-rwxr-xr-xdevstack/plugin.sh2
-rw-r--r--devstack/settings10
-rw-r--r--tox.ini4
6 files changed, 147 insertions, 49 deletions
diff --git a/.zuul.yaml b/.zuul.yaml
index e7bcfc0..91d6068 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -5,24 +5,37 @@
5 - build-openstack-docs-pti 5 - build-openstack-docs-pti
6 check: 6 check:
7 jobs: 7 jobs:
8 - stx-devstack-fault:
9 voting: false
10 - build-openstack-api-ref 8 - build-openstack-api-ref
11 - build-openstack-releasenotes 9 - build-openstack-releasenotes
12 - openstack-tox-linters 10 - openstack-tox-linters
13 - openstack-tox-pep8 11 - openstack-tox-pep8
12 - stx-fault-build
13 - stx-fault-devstack
14 gate: 14 gate:
15 jobs: 15 jobs:
16 - build-openstack-api-ref 16 - build-openstack-api-ref
17 - build-openstack-releasenotes 17 - build-openstack-releasenotes
18 - openstack-tox-linters 18 - openstack-tox-linters
19 - openstack-tox-pep8 19 - openstack-tox-pep8
20 - stx-fault-devstack
20 post: 21 post:
21 jobs: 22 jobs:
22 - publish-stx-api-ref 23 - publish-stx-api-ref
23 - publish-stx-tox 24 - publish-stx-tox
24 - publish-stx-releasenotes 25 - publish-stx-releasenotes
25 26
27# Perform just a build
28- job:
29 name: stx-fault-build
30 parent: tox
31 description: Run build for fault
32 irrelevant-files:
33 - api-ref/*
34 - docs/*
35 - releasenotes/*
36 vars:
37 tox_envlist: build
38
26# This job is to begin testing a DevStack run here 39# This job is to begin testing a DevStack run here
27- job: 40- job:
28 name: stx-devstack-base 41 name: stx-devstack-base
@@ -72,7 +85,7 @@
72 FORCE: yes 85 FORCE: yes
73 86
74- job: 87- job:
75 name: stx-devstack-fault 88 name: stx-fault-devstack
76 parent: stx-devstack-base 89 parent: stx-devstack-base
77 timeout: 7800 90 timeout: 7800
78 required-projects: 91 required-projects:
diff --git a/devstack/build.sh b/devstack/build.sh
new file mode 100755
index 0000000..449b92d
--- /dev/null
+++ b/devstack/build.sh
@@ -0,0 +1,35 @@
1#!/bin/bash
2
3# devstack/build.sh
4# Run DevStack plugin builds
5
6set -o xtrace
7
8unset LANG
9unset LANGUAGE
10LC_ALL=en_US.utf8
11export LC_ALL
12
13# Keep track of the DevStack plugin directory
14PLUGIN_DIR=$(cd $(dirname "$0")/.. && pwd)
15PLUGIN_NAME=$(basename $PLUGIN_DIR)
16
17# Keep plugin happy
18declare -a GITDIR
19GITDIR[$PLUGIN_NAME]=$PLUGIN_DIR
20
21# Dummy function to keep plugin happy
22function get_python_exec_prefix {
23 echo ""
24}
25
26function is_service_enabled {
27 return 0
28}
29
30# Get the build functions
31source $PLUGIN_DIR/devstack/lib/stx-fault
32
33# Call builds
34build_fm_common
35build_fm_mgr
diff --git a/devstack/lib/stx-fault b/devstack/lib/stx-fault
index 14d5761..57dcb24 100644
--- a/devstack/lib/stx-fault
+++ b/devstack/lib/stx-fault
@@ -5,9 +5,6 @@
5 5
6# Dependencies: 6# Dependencies:
7# 7#
8# - ``functions`` file
9# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
10
11# - The stx-update plugin must be enabled 8# - The stx-update plugin must be enabled
12 9
13# ``stack.sh`` calls the entry points in this order: 10# ``stack.sh`` calls the entry points in this order:
@@ -26,13 +23,13 @@ set -o xtrace
26# Defaults 23# Defaults
27# -------- 24# --------
28 25
29FAULT_DIR=${GITDIR[$STX_FAULT_NAME]} 26STX_FAULT_DIR=${GITDIR[$STX_FAULT_NAME]}
30FAULT_CONF_DIR=/etc/fm 27STX_FAULT_CONF_DIR=/etc/fm
31FM_RESTAPI_CONF=$FAULT_CONF_DIR/fm.conf 28FM_RESTAPI_CONF=$STX_FAULT_CONF_DIR/fm.conf
32FM_RESTAPI_PASTE_INI=$FAULT_CONF_DIR/api-paste.ini 29FM_RESTAPI_PASTE_INI=$STX_FAULT_CONF_DIR/api-paste.ini
33FM_RESTAPI_AUTH_CACHE_DIR=${FM_RESTAPI_AUTH_CACHE_DIR:-/var/cache/fault} 30FM_RESTAPI_AUTH_CACHE_DIR=${FM_RESTAPI_AUTH_CACHE_DIR:-/var/cache/fault}
34 31
35FM_RESTAPI_DIR=${GITDIR[$STX_FAULT_NAME]}/fm-rest-api/fm 32FM_RESTAPI_DIR=$STX_FAULT_DIR/fm-rest-api/fm
36 33
37 34
38if is_service_enabled tls-proxy; then 35if is_service_enabled tls-proxy; then
@@ -49,6 +46,51 @@ PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; pri
49# Functions 46# Functions
50# --------- 47# ---------
51 48
49function build_fm_common {
50 pushd $STX_FAULT_DIR/fm-common/sources
51
52 local major minor version x
53
54 if [[ -z $1 || -z $2 ]]; then
55 # get fm-common version
56 read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-common/PKG-INFO)
57 major=${version%%.*}
58 minor=${version##*.}
59 else
60 major=$1
61 minor=$2
62 fi
63
64 # build
65 make MAJOR=$major MINOR=$minor
66 python setup.py build
67
68 popd
69}
70
71function build_fm_mgr {
72 pushd $STX_FAULT_DIR/fm-mgr/sources
73
74 local x version
75
76 local major minor version x
77
78 if [[ -z $1 || -z $2 ]]; then
79 # get fm-mgr version
80 read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-mgr/PKG-INFO)
81 local major=${version%%.*}
82 local minor=${version##*.}
83 else
84 major=$1
85 minor=$2
86 fi
87
88 # build
89 make MAJOR=$major MINOR=$minor
90
91 popd
92}
93
52function cleanup_fault { 94function cleanup_fault {
53 stop_fault 95 stop_fault
54 96
@@ -67,14 +109,14 @@ function cleanup_fm_common {
67 local x version 109 local x version
68 110
69 # get fm-common version 111 # get fm-common version
70 read x version <<< $(grep '^Version: ' ${GITDIR[$STX_FAULT_NAME]}/fm-common/PKG-INFO) 112 read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-common/PKG-INFO)
71 local major=${version%%.*} 113 local major=${version%%.*}
72 local minor=${version##*.} 114 local minor=${version##*.}
73 local prefix=${STX_BIN_DIR%/*} 115 local prefix=${STX_BIN_DIR%/*}
74 116
75 sudo rm /etc/ld.so.conf.d/stx-fault.conf 117 sudo rm /etc/ld.so.conf.d/stx-fault.conf
76 118
77 pushd ${GITDIR[$STX_FAULT_NAME]}/fm-common/sources 119 pushd $STX_FAULT_DIR/fm-common/sources
78 120
79 sudo make \ 121 sudo make \
80 DEST_DIR=$prefix \ 122 DEST_DIR=$prefix \
@@ -96,11 +138,11 @@ function cleanup_fm_mgr {
96 local x version 138 local x version
97 139
98 # get fm-mgr version 140 # get fm-mgr version
99 read x version <<< $(grep '^Version: ' ${GITDIR[$STX_FAULT_NAME]}/fm-mgr/PKG-INFO) 141 read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-mgr/PKG-INFO)
100 local major=${version%%.*} 142 local major=${version%%.*}
101 local minor=${version##*.} 143 local minor=${version##*.}
102 144
103 pushd ${GITDIR[$STX_FAULT_NAME]}/fm-mgr/sources 145 pushd $STX_FAULT_DIR/fm-mgr/sources
104 146
105 sudo make \ 147 sudo make \
106 BIN_DIR=/bin \ 148 BIN_DIR=/bin \
@@ -120,13 +162,15 @@ function cleanup_fm_rest_api {
120function configure_fault { 162function configure_fault {
121 if is_service_enabled fm-rest-api; then 163 if is_service_enabled fm-rest-api; then
122 configure_fm_rest_api 164 configure_fm_rest_api
165 create_fault_user_group
166 create_fault_accounts
123 fi 167 fi
124} 168}
125 169
126function configure_fm_rest_api { 170function configure_fm_rest_api {
127 sudo install -d -o $STACK_USER -m 755 $FAULT_CONF_DIR 171 sudo install -d -o $STACK_USER -m 755 $STX_FAULT_CONF_DIR
128 172
129 cp -p $FAULT_DIR/devstack/files/api-paste.ini $FM_RESTAPI_PASTE_INI 173 cp -p $STX_FAULT_DIR/devstack/files/api-paste.ini $FM_RESTAPI_PASTE_INI
130 174
131 configure_auth_token_middleware $FM_RESTAPI_CONF fm $FM_RESTAPI_AUTH_CACHE_DIR 175 configure_auth_token_middleware $FM_RESTAPI_CONF fm $FM_RESTAPI_AUTH_CACHE_DIR
132 176
@@ -159,14 +203,12 @@ function configure_fm_rest_api {
159} 203}
160 204
161function create_fault_accounts { 205function create_fault_accounts {
162 if [[ "$ENABLED_SERVICES" =~ "fm-rest-api" ]]; then 206 create_service_user "fm"
163 create_service_user "fm" 207 get_or_create_service "fm" "faultmanagement" "Fault Management Service"
164 get_or_create_service "fm" "faultmanagement" "Fault Management Service" 208 get_or_create_endpoint \
165 get_or_create_endpoint \ 209 "faultmanagement" \
166 "faultmanagement" \ 210 "$REGION_NAME" \
167 "$REGION_NAME" \ 211 "$FM_RESTAPI_SERVICE_PROTOCOL://$FM_RESTAPI_SERVICE_HOST:$FM_RESTAPI_SERVICE_PORT/v1"
168 "$FM_RESTAPI_SERVICE_PROTOCOL://$FM_RESTAPI_SERVICE_HOST:$FM_RESTAPI_SERVICE_PORT/v1"
169 fi
170} 212}
171 213
172function create_fault_cache_dir { 214function create_fault_cache_dir {
@@ -186,10 +228,9 @@ function init_fault {
186function install_fault { 228function install_fault {
187 if is_service_enabled fm-common; then 229 if is_service_enabled fm-common; then
188 install_fm_common 230 install_fm_common
189 install_fm_client
190 fi 231 fi
191 if is_service_enabled fm-api; then 232 if is_service_enabled fm-client || is_service_enabled fm-common; then
192 install_fm_api 233 install_fm_client
193 fi 234 fi
194 if is_service_enabled fm-api; then 235 if is_service_enabled fm-api; then
195 install_fm_api 236 install_fm_api
@@ -203,7 +244,7 @@ function install_fault {
203} 244}
204 245
205function install_fm_api { 246function install_fm_api {
206 pushd ${GITDIR[$STX_FAULT_NAME]}/fm-api 247 pushd $STX_FAULT_DIR/fm-api
207 sudo python setup.py install \ 248 sudo python setup.py install \
208 --root=/ \ 249 --root=/ \
209 --install-lib=$PYTHON_SITE_DIR \ 250 --install-lib=$PYTHON_SITE_DIR \
@@ -214,7 +255,7 @@ function install_fm_api {
214} 255}
215 256
216function install_fm_client { 257function install_fm_client {
217 pushd ${GITDIR[$STX_FAULT_NAME]}/python-fmclient/fmclient 258 pushd $STX_FAULT_DIR/python-fmclient/fmclient
218 sudo python setup.py install \ 259 sudo python setup.py install \
219 --root=/ \ 260 --root=/ \
220 --install-lib=$PYTHON_SITE_DIR \ 261 --install-lib=$PYTHON_SITE_DIR \
@@ -225,22 +266,21 @@ function install_fm_client {
225} 266}
226 267
227function install_fm_common { 268function install_fm_common {
228 local x version 269 pushd $STX_FAULT_DIR/fm-common/sources
270
271 local major minor version x
229 272
230 # get fm-common version 273 # get fm-common version
231 read x version <<< $(grep '^Version: ' ${GITDIR[$STX_FAULT_NAME]}/fm-common/PKG-INFO) 274 read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-common/PKG-INFO)
232 local major=${version%%.*} 275 major=${version%%.*}
233 local minor=${version##*.} 276 minor=${version##*.}
277
278 build_fm_common $major $minor
234 279
235 # Set up the destinations 280 # Set up the destinations
236 # Making an assumption here about STX_BIN_DIR having ../include be valid 281 # Making an assumption here about STX_BIN_DIR having ../include be valid
237 local prefix=${STX_BIN_DIR%/*} 282 local prefix=${STX_BIN_DIR%/*}
238 283
239 # build
240 pushd ${GITDIR[$STX_FAULT_NAME]}/fm-common/sources
241 make MAJOR=$major MINOR=$minor
242 sudo python setup.py build
243
244 # install 284 # install
245 sudo make \ 285 sudo make \
246 DEST_DIR=$prefix \ 286 DEST_DIR=$prefix \
@@ -273,16 +313,16 @@ function install_fm_common {
273} 313}
274 314
275function install_fm_mgr { 315function install_fm_mgr {
276 local x version 316 pushd $STX_FAULT_DIR/fm-mgr/sources
317
318 local major minor version x
277 319
278 # get fm-mgr version 320 # get fm-mgr version
279 read x version <<< $(grep '^Version: ' ${GITDIR[$STX_FAULT_NAME]}/fm-mgr/PKG-INFO) 321 read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-mgr/PKG-INFO)
280 local major=${version%%.*} 322 major=${version%%.*}
281 local minor=${version##*.} 323 minor=${version##*.}
282 324
283 # build 325 build_fm_mgr $major $minor
284 pushd ${GITDIR[$STX_FAULT_NAME]}/fm-mgr/sources
285 make MAJOR=$major MINOR=$minor
286 326
287 # install 327 # install
288 sudo make \ 328 sudo make \
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 2d2da75..da4ed92 100755
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -3,7 +3,7 @@
3# devstack/plugin.sh 3# devstack/plugin.sh
4# Triggers stx-fault specific functions to install and configure Fault Management 4# Triggers stx-fault specific functions to install and configure Fault Management
5 5
6echo_summary "fault devstack plugin.sh called: $1/$2" 6echo_summary "stx-fault devstack plugin.sh called: $1/$2"
7 7
8# check for service enabled 8# check for service enabled
9if is_service_enabled stx-fault; then 9if is_service_enabled stx-fault; then
diff --git a/devstack/settings b/devstack/settings
index db7b23e..643b550 100644
--- a/devstack/settings
+++ b/devstack/settings
@@ -1,6 +1,14 @@
1#!/bin/bash 1#!/bin/bash
2# Devstack settings 2# Devstack settings
3 3
4# Services
5# stx-fault - Overall enable for this plugin
6# fm-client
7# fm-common
8# fm-api
9# fm-rest-api
10# fm-mgr
11
4# Defaults 12# Defaults
5# -------- 13# --------
6 14
@@ -8,9 +16,7 @@ STX_FAULT_NAME=stx-fault
8 16
9######### Plugin Specific ########## 17######### Plugin Specific ##########
10enable_service $STX_FAULT_NAME 18enable_service $STX_FAULT_NAME
11#define_plugin $STX_FAULT_NAME
12 19
13# Handle STX pre-reqs
14if is_service_enabled fm-rest-api; then 20if is_service_enabled fm-rest-api; then
15 enable_service tsconfig 21 enable_service tsconfig
16fi 22fi
diff --git a/tox.ini b/tox.ini
index bb0bba1..2d372aa 100644
--- a/tox.ini
+++ b/tox.ini
@@ -86,6 +86,10 @@ commands =
86 sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html 86 sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
87whitelist_externals = rm 87whitelist_externals = rm
88 88
89[testenv:build]
90deps =
91commands = {toxinidir}/devstack/build.sh
92
89[testenv:functional] 93[testenv:functional]
90basepython = python3 94basepython = python3
91whitelist_externals = cat 95whitelist_externals = cat