Browse Source

Merge "Add devstack job and fix linters"

Zuul 2 months ago
parent
commit
348857cc49
5 changed files with 181 additions and 121 deletions
  1. 35
    0
      .zuul.yaml
  2. 111
    76
      devstack/lib/stx-metal
  3. 1
    39
      devstack/plugin.sh
  4. 24
    5
      devstack/settings
  5. 10
    1
      tox.ini

+ 35
- 0
.zuul.yaml View File

@@ -8,6 +8,8 @@
8 8
         - build-openstack-releasenotes
9 9
         - openstack-tox-linters
10 10
         - openstack-tox-pep8
11
+        - stx-devstack-metal:
12
+            voting: false
11 13
     gate:
12 14
       jobs:
13 15
         - build-openstack-api-ref
@@ -19,3 +21,36 @@
19 21
         - publish-stx-api-ref
20 22
         - publish-stx-tox
21 23
         - publish-stx-releasenotes
24
+
25
+- job:
26
+    name: stx-devstack-metal
27
+    parent: stx-devstack-base
28
+    timeout: 7800
29
+    required-projects:
30
+      - openstack/stx-update
31
+      - openstack/stx-fault
32
+      - openstack/stx-nfv
33
+    vars:
34
+      tox_envlist: functional
35
+      devstack_services:
36
+        horizon: false
37
+        # StarlingX services
38
+        fm-common: true
39
+        fm-api: true
40
+        mtce: true
41
+        mtce-compute: true
42
+        mtce-control: true
43
+        mtce-storage: true
44
+        fsmon: true
45
+        hbs: true
46
+        hwmon: true
47
+        mtcalarm: true
48
+        mtclog: true
49
+        pmon: true
50
+        rmon: true
51
+      devstack_plugins:
52
+        stx-fault: git://git.starlingx.io/stx-fault
53
+        stx-nfv: git://git.starlingx.io/stx-nfv
54
+        stx-update: git://git.starlingx.io/stx-update
55
+    files:
56
+      - ^devstack/.*

+ 111
- 76
devstack/lib/stx-metal View File

@@ -48,18 +48,77 @@ SW_VERSION=18.10
48 48
 # Functions
49 49
 # ---------
50 50
 
