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/tempest.py | 50 | ||||
-rwxr-xr-x | deploy/trustme.sh | 9 |
5 files changed, 77 insertions, 11 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/tempest.py b/deploy/tempest.py index b28e1265..93dabbe3 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -94,6 +94,7 @@ def prepare_install(client): build_pxe_for_discover(cluster_id, client, deployment_interface) elif conf['host'] and conf['host'] == 'yes': isbare = False if 'isbare' in conf and conf['isbare'] == 0 else True + enable_dpdk = True if 'scenario' in conf and 'ovs_dpdk' in conf['scenario'] else False print("discover host...") discover_host(hosts_name, client) time.sleep(10) @@ -101,8 +102,8 @@ def prepare_install(client): hosts_info = get_hosts(client) cluster_info = get_cluster(client) cluster_id = cluster_info.id - add_hosts_interface(cluster_id, hosts_info, mac_address_map, - host_interface_map, vip, isbare, client) + update_hosts_interface(cluster_id, hosts_info, mac_address_map, + host_interface_map, vip, isbare, client, enable_dpdk) if len(hosts_name) == 1: protocol_type = 'LVM' service_name = 'cinder' @@ -163,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): @@ -199,9 +203,9 @@ def get_cluster(client): return cluster_info -def add_hosts_interface(cluster_id, hosts_info, mac_address_map, - host_interface_map, - vip, isbare, client): +def update_hosts_interface(cluster_id, hosts_info, mac_address_map, + host_interface_map, vip, + isbare, client, enable_dpdk): for host in hosts_info: dha_host_name = None host = host.to_dict() @@ -214,6 +218,11 @@ def add_hosts_interface(cluster_id, hosts_info, mac_address_map, if interface_name in host_interface_map: interface['assigned_networks'] = \ host_interface_map[interface_name] + if enable_dpdk: + for assigned_network in interface['assigned_networks']: + if assigned_network['name'] == 'physnet1': + interface['vswitch_type'] = 'dvs' + break for nodename in mac_address_map: if interface['mac'] in mac_address_map[nodename]: dha_host_name = nodename @@ -228,11 +237,38 @@ def add_hosts_interface(cluster_id, hosts_info, mac_address_map, host['os_version'] = iso_path + filename if host['os_version'] == iso_path: print("do not have os iso file in /var/lib/daisy/kolla/.") + if enable_dpdk: + host['hugepages'] = str(get_hugepages(host)) + host['hugepagesize'] = '1G' client.hosts.update(host['id'], **host) + host_info = client.hosts.get(host['id']).to_dict() + if host_info.get('suggest_dvsc_cpus') and host_info['suggest_dvsc_cpus'][0] > 0: + host_isolcpus = {'isolcpus': host_info['suggest_dvsc_cpus']} + client.hosts.update(host['id'], **host_isolcpus) print("update role...") 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 |