diff options
Diffstat (limited to 'deploy')
-rwxr-xr-x | deploy/check_os_progress.sh | 9 | ||||
-rw-r--r-- | deploy/post/execute.py | 16 | ||||
-rw-r--r-- | deploy/post/keystoneauth.py | 4 | ||||
-rw-r--r-- | deploy/prepare.sh | 8 | ||||
-rw-r--r-- | deploy/prepare/execute.py | 13 | ||||
-rw-r--r-- | deploy/tempest.py | 29 | ||||
-rwxr-xr-x | deploy/trustme.sh | 9 |
7 files changed, 79 insertions, 9 deletions
diff --git a/deploy/check_os_progress.sh b/deploy/check_os_progress.sh index fe452503..8f8e6144 100755 --- a/deploy/check_os_progress.sh +++ b/deploy/check_os_progress.sh @@ -1,4 +1,13 @@ #!/bin/bash +############################################################################## +# Copyright (c) 2018 ZTE Corporation and others. +# hu.zhijiang@zte.com.cn +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + usage() { cat << EOF diff --git a/deploy/post/execute.py b/deploy/post/execute.py index 6acbe637..7b0293a2 100644 --- a/deploy/post/execute.py +++ b/deploy/post/execute.py @@ -21,10 +21,20 @@ def _config_kolla_admin_openrc(kolla_config_path): with open('%s/globals.yml' % kolla_config_path, 'r') as f: kolla_config = yaml.safe_load(f.read()) if kolla_config.get('enable_opendaylight', None) == 'yes': - sdn_controller_ip = kolla_config.get('kolla_internal_vip_address') openrc_file = file('%s/admin-openrc.sh' % kolla_config_path, 'a') - sdn_ctl_ip = 'export SDN_CONTROLLER_IP=' + sdn_controller_ip + '\n' - openrc_file.write(sdn_ctl_ip) + + v = kolla_config.get('kolla_internal_vip_address') + line = 'export SDN_CONTROLLER_IP=' + v + '\n' + openrc_file.write(line) + + v = kolla_config.get('opendaylight_haproxy_restconf_port_backup') + line = 'export SDN_CONTROLLER_WEBPORT=' + v + '\n' + openrc_file.write(line) + + v = kolla_config.get('opendaylight_haproxy_restconf_port') + line = 'export SDN_CONTROLLER_RESTCONFPORT=' + v + '\n' + openrc_file.write(line) + openrc_file.close() diff --git a/deploy/post/keystoneauth.py b/deploy/post/keystoneauth.py index 2d7d0e75..f3d25ae0 100644 --- a/deploy/post/keystoneauth.py +++ b/deploy/post/keystoneauth.py @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 ZTE Coreporation and others. +# Copyright (c) 2017 ZTE Corporation and others. # feng.xiaowei@zte.com.cn # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -30,6 +30,8 @@ class Keystoneauth(object): def _parse_openrc(self): def parse_line(creds, line): + if line.startswith('#') or "=" not in line: + return creds var = line.rstrip('"\n').replace('export ', '').split("=") # The two next lines should be modified as soon as rc_file # conforms with common rules. Be aware that it could induce diff --git a/deploy/prepare.sh b/deploy/prepare.sh index 803d2462..bdf9f1ca 100644 --- a/deploy/prepare.sh +++ b/deploy/prepare.sh @@ -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 diff --git a/deploy/prepare/execute.py b/deploy/prepare/execute.py index 11939b8d..909d3001 100644 --- a/deploy/prepare/execute.py +++ b/deploy/prepare/execute.py @@ -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() diff --git a/deploy/tempest.py b/deploy/tempest.py index 0c48d778..93dabbe3 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -164,13 +164,16 @@ def install_os_for_vm_step2(cluster_id, client): def discover_host(hosts_name, client): - while True: + retry = 90 + while retry: hosts_info = get_hosts(client) if len(hosts_info) == len(hosts_name): print('discover hosts success!') - break + return else: time.sleep(10) + retry = retry - 1 + err_exit('Failed to discover hosts') def update_network(cluster_id, network_map, client): @@ -235,7 +238,7 @@ def update_hosts_interface(cluster_id, hosts_info, mac_address_map, if host['os_version'] == iso_path: print("do not have os iso file in /var/lib/daisy/kolla/.") if enable_dpdk: - host['hugepages'] = '20' + host['hugepages'] = str(get_hugepages(host)) host['hugepagesize'] = '1G' client.hosts.update(host['id'], **host) host_info = client.hosts.get(host['id']).to_dict() @@ -246,6 +249,26 @@ def update_hosts_interface(cluster_id, hosts_info, mac_address_map, add_host_role(cluster_id, host['id'], dha_host_name, vip, client) +def get_hugepages(host): + total_str = str(host['memory']['total']) + total = int(filter(str.isdigit, total_str)) + unit = filter(str.isalpha, total_str).lower() + + if unit == 'kb': + total = total / 1024 / 1024 + elif unit == 'mb': + total = total / 1024 + elif unit == 'gb': + pass + elif unit == 'b' or unit == '': + total = total / 1024 / 1024 / 1024 + num = total * 6 / 10 + if num % 2 != 0: + num = num + 1 + + return num + + def add_host_role(cluster_id, host_id, dha_host_name, vip, client): role_meta = {'filters': {'cluster_id': cluster_id}} role_list_generator = client.roles.list(**role_meta) diff --git a/deploy/trustme.sh b/deploy/trustme.sh index 38e2d838..1a599be6 100755 --- a/deploy/trustme.sh +++ b/deploy/trustme.sh @@ -1,4 +1,13 @@ #!/bin/sh +############################################################################## +# Copyright (c) 2018 ZTE Corporation and others. +# hu.zhijiang@zte.com.cn +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + #to be trusted by other host and no password needed when use ssh command #check parameters legality |