Browse Source

Support fine-grained service enablement

Allow cgtsclient to be installed without any of the other
sysinv services or prerequisites.  Also allow some selection
within sysinv services.

Change-Id: Ie8f10cb11111e9545103df001976295fc4aba3a6
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
Dean Troyer 1 month ago
parent
commit
b9ab8f9757
4 changed files with 67 additions and 50 deletions
  1. 1
    2
      .zuul.yaml
  2. 43
    39
      devstack/lib/stx-config
  3. 3
    9
      devstack/plugin.sh
  4. 20
    0
      devstack/settings

+ 1
- 2
.zuul.yaml View File

@@ -179,12 +179,11 @@
179 179
         fm-api: true
180 180
         # fm-rest-api: true
181 181
         # fm-mgr: true
182
+        cgtsclient: true
182 183
         sysinv-agent: true
183 184
         # Skip sysinv-api for now, needs more attention
184 185
         # sysinv-api: true
185 186
         sysinv-cond: true
186
-        mysql: false
187
-        postgresql: true
188 187
         tls-proxy: false
189 188
       devstack_plugins:
190 189
         stx-config: git://git.starlingx.io/stx-config

+ 43
- 39
devstack/lib/stx-config View File

@@ -64,12 +64,20 @@ stx_services="sysinv-api sysinv-cond sysinv-agent"
64 64
 function check_sysinv_services {
65 65
     local service
66 66
     for service in $stx_services; do
67
-        if $SYSTEMCTL is-enabled devstack@$service.service; then
67
+        if [[is_service_enabled $service && $SYSTEMCTL is-enabled devstack@$service.service]]; then
68 68
             $SYSTEMCTL status devstack@$service.service --no-pager
69 69
         fi
70 70
     done
71 71
 }
72 72
 
