Add extra parameter to integrate with doctor 75/50075/14
authorzhouya <zhou.ya@zte.com.cn>
Fri, 5 Jan 2018 03:19:52 +0000 (11:19 +0800)
committerzhouya <zhou.ya@zte.com.cn>
Tue, 16 Jan 2018 03:09:47 +0000 (11:09 +0800)
Need to change some parameter of ceilometer
to run doctor. In order not to influence
other scenario, add an extra '-d' argument
for doctor test only to change event_pipelint.yaml
template file in kolla-ansible code.

Change-Id: Ia5536658b2a2698bc1384e255328d4d719cc566c
Signed-off-by: zhouya <zhou.ya@zte.com.cn>
ci/deploy/deploy.sh
deploy/prepare.sh
deploy/prepare/execute.py

index c508e47..44feb46 100755 (executable)
@@ -73,7 +73,7 @@ VALID_DEPLOY_SCENARIO=("os-nosdn-nofeature-noha" "os-nosdn-nofeature-ha" "os-odl
 ############################################################################
 # BEGIN of main
 #
-while getopts "b:B:Dn:L:l:p:r:w:s:Sh" OPTION
+while getopts "b:B:Dn:L:l:p:r:w:s:d:Sh" OPTION
 do
     case $OPTION in
         b)
@@ -106,6 +106,9 @@ do
         S)
             SKIP_DEPLOY_DAISY=1
             ;;
+        d)
+            RUN_DOCTOR=${OPTARG}
+            ;;
         h)
             usage
             exit 0
@@ -133,6 +136,8 @@ fi
 
 DEPLOY_SCENARIO=${DEPLOY_SCENARIO:-"os-nosdn-nofeature-noha"}
 
+RUN_DOCTOR=${RUN_DOCTOR:-"0"}
+
 BRIDGE=${BRIDGE:-pxebr}
 
 # these two config files (should be absolute path) should be copied to
@@ -456,7 +461,7 @@ function install_daisy()
 function config_daisy()
 {
     echo "====== add relate config for Daisy and Kolla ======"
-    ssh $SSH_PARAS $DAISY_IP "bash $REMOTE_SPACE/deploy/prepare.sh -n $NETWORK -b $IS_BARE"
+    ssh $SSH_PARAS $DAISY_IP "bash $REMOTE_SPACE/deploy/prepare.sh -n $NETWORK -b $IS_BARE -d $RUN_DOCTOR"
 }
 
 clean_up_target_vms_and_networks
index 803d246..bdf9f1c 100644 (file)
@@ -23,6 +23,7 @@ usage: `basename $0` -n network_config_file
 OPTIONS:
   -n  network configuration path, necessary
   -b  0 for virtual, 1 for baremetal
+  -d  1 for run doctor, other do not
   -h  Print this message and exit
 
 Description:
@@ -36,7 +37,7 @@ EOF
 
 NETWORK_CONF=''
 
-while getopts "n:b:h" OPTION
+while getopts "n:b:d:h" OPTION
 do
     case $OPTION in
         n)
@@ -45,6 +46,9 @@ do
         b)
             IS_BARE=${OPTARG}
             ;;
+        d)
+            RUN_DOCTOR=${OPTARG}
+            ;;
         h)
             usage
             exit 0
@@ -57,4 +61,4 @@ do
     esac
 done
 
-python $PYTHONPATH/deploy/prepare/execute.py -nw $NETWORK_CONF -b $IS_BARE
+python $PYTHONPATH/deploy/prepare/execute.py -nw $NETWORK_CONF -b $IS_BARE -d $RUN_DOCTOR
index 11939b8..909d300 100644 (file)
@@ -12,6 +12,7 @@ import os
 from deploy.config.network import NetworkConfig
 
 KOLLA_CONF_PATH = '/etc/kolla/config'
+DOCTOR_EXTRA_FILE = '/home/kolla_install/kolla-ansible/ansible/roles/ceilometer/templates/event_pipeline.yaml.j2'
 
 
 def _make_dirs(path):
@@ -59,6 +60,11 @@ def _set_trusts_auth():
            'trusts_delegated_roles =\n'
 
 
+def _config_doctor_extra_configuration():
+    with open(DOCTOR_EXTRA_FILE, 'a') as fp:
+        fp.write('          - notifier://?topic=alarm.all\n')
+
+
 def main():
     parser = argparse.ArgumentParser()
     parser.add_argument('-nw', '--network-file',
@@ -69,11 +75,18 @@ def main():
                         type=str,
                         required=True,
                         help='0 for virtual, 1 for baremetal')
+    parser.add_argument('-d', '--run-doctor',
+                        type=str,
+                        required=True,
+                        help='1 for run doctor, other do not run doctor')
     args = parser.parse_args()
 
     if args.is_baremetal == '0':
         _set_qemu_compute()
 
+    if args.run_doctor == '1':
+        _config_doctor_extra_configuration()
+
     _set_default_floating_pool(args.network_file)
     _set_trusts_auth()