51
-function uninstall_files() {
52
-    local dest_dir=$1
53
-    local dest_file_array=($2)
54
-    local file=""
55 51
 
56
-    for (( i=0; i<${#dest_file_array[*]}; i++ )); do
57
-        file=${dest_file_array[$i]##*/}
58
-        sudo rm -rf $dest_dir/$file
59
-    done
52
+function build_mtce {
53
+    pushd ${STX_METAL_DIR}/mtce/src
54
+
55
+    local major minor version x
56
+
57
+    if [[ -z $1 || -z $2 ]]; then
58
+        # get mtce version
59
+        read x version <<< $(grep '^Version:' ${STX_METAL_DIR}/mtce/PKG-INFO)
60
+        major=${version%%.*}
61
+        minor=${version##*.}
62
+    else
63
+        major=$1
64
+        minor=$2
65
+    fi
66
+
67
+    # build
68
+    make \
69
+        MAJOR=${major} \
70
+        MINOR=${minor} \
71
+        CCFLAGS=' -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$$(date)\""' \
72
+        build
73
+
74
+    popd
75
+}
76
+
77
+function build_mtce_common {
78
+    pushd ${STX_METAL_DIR}/mtce-common/src
79
+
80
+    local major minor version x
81
+
82
+    if [[ -z $1 || -z $2 ]]; then
83
+        # get mtce-common version
84
+        read x version <<< $(grep '^Version:' ${STX_METAL_DIR}/mtce/PKG-INFO)
85
+        major=${version%%.*}
86
+        minor=${version##*.}
87
+    else
88
+        major=$1
89
+        minor=$2
90
+    fi
91
+
92
+    # build
93
+    make \
94
+        MAJOR=${major} \
95
+        MINOR=${minor} \
96
+        CCFLAGS=' -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$$(date)\""' \
97
+        build
98
+
99
+    popd
100
+}
101
+
102
+function install_maintenance {
103
+    install_mtce_common
104
+    # components could be seperately installed if
105
+    # installation is well controlled in Makefile
106
+    install_mtce
107
+
108
+    if is_service_enabled mtce-compute; then
109
+        install_mtce_compute
110
+    fi
111
+    if is_service_enabled mtce-control; then
112
+        install_mtce_control
113
+    fi
114
+    if is_service_enabled mtce-storage; then
115
+        install_mtce_storage
116
+    fi
60 117
 }
61 118
 
62 119
 function install_mtce_common {
120
+    pushd ${STX_METAL_DIR}/mtce-common/src
121
+
63 122
     local x version
64 123
 
65 124
     # get mtce-common version
@@ -67,15 +126,13 @@ function install_mtce_common {
67 126
     local major=${version%%.*}
68 127
     local minor=${version##*.}
69 128
 
129
+    build_mtce_common
130
+
70 131
     local lib64_dir=${PREFIX}/lib64
71 132
     local inc_dir=${PREFIX}/include
72 133
     local inc_dir_common=${PREFIX}/include/mtce-common
73 134
     local inc_dir_daemon=${PREFIX}/include/mtce-daemon
74 135
 
75
-    # build
76
-    pushd ${STX_METAL_DIR}/mtce-common/src
77
-    make MAJOR=${major} MINOR=${minor} CCFLAGS=' -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$$(date)\""' build
78
-
79 136
     local libdaecom_file=( \
80 137
         "common/libcommon.a" \
81 138
         "common/libthreadUtil.a" \
@@ -200,6 +257,8 @@ function install_mtce_storage {
200 257
 }
201 258
 
202 259
 function install_mtce {
260
+    pushd ${STX_METAL_DIR}/mtce/src
261
+
203 262
     local x version
204 263
 
205 264
     # get mtce version
@@ -207,6 +266,8 @@ function install_mtce {
207 266
     local major=${version%%.*}
208 267
     local minor=${version##*.}
209 268
 
269
+    build_mtce $major $minor
270
+
210 271
     local bin_dir=${PREFIX}/local/bin
211 272
     local sbin_dir=${PREFIX}/local/sbin
212 273
     local lib_dir=${PREFIX}/lib
@@ -221,10 +282,6 @@ function install_mtce {
221 282
     local local_etc_servicesd=${sysconf_dir}/services.d
222 283
     local local_etc_logrotated=${sysconf_dir}/logrotate.d
223 284
 
224
-    # build
225
-    pushd ${STX_METAL_DIR}/mtce/src
226
-    make MAJOR=${major} MINOR=${minor} CCFLAGS=' -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$$(date)\""' build
227
-
228 285
     # install
229 286
     if [ ! -d "/etc/rc.d" ]; then
230 287
         sudo mkdir -p /etc/rc.d
@@ -354,7 +411,7 @@ function install_mtce {
354 411
     sudo install -m 644 -p -D rmon/scripts/oam_resource.conf ${sysconf_dir}/rmon_interfaces.d/oam_resource.conf
355 412
     sudo install -m 644 -p -D rmon/scripts/management_resource.conf ${sysconf_dir}/rmon_interfaces.d/management_resource.conf
356 413
     sudo install -m 644 -p -D rmon/scripts/infrastructure_resource.conf ${sysconf_dir}/rmon_interfaces.d/infrastructure_resource.conf
357
-    sudo install -m 755 -p -D rmon/scripts/query_ntp_servers.sh ${sysconf_dir}/rmonfiles.d/query_ntp_servers.sh
414
+    # sudo install -m 755 -p -D rmon/scripts/query_ntp_servers.sh ${sysconf_dir}/rmonfiles.d/query_ntp_servers.sh
358 415
     sudo install -m 755 -p -D rmon/scripts/rmon_reload_on_cpe.sh ${local_etc_goenabledd}/rmon_reload_on_cpe.sh
359 416
 
360 417
     # log rotation
@@ -380,14 +437,6 @@ function install_mtce {
380 437
     sudo ln -sf librmonapi.so.${major} librmonapi.so.${major}.${minor}
381 438
     sudo ln -sf librmonapi.so.${major} librmonapi.so
382 439
     popd
383
-
384
-}
385
-
386
-function install_maintenance {
387
-    install_mtce_common
388
-    # components could be seperatly installed if
389
-    # installation is well controlled in Makefile
390
-    install_mtce
391 440
 }
392 441
 
393 442
 function configure_maintenance {
@@ -452,7 +501,6 @@ function configure_maintenance {
452 501
 }
453 502
 
454 503
 function start_mtcAgent {
455
-    echo "trigger start mtc agent service"
456 504
     # add admin compute endpoint
457 505
     if is_service_enabled nova; then
458 506
         source openrc admin admin
@@ -470,8 +518,6 @@ function start_mtcAgent {
470 518
 }
471 519
 
472 520
 function start_hbsAgent {
473
-    echo "trigger start hbs agent service"
474
-
475 521
     # copy hbsAgent.service template to devstack
476 522
     sudo cp ${PREFIX}/lib/systemd/system/hbsAgent.service \
477 523
         ${SYSCONFDIR}/systemd/system/devstack@hbsAgent.service
@@ -479,7 +525,6 @@ function start_hbsAgent {
479 525
 }
480 526
 
481 527
 function start_hwmon {
482
-    echo "trigger start hwmon service"
483 528
     # init hwmon
484 529
     iniset -sudo /etc/systemd/system/devstack@hwmon.service "Service" "Type" "forking"
485 530
     iniset -sudo /etc/systemd/system/devstack@hwmon.service "Service" "PIDFile" "/var/run/hwmond.pid"
@@ -491,16 +536,13 @@ function start_mtce_control {
491 536
     # Oneshot goenabled control
492 537
     sudo ${SYSCONFDIR}/init.d/goenabledControl start
493 538
 
494
-    if is_service_enabled mtce; then
495
-        echo "start mtcAgent"
539
+    if is_service_enabled mtce-agent || is_service_enabled mtce; then
496 540
         start_mtcAgent
497 541
     fi
498
-    if is_service_enabled hbs; then
499
-        echo "start hbsAgent"
542
+    if is_service_enabled hbs-agent || is_service_enabled hbs; then
500 543
         start_hbsAgent
501 544
     fi
502
-    if is_service_enabled hwmon; then
503
-        echo "start hwmon"
545
+    if is_service_enabled hwmon && is_service_enabled sysinv; then
504 546
         start_hwmon
505 547
     fi
506 548
 }
@@ -524,45 +566,45 @@ function start_mtce_storage {
524 566
 }
525 567
 
526 568
 function start_maintenance {
569
+    if is_service_enabled mtce-control; then
570
+        start_mtce_control
571
+    fi
572
+    if is_service_enabled mtce-compute; then
573
+        start_mtce_compute
574
+    fi
575
+    if is_service_enabled mtce-storage; then
576
+        start_mtce_storage
577
+    fi
578
+
527 579
     start_goenabled
528 580
 
529 581
     if is_service_enabled hbs; then
530
-        echo "start hbs client service"
531 582
         start_hbsClient
532 583
     fi
533 584
     if is_service_enabled mtce; then
534
-        echo "start mtce client service"
535 585
         start_mtcClient
536 586
     fi
537 587
     if is_service_enabled rmon; then
538
-        echo "start rmon service"
539 588
         start_rmon
540 589
     fi
541 590
     if is_service_enabled mtclog; then
542
-        echo "start mtclog service"
543 591
         start_mtclog
544 592
     fi
545 593
     if is_service_enabled mtcalarm; then
546
-        echo "start mtcalarm service"
547 594
         start_mtcalarm
548 595
     fi
549 596
     if is_service_enabled fsmon; then
550
-        echo "start fsmon service"
551 597
         start_fsmon
552 598
     fi
553 599
     if is_service_enabled pmon; then
554
-        echo "start pmon service"
555 600
         start_pmon
556 601
     fi
557 602
     if is_service_enabled hostw; then
558
-        echo "start hostw service"
559 603
         start_hostw
560 604
     fi
561 605
 }
562 606
 
563 607
 function start_mtcClient {
564
-    echo "trigger start mtce client service"
565
-
566 608
     # copy mtcClient.service template to devstack
567 609
     sudo cp ${PREFIX}/lib/systemd/system/mtcClient.service \
568 610
         ${SYSCONFDIR}/systemd/system/devstack@mtcClient.service
@@ -570,8 +612,6 @@ function start_mtcClient {
570 612
 }
571 613
 
572 614
 function start_hbsClient {
573
-    echo "trigger start hbs client service"
574
-
575 615
     # copy hbsClient.service template to devstack
576 616
     sudo cp ${PREFIX}/lib/systemd/system/hbsClient.service \
577 617
         ${SYSCONFDIR}/systemd/system/devstack@hbsClient.service
@@ -579,8 +619,6 @@ function start_hbsClient {
579 619
 }
580 620
 
581 621
 function start_pmon {
582
-    echo "trigger start pmon service"
583
-
584 622
     # copy pmon.service template to devstack
585 623
     sudo cp ${PREFIX}/lib/systemd/system/pmon.service \
586 624
         ${SYSCONFDIR}/systemd/system/devstack@pmon.service
@@ -589,8 +627,6 @@ function start_pmon {
589 627
 }
590 628
 
591 629
 function start_rmon {
592
-    echo "trigger start rmon service"
593
-
594 630
     # copy rmon.service template to devstack
595 631
     sudo cp ${PREFIX}/lib/systemd/system/rmon.service \
596 632
         ${SYSCONFDIR}/systemd/system/devstack@rmon.service
@@ -599,8 +635,6 @@ function start_rmon {
599 635
 }
600 636
 
601 637
 function start_mtclog {
602
-    echo "trigger start mtclog service"
603
-
604 638
     # copy mtclog.service template to devstack
605 639
     sudo cp ${PREFIX}/lib/systemd/system/mtclog.service \
606 640
         ${SYSCONFDIR}/systemd/system/devstack@mtclog.service
@@ -609,8 +643,6 @@ function start_mtclog {
609 643
 }
610 644
 
611 645
 function start_mtcalarm {
612
-    echo "trigger start mtcalarm service"
613
-
614 646
     # copy mtcalarm.service template to devstack
615 647
     sudo cp ${PREFIX}/lib/systemd/system/mtcalarm.service \
616 648
         ${SYSCONFDIR}/systemd/system/devstack@mtcalarm.service
@@ -619,13 +651,10 @@ function start_mtcalarm {
619 651
 }
620 652
 
621 653
 function start_goenabled {
622
-    echo "trigger start goenabled service"
623 654
     sudo ${SYSCONFDIR}/init.d/goenabled start
624 655
 }
625 656
 
626 657
 function start_fsmon {
627
-    echo "trigger start fsmon service"
628
-
629 658
     # copy fsmon.service template to devstack
630 659
     sudo cp ${PREFIX}/lib/systemd/system/fsmon.service \
631 660
         ${SYSCONFDIR}/systemd/system/devstack@fsmon.service
@@ -634,8 +663,6 @@ function start_fsmon {
634 663
 }
635 664
 
636 665
 function start_hostw {
637
-    echo "trigger start hostw service"
638
-
639 666
     # copy hostw.service template to devstack
640 667
     sudo cp ${PREFIX}/lib/systemd/system/hostw.service \
641 668
         ${SYSCONFDIR}/systemd/system/devstack@hostw.service
@@ -658,16 +685,13 @@ function stop_hwmon {
658 685
 function stop_mtce_control {
659 686
     sudo ${SYSCONFDIR}/init.d/goenabledControl stop
660 687
 
661
-    if is_service_enabled mtce; then
662
-        echo "stop mtcAgent"
688
+    if is_service_enabled mtce-agent || is_service_enabled mtce; then
663 689
         stop_mtcAgent
664 690
     fi
665
-    if is_service_enabled hbs; then
666
-        echo "stop hbsAgent"
691
+    if is_service_enabled hbs-agent || is_service_enabled hbs; then
667 692
         stop_hbsAgent
668 693
     fi
669
-    if is_service_enabled hwmon; then
670
-        echo "stop hwmon"
694
+    if is_service_enabled hwmon && is_service_enabled sysinv; then
671 695
         stop_hwmon
672 696
     fi
673 697
 }
@@ -720,42 +744,42 @@ function stop_maintenance {
720 744
     stop_goenabled
721 745
 
722 746
     if is_service_enabled pmon; then
723
-        echo "stop pmon service"
724 747
         stop_pmon
725 748
     fi
726 749
     if is_service_enabled mtce; then
727
-        echo "stop mtce client service"
728 750
         stop_mtcClient
729 751
     fi
730 752
     if is_service_enabled hbs; then
731
-        echo "stop hbs client service"
732 753
         stop_hbsClient
733 754
     fi
734 755
     if is_service_enabled rmon; then
735
-        echo "stop rmon service"
736 756
         stop_rmon
737 757
     fi
738 758
     if is_service_enabled mtclog; then
739
-        echo "stop mtclog service"
740 759
         stop_mtclog
741 760
     fi
742 761
     if is_service_enabled mtcalarm; then
743
-        echo "stop mtcalarm service"
744 762
         stop_mtcalarm
745 763
     fi
746 764
     if is_service_enabled fsmon; then
747
-        echo "stop fsmon service"
748 765
         stop_fsmon
749 766
     fi
750 767
     if is_service_enabled hostw; then
751
-        echo "stop hostw service"
752 768
         stop_hostw
753 769
     fi
770
+
771
+    if is_service_enabled mtce-control; then
772
+        stop_mtce_control
773
+    fi
774
+    if is_service_enabled mtce-compute; then
775
+        stop_mtce_compute
776
+    fi
777
+    if is_service_enabled mtce-storage; then
778
+        stop_mtce_storage
779
+    fi
754 780
 }
755 781
 
756 782
 function cleanup_metal {
757
-    echo "cleanup_metal"
758
-
759 783
     # TODO: move it to Makefile uninstall
760 784
     # remove mtce
761 785
     local x version
@@ -987,4 +1011,15 @@ function cleanup_metal {
987 1011
     fi
988 1012
 }
989 1013
 
1014
+function uninstall_files {
1015
+    local dest_dir=$1
1016
+    local dest_file_array=($2)
1017
+    local file=""
1018
+
1019
+    for (( i=0; i<${#dest_file_array[*]}; i++ )); do
1020
+        file=${dest_file_array[$i]##*/}
1021
+        sudo rm -rf $dest_dir/$file
1022
+    done
1023
+}
1024
+
990 1025
 $_XTRACE_STX_METAL

+ 1
- 39
devstack/plugin.sh View File

@@ -12,21 +12,9 @@ if is_service_enabled stx-metal; then
12 12
         echo_summary "Pre-requires of stx-metal"
13 13
     elif [[ "$1" == "stack" && "$2" == "install" ]]; then
14 14
         # Perform installation of source
15
-        echo_summary "Install metal"
15
+        echo_summary "Install stx-metal"
16 16
         # maintenance components should be installed in each node
17 17
         install_maintenance
18
-        if is_service_enabled mtce-compute; then
19
-            echo_summary "Install mtce compute specific services"
20
-            install_mtce_compute
21
-        fi
22
-        if is_service_enabled mtce-control; then
23
-            echo_summary "Install mtce control specific services"
24
-            install_mtce_control
25
-        fi
26
-        if is_service_enabled mtce-storage; then
27
-            echo_summary "Install mtce storage specific services"
28
-            install_mtce_storage
29
-        fi
30 18
     elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
31 19
         # Configure after the other layer 1 and 2 services have been configured
32 20
         echo_summary "Configure metal"
@@ -34,19 +22,6 @@ if is_service_enabled stx-metal; then
34 22
     elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
35 23
         # Initialize and start the metal services
36 24
         echo_summary "Initialize and start metal "
37
-        if is_service_enabled mtce-control; then
38
-            echo_summary "Start mtce control specific services"
39
-            # Start Agents on controller node
40
-            start_mtce_control
41
-        fi
42
-        if is_service_enabled mtce-compute; then
43
-            echo_summary "Start mtce compute specific services"
44
-            start_mtce_compute
45
-        fi
46
-        if is_service_enabled mtce-storage; then
47
-            echo_summary "Start mtce storage specific services"
48
-            start_mtce_storage
49
-        fi
50 25
         # Start services on each node
51 26
         start_maintenance
52 27
     elif [[ "$1" == "stack" && "$2" == "test" ]]; then
@@ -59,19 +34,6 @@ if is_service_enabled stx-metal; then
59 34
         echo_summary "Stop metal services"
60 35
         # Stop client services on each node
61 36
         stop_maintenance
62
-        if is_service_enabled mtce-control; then
63
-            echo_summary "Stop mtce control specific services"
64
-            # Stop Agents on controller node
65
-            stop_mtce_control
66
-        fi
67
-        if is_service_enabled mtce-compute; then
68
-            echo_summary "Stop mtce compute specific services"
69
-            stop_mtce_compute
70
-        fi
71
-        if is_service_enabled mtce-storage; then
72
-            echo_summary "Stop mtce storage specific services"
73
-            stop_mtce_storage
74
-        fi
75 37
     fi
76 38
 
77 39
     if [[ "$1" == "clean" ]]; then

+ 24
- 5
devstack/settings View File

@@ -11,17 +11,33 @@
11 11
 # functionality maintenance services.
12 12
 #
13 13
 # Current configuration supports All-in-One simplex mode.
14
+#
15
+# Servcies
16
+# stx-metal - Overall enable for this plugin
17
+#
18
+# mtce
19
+# mtce-control
20
+# mtce-compute
21
+# mtce-storage
22
+#
23
+# mtce-components (include all of the below)
24
+# fsmon
25
+# hbs
26
+# hwmon
27
+# mtcalarm
28
+# mtclog
29
+# pmon
30
+# rmon
14 31
 
15 32
 STX_METAL_NAME=stx-metal
16 33
 
17 34
 ######### Plugin Specific ##########
18 35
 # Enable service for node type
19
-enable_service $STX_METAL_NAME mtce-compute mtce-control mtce-storage
36
+enable_service $STX_METAL_NAME
20 37
 
21
-# TODO:remove the services enabled by default once
22
-# stx-metal is completely enabled
23
-# Enable service for components
24
-enable_service hbs mtce pmon rmon hwmon mtclog mtcalarm fsmon
38
+if is_service_enabled mtce-components; then
39
+    enable_service fsmon hbs hwmon mtce mtcalarm mtclog pmon rmon
40
+fi
25 41
 
26 42
 # Be careful to enable hostw, it will restart your host
27 43
 # if some config is not correct
@@ -42,6 +58,9 @@ if is_service_enabled mtce; then
42 58
     enable_service mtcAgent
43 59
     enable_service mtcClient
44 60
 fi
61
+if is_service_enabled hwmon && is_plugin_enabled stx-config; then
62
+    enable_service sysinv
63
+fi
45 64
 
46 65
 # Initial source of lib script
47 66
 source $DEST/stx-metal/devstack/lib/stx-metal

+ 10
- 1
tox.ini View File

@@ -24,7 +24,11 @@ commands =
24 24
          -type f                              \
25 25
          -not -name \*~                       \
26 26
          -not -name \*.md                     \
27
-         -name \*.sh                          \
27
+         \(                                   \
28
+          -name \*.sh                         \
29
+          -or -not -wholename \*/devstack/files/\* \
30
+          -wholename \*/devstack/\*           \
31
+         \)                                   \
28 32
          -print0 | xargs -n 1 -0 bashate -v -i E010,E006"
29 33
   bash -c "find {toxinidir}        \
30 34
             \( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
@@ -86,3 +90,8 @@ commands =
86 90
   rm -rf api-ref/build
87 91
   sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
88 92
 whitelist_externals = rm
93
+
94
+[testenv:functional]
95
+basepython = python3
96
+whitelist_externals = cat
97
+commands = cat /etc/mtc.ini

Loading…
Cancel
Save