73
+function configure_config {
74
+    if is_service_enabled sysinv; then
75
+        configure_sysinv
76
+        create_sysinv_user_group
77
+        create_sysinv_accounts
78
+    fi
79
+}
80
+
73 81
 function configure_sysinv {
74 82
     sudo install -d -o $STACK_USER $SYSINV_CONF_DIR
75 83
     cp $SYSINV_DIR/etc/sysinv/sysinv.conf.sample $SYSINV_CONF_FILE
@@ -119,11 +127,9 @@ function create_sysinv_cache_dir {
119 127
 
120 128
 function create_sysinv_user_group {
121 129
     if ! getent group sysinv  >/dev/null; then
122
-        echo "Creating a group called sysinv"
123 130
         sudo groupadd sysinv
124 131
     fi
125 132
     if ! getent passwd sysinv >/dev/null; then
126
-        echo "Creating a user called sysinv"
127 133
         sudo mkdir -p /home/sysinv
128 134
         sudo useradd -g sysinv -s /bin/bash -d /home/sysinv -m sysinv
129 135
         echo "Giving user sysinv passwordless sudo privileges"
@@ -144,16 +150,17 @@ function create_sysinv_user_group {
144 150
 }
145 151
 
146 152
 function init_sysinv {
147
-    echo "trigger init sysinv"
148
-    # Migrations need this
149
-    sudo install -d -m 755 -o ${USER} /var/run/sysinv
150
-    if [[ "$HOST_TOPOLOGY_ROLE" != "subnode" ]]; then
151
-        # (Re)create  sysinv database
152
-        echo "recreate_database sysinv and dbsync"
153
-        recreate_database sysinv
154
-        $SYSINV_BIN_DIR/sysinv-dbsync --config-file=$SYSINV_CONF_FILE
153
+    if is_service_enabled sysinv; then
154
+        # Migrations need this
155
+        sudo install -d -m 755 -o ${USER} /var/run/sysinv
156
+        if [[ "$HOST_TOPOLOGY_ROLE" != "subnode" ]]; then
157
+            # (Re)create  sysinv database
158
+            echo "recreate_database sysinv and dbsync"
159
+            recreate_database sysinv
160
+            $SYSINV_BIN_DIR/sysinv-dbsync --config-file=$SYSINV_CONF_FILE
161
+        fi
162
+        create_sysinv_cache_dir
155 163
     fi
156
-    create_sysinv_cache_dir
157 164
 }
158 165
 
159 166
 function install_cgtsclient {
@@ -161,6 +168,20 @@ function install_cgtsclient {
161 168
     sudo install -D -m 0644 -o $STACK_USER {${GITDIR["$SYSINV_CLIENT_NAME"]}/tools/,/etc/bash_completion.d/}system.bash_completion
162 169
 }
163 170
 
171
+function install_config {
172
+    if is_service_enabled cgtsclient; then
173
+        install_cgtsclient
174
+    fi
175
+    if is_service_enabled sysinv; then
176
+        install_configutilities
177
+        install_controllerconfig
178
+        install_sysinv
179
+    fi
180
+    if is_service_enabled sysinv-agent; then
181
+        install_sysinv_agent
182
+    fi
183
+}
184
+
164 185
 function install_configutilities {
165 186
     # We can't use setup_develop as there is no setup.cfg file present for configutilities
166 187
     setup_package $STXCONFIG_CONFUTILS -e
@@ -176,12 +197,6 @@ function install_controllerconfig {
176 197
 }
177 198
 
178 199
 function install_sysinv {
179
-    local req_services="key rabbit nova neutron"
180
-    for srv in $req_services;do
181
-        if ! is_service_enabled "$srv"; then
182
-            die $LINENO "$srv should be enabled for SysInv"
183
-        fi
184
-    done
185 200
     setup_develop $SYSINV_DIR
186 201
     sudo install -d -m 755 $SYSINV_ETC_GOENABLEDD
187 202
     sudo install -p -D -m 755 $SYSINV_DIR/etc/sysinv/sysinv_goenabled_check.sh $SYSINV_ETC_GOENABLEDD/sysinv_goenabled_check.sh
@@ -200,10 +215,6 @@ function install_sysinv {
200 215
     sudo install -p -D -m 755 $SYSINV_DIR/sysinv/cmd/partition_info.sh $SYSINV_BIN_DIR/partition_info.sh
201 216
     sudo install -p -D -m 755 $SYSINV_DIR/sysinv/cmd/manage-partitions $SYSINV_BIN_DIR/manage-partitions
202 217
     sudo install -p -D -m 755 $SYSINV_DIR/sysinv/cmd/query_pci_id $SYSINV_BIN_DIR/query_pci_id
203
-    if is_service_enabled sysinv-agent; then
204
-        echo_summary "Installing sysinv-agent service"
205
-        install_sysinv_agent
206
-    fi
207 218
 }
208 219
 
209 220
 function install_sysinv_agent {
@@ -211,35 +222,23 @@ function install_sysinv_agent {
211 222
     sudo install -p -D -m 755 $SYSINV_AGENT_DIR/sysinv-agent $SYSINV_BIN_DIR/sysinv-agent.sh
212 223
 }
213 224
 
214
-function install_sysinv_depends {
215
-    install_configutilities
216
-    install_controllerconfig
217
-}
218
-
219 225
 function start_sysinv {
220 226
     if is_service_enabled sysinv-api; then
221
-        echo "start sysinv-api service"
222 227
         start_sysinv_api
223 228
     fi
224 229
     if is_service_enabled sysinv-cond; then
225
-        echo "start sysinv-cond service"
226 230
         start_sysinv_conductor
227 231
     fi
228 232
     if is_service_enabled sysinv-agent; then
229
-        echo "start sysinv-agent service"
230 233
         start_sysinv_agent
231 234
     fi
232 235
 }
233 236
 
234 237
 function start_sysinv_agent {
235
-    if is_service_enabled sysinv-agent; then
236
-        echo "start sysinv-agent service"
237
-        run_process sysinv-agent "$SYSINV_BIN_DIR/sysinv-agent"
238
-    fi
238
+    run_process sysinv-agent "$SYSINV_BIN_DIR/sysinv-agent"
239 239
 }
240 240
 
241 241
 function start_sysinv_api {
242
-    echo "trigger start sysinv api"
243 242
     run_process sysinv-api "$SYSINV_BIN_DIR/sysinv-api --config-file=$SYSINV_CONF_FILE"
244 243
 
245 244
     # Get right service port for testing
@@ -260,7 +259,6 @@ function start_sysinv_api {
260 259
 }
261 260
 
262 261
 function start_sysinv_conductor {
263
-    echo "trigger start sysinv conductor"
264 262
     # the 1st will fail
265 263
     stop_sysinv_conductor
266 264
     run_process sysinv-cond "$SYSINV_BIN_DIR/sysinv-conductor --config-file=$SYSINV_CONF_FILE"
@@ -269,9 +267,15 @@ function start_sysinv_conductor {
269 267
 }
270 268
 
271 269
 function stop_sysinv {
272
-    stop_sysinv_api
273
-    stop_sysinv_conductor
274
-    stop_sysinv_agent
270
+    if is_service_enabled sysinv-api; then
271
+        stop_sysinv_api
272
+    fi
273
+    if is_service_enabled sysinv-cond; then
274
+        stop_sysinv_conductor
275
+    fi
276
+    if is_service_enabled sysinv-agent; then
277
+        stop_sysinv_agent
278
+    fi
275 279
 }
276 280
 
277 281
 function stop_sysinv_agent {

+ 3
- 9
devstack/plugin.sh View File

@@ -9,18 +9,12 @@ echo_summary "sysinv devstack plugin.sh called: $1/$2"
9 9
 if is_service_enabled stx-config; then
10 10
     if [[ "$1" == "stack" && "$2" == "install" ]]; then
11 11
         # Perform installation of source
12
-        echo_summary "Installing cgts_client"
13
-        install_cgtsclient
14
-        echo_summary "Installing depends"
15
-        install_sysinv_depends
16
-        echo_summary "Installing sysinv service"
17
-        install_sysinv
12
+        echo_summary "Installing stx-config"
13
+        install_config
18 14
     elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
19 15
         # Configure after the other layer 1 and 2 services have been configured
20 16
         echo_summary "Configure sysinv"
21
-        configure_sysinv
22
-        create_sysinv_user_group
23
-        create_sysinv_accounts
17
+        configure_config
24 18
     elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
25 19
         # Initialize and start the sysinv service
26 20
         echo_summary "Initialize and start sysinv "

+ 20
- 0
devstack/settings View File

@@ -1,6 +1,13 @@
1 1
 #!/bin/bash
2 2
 # Devstack settings
3 3
 
4
+# Services
5
+# cgtsclient
6
+# sysinv
7
+# sysinv-agent
8
+# sysinv-api
9
+# sysinv-cond
10
+
4 11
 # Defaults
5 12
 # --------
6 13
 
@@ -21,5 +28,18 @@ enable_service platform-util
21 28
 # stx-update
22 29
 enable_service sw-patch tsconfig
23 30
 
31
+if is_service_enabled sysinv-agent; then
32
+    enable_service sysinv
33
+fi
34
+
35
+if is_service_enabled sysinv-agent; then
36
+    local req_services="key rabbit nova neutron"
37
+    for srv in $req_services;do
38
+        if ! is_service_enabled "$srv"; then
39
+            die $LINENO "$srv should be enabled for SysInv"
40
+        fi
41
+    done
42
+fi
43
+
24 44
 # Initial source of lib script
25 45
 source $DEST/stx-config/devstack/lib/stx-config

Loading…
Cancel
Save