diff options
-rwxr-xr-x | ci/deploy/deploy.sh | 20 | ||||
-rw-r--r-- | deploy/prepare.sh | 8 | ||||
-rw-r--r-- | deploy/prepare/execute.py | 13 | ||||
-rw-r--r-- | deploy/tempest.py | 23 | ||||
-rw-r--r-- | tests/unit/test_tempest.py | 28 |
5 files changed, 70 insertions, 22 deletions
diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh index c508e471..c308ae25 100755 --- a/ci/deploy/deploy.sh +++ b/ci/deploy/deploy.sh @@ -64,7 +64,8 @@ SKIP_DEPLOY_DAISY=0 VM_MULTINODE=("computer01" "computer02" "controller02" "controller03" "controller01") VALID_DEPLOY_SCENARIO=("os-nosdn-nofeature-noha" "os-nosdn-nofeature-ha" "os-odl_l3-nofeature-noha" "os-odl_l2-nofeature-noha" "os-odl_l3-nofeature-ha" "os-odl_l2-nofeature-ha" - "os-odl-nofeature-noha" "os-odl-nofeature-ha") + "os-odl-nofeature-noha" "os-odl-nofeature-ha" + "os-nosdn-ovs_dpdk-noha" "os-nosdn-ovs_dpdk-ha") # # END of variables to customize @@ -73,7 +74,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 +107,9 @@ do S) SKIP_DEPLOY_DAISY=1 ;; + d) + RUN_DOCTOR=${OPTARG} + ;; h) usage exit 0 @@ -133,6 +137,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 @@ -186,11 +192,7 @@ function update_dha_by_pdf() local pdf_yaml=labs/$LAB_NAME/${POD_NAME}.yaml local pod_template=config/installers/daisy/pod_config.yaml.j2 local generate_config=config/utils/generate_config.py - if [[ $DEPLOY_SCENARIO =~ (dpdk) ]]; then - local network_template=config/installers/daisy/network-dpdk.yaml.j2 - else - local network_template=config/installers/daisy/network.yaml.j2 - fi + local network_template=config/installers/daisy/network.yaml.j2 if [ ! -f ${generate_config} ] || [ ! -f ${pdf_yaml} ] || [ ! -f ${pod_template} ] || [ ! -f ${network_template} ] ; then echo "Template files donot exist in ${SECURELABDIR}." return @@ -211,6 +213,7 @@ function update_dha_by_pdf() rm $tmpfile return fi + test -d $(dirname ${DHA_CONF}) || mkdir -p $(dirname ${DHA_CONF}) cp ${tmpfile} ${DHA_CONF} echo "====== Update deploy.yml from POD Descriptor File ======" @@ -219,6 +222,7 @@ function update_dha_by_pdf() echo "Cannot generate network configuration from PDF and IDF!" return fi + test -d $(dirname ${NETWORK_CONF}) || mkdir -p $(dirname ${NETWORK_CONF}) cp ${tmpfile} ${NETWORK_CONF} echo "====== Update $(basename ${NETWORK_CONF}) from POD Descriptor File ======" rm -f $tmpfile @@ -456,7 +460,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 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 b28e1265..0c48d778 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' @@ -199,9 +200,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 +215,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,7 +234,14 @@ 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'] = '20' + 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) diff --git a/tests/unit/test_tempest.py b/tests/unit/test_tempest.py index b03b3c0f..9a70aec5 100644 --- a/tests/unit/test_tempest.py +++ b/tests/unit/test_tempest.py @@ -34,7 +34,7 @@ from deploy.tempest import ( update_network, get_hosts, get_cluster, - add_hosts_interface, + update_hosts_interface, add_host_role, enable_cinder_backend, enable_opendaylight @@ -173,7 +173,7 @@ def test_get_cluster(): @pytest.mark.parametrize('isbare', [ (False), (True)]) -def test_add_hosts_interface(isbare, tmpdir): +def test_update_hosts_interface(isbare, tmpdir): res_old_val = deploy.tempest.iso_path deploy.tempest.iso_path = os.path.join(tmpdir.dirname, tmpdir.basename) + '/' iso_file_path = os.path.join(deploy.tempest.iso_path, 'test_os.iso') @@ -206,9 +206,9 @@ def test_add_hosts_interface(isbare, tmpdir): {'ip': '', 'name': 'physnet1'}], 'ens9': [{'ip': '', 'name': 'HEARTBEAT'}]} vip = '10.20.11.11' - add_hosts_interface(1, hosts_info, mac_address_map, - host_interface_map, - vip, isbare, client) + update_hosts_interface(1, hosts_info, mac_address_map, + host_interface_map, + vip, isbare, client, True) deploy.tempest.iso_path = res_old_val if isbare: assert client.hosts.get(host_id1).metadata == { @@ -217,6 +217,8 @@ def test_add_hosts_interface(isbare, tmpdir): 'ipmi_user': 'zteroot', 'ipmi_passwd': 'superuser', 'interfaces': [{'name': 'ens8', 'mac': '11:11:11:11:11:11', 'assigned_networks': [{'ip': '', 'name': 'EXTERNAL'}]}], + 'hugepagesize': '1G', + 'hugepages': '20', } assert client.hosts.get(host_id2).metadata == { 'id': host_id2, 'name': 'controller02', 'cluster_id': cluster_id, @@ -227,7 +229,10 @@ def test_add_hosts_interface(isbare, tmpdir): {'ip': '', 'name': 'MANAGEMENT'}, {'ip': '', 'name': 'PUBLICAPI'}, {'ip': '', 'name': 'STORAGE'}, - {'ip': '', 'name': 'physnet1'}]}], + {'ip': '', 'name': 'physnet1'}], + 'vswitch_type': 'dvs'}], + 'hugepagesize': '1G', + 'hugepages': '20', } assert client.hosts.get(host_id3).metadata == { 'id': host_id3, 'name': 'computer01', 'cluster_id': cluster_id, @@ -235,6 +240,8 @@ def test_add_hosts_interface(isbare, tmpdir): 'ipmi_user': 'zteroot', 'ipmi_passwd': 'superuser', 'interfaces': [{'name': 'ens9', 'mac': '33:33:33:33:33:33', 'assigned_networks': [{'ip': '', 'name': 'HEARTBEAT'}]}], + 'hugepagesize': '1G', + 'hugepages': '20', } else: assert client.hosts.get(host_id1).metadata == { @@ -242,6 +249,8 @@ def test_add_hosts_interface(isbare, tmpdir): 'cluster': cluster_id, 'os_version': iso_file_path, 'interfaces': [{'name': 'ens8', 'mac': '11:11:11:11:11:11', 'assigned_networks': [{'ip': '', 'name': 'EXTERNAL'}]}], + 'hugepagesize': '1G', + 'hugepages': '20', } assert client.hosts.get(host_id2).metadata == { 'id': host_id2, 'name': 'controller02', 'cluster_id': cluster_id, @@ -251,13 +260,18 @@ def test_add_hosts_interface(isbare, tmpdir): {'ip': '', 'name': 'MANAGEMENT'}, {'ip': '', 'name': 'PUBLICAPI'}, {'ip': '', 'name': 'STORAGE'}, - {'ip': '', 'name': 'physnet1'}]}], + {'ip': '', 'name': 'physnet1'}], + 'vswitch_type': 'dvs'}], + 'hugepagesize': '1G', + 'hugepages': '20', } assert client.hosts.get(host_id3).metadata == { 'id': host_id3, 'name': 'computer01', 'cluster_id': cluster_id, 'cluster': cluster_id, 'os_version': iso_file_path, 'interfaces': [{'name': 'ens9', 'mac': '33:33:33:33:33:33', 'assigned_networks': [{'ip': '', 'name': 'HEARTBEAT'}]}], + 'hugepagesize': '1G', + 'hugepages': '20', } tmpdir.remove() |