From 083efad304a64217426b827a666ae828e7b4d0e7 Mon Sep 17 00:00:00 2001 From: xudan Date: Wed, 26 Dec 2018 02:57:47 -0500 Subject: Add a patch to make ram_num configurable for DPDK 1. add a patch to change bottlenecks source code within git repo /home/opnfv/bottlenecks 2. add a script to run the patch within Bottlenecks git repo 3. copy the edited file yardstick.py to /usr/local/lib 4. change the results dir from /home/opnfv/bottlenecks/results to /home/opnfv/results which is out of Bottlenecks git repo JIRA: BOTTLENECKS-248 Change-Id: I86ff51ec41caf79fb16e0985db8eefa679153102 Signed-off-by: xudan --- docs/testing/user/userguide/cli_reference.rst | 6 +++-- docs/testing/user/userguide/testing_guide.rst | 6 ++--- dovetail/run.py | 3 +++ dovetail/test_runner.py | 1 + etc/conf/bottlenecks_config.yml | 14 ++++++---- etc/conf/cmd_config.yml | 4 +++ ...001-Allow-change-ram_num-when-enable-DPDK.patch | 30 ++++++++++++++++++++++ .../bottlenecks/make-ram_num-configurable/apply.sh | 14 ++++++++++ 8 files changed, 68 insertions(+), 10 deletions(-) create mode 100644 etc/patches/bottlenecks/make-ram_num-configurable/0001-Allow-change-ram_num-when-enable-DPDK.patch create mode 100755 etc/patches/bottlenecks/make-ram_num-configurable/apply.sh diff --git a/docs/testing/user/userguide/cli_reference.rst b/docs/testing/user/userguide/cli_reference.rst index 97eccffc..c3ff0ed0 100644 --- a/docs/testing/user/userguide/cli_reference.rst +++ b/docs/testing/user/userguide/cli_reference.rst @@ -81,7 +81,7 @@ Commands List | dovetail run --report | -r | Package the results directory which can be used to upload to OVP web portal | | | | +------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+ -| dovetail run --deploy-scenario | Specify the deploy scenario having as project name 'ovs' | +| dovetail run --deploy-scenario --ram-num | Specify the deploy scenario having as project name 'ovs' following the RAM number of flavors. | | | | +------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+ | dovetail run --no-api-validation | Disable strict API response validation | @@ -255,6 +255,7 @@ Dovetail Run Commands -d, --debug Flag for showing debug log on screen. --testcase TEXT Compliance testcase. Specify option multiple times to include multiple test cases. --testarea TEXT Compliance testarea within testsuite. Specify option multiple times to include multiple test areas. + --ram-num TEXT Specify the RAM_NUM if it's DPDK scenario. The default value is 512 if not set. -s, --stop Flag for stopping on test case failure. -n, --no-clean Keep all Containers created for debuging. --no-api-validation disable strict API response validation @@ -264,12 +265,13 @@ Dovetail Run Commands .. code-block:: bash - root@1f230e719e44:~/dovetail/dovetail# dovetail run --testcase functest.vping.ssh --offline -r --deploy-scenario os-nosdn-ovs-ha + root@1f230e719e44:~/dovetail/dovetail# dovetail run --testcase functest.vping.ssh --offline -r --deploy-scenario os-nosdn-ovs-ha --ram-num 1024 2017-10-12 14:57:51,278 - run - INFO - ================================================ 2017-10-12 14:57:51,278 - run - INFO - Dovetail compliance: ovp.2018.09! 2017-10-12 14:57:51,278 - run - INFO - ================================================ 2017-10-12 14:57:51,278 - run - INFO - Build tag: daily-master-b80bca76-af5d-11e7-879a-0242ac110002 2017-10-12 14:57:51,278 - run - INFO - DEPLOY_SCENARIO : os-nosdn-ovs-ha + 2017-10-12 14:57:51,278 - run - INFO - RAM_NUM : 1024 2017-10-12 14:57:51,336 - run - WARNING - There is no hosts file /home/dovetail/pre_config/hosts.yaml, may be some issues with domain name resolution. 2017-10-12 14:57:51,336 - run - INFO - Get hardware info of all nodes list in file /home/cvp/pre_config/pod.yaml ... 2017-10-12 14:57:51,336 - run - INFO - Hardware info of all nodes are stored in file /home/cvp/results/all_hosts_info.json. diff --git a/docs/testing/user/userguide/testing_guide.rst b/docs/testing/user/userguide/testing_guide.rst index 9010c80d..99bc001a 100644 --- a/docs/testing/user/userguide/testing_guide.rst +++ b/docs/testing/user/userguide/testing_guide.rst @@ -626,12 +626,12 @@ the DEPLOY_SCENARIO environment parameter having as substring the feature name " Note for the users: - if their system uses DPDK, they should run with --deploy-scenario - (e.g. os-nosdn-ovs-ha) - - this is an experimental feature + (e.g. os-nosdn-ovs-ha) and --ram-num + - deploy-scenario is an experimental feature .. code-block:: bash - $ dovetail run --testcase functest.tempest.osinterop --deploy-scenario os-nosdn-ovs-ha + $ dovetail run --testcase functest.tempest.osinterop --deploy-scenario os-nosdn-ovs-ha --ram-num 1024 By default, results are stored in local files on the Test Host at ``$DOVETAIL_HOME/results``. Each time the 'dovetail run' command is executed, the results in the aforementioned directory diff --git a/dovetail/run.py b/dovetail/run.py index 8d4b7f8d..ac0b697b 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -184,6 +184,9 @@ def update_deploy_scenario(logger, **kwargs): if 'deploy_scenario' in kwargs and kwargs['deploy_scenario'] is not None: os.environ['DEPLOY_SCENARIO'] = kwargs['deploy_scenario'] logger.info("DEPLOY_SCENARIO : %s", os.environ['DEPLOY_SCENARIO']) + if 'ram_num' in kwargs and kwargs['ram_num'] is not None: + os.environ['RAM_NUM'] = kwargs['ram_num'] + logger.info("RAM_NUM : {}".format(os.environ['RAM_NUM'])) def check_hosts_file(logger): diff --git a/dovetail/test_runner.py b/dovetail/test_runner.py index 9b5114f8..a783daae 100644 --- a/dovetail/test_runner.py +++ b/dovetail/test_runner.py @@ -145,6 +145,7 @@ class DockerRunner(object): config_item['os_insecure'] = os.getenv("OS_INSECURE") if 'DEPLOY_SCENARIO' in os.environ: config_item['deploy_scenario'] = os.environ['DEPLOY_SCENARIO'] + config_item['ram_num'] = os.getenv('RAM_NUM') config_item['dovetail_home'] = os.getenv("DOVETAIL_HOME") return config_item diff --git a/etc/conf/bottlenecks_config.yml b/etc/conf/bottlenecks_config.yml index b36f8650..ecc50c49 100644 --- a/etc/conf/bottlenecks_config.yml +++ b/etc/conf/bottlenecks_config.yml @@ -3,29 +3,33 @@ {% set validate_testcase = validate_testcase or '' %} {% set testcase = testcase or '' %} {% set deploy_scenario = deploy_scenario or 'unknown' %} +{% set ram_num = ram_num or '512' %} {% set dovetail_home = dovetail_home or '' %} bottlenecks: image_name: opnfv/bottlenecks docker_tag: ovp-2.0.0 opts: '-id --privileged=true' - envs: '-e DEPLOY_SCENARIO={{deploy_scenario}} -e Yardstick_TAG=stable -e OUTPUT_FILE={{testcase}}.out' + envs: '-e DEPLOY_SCENARIO={{deploy_scenario}} -e RAM_NUM={{ram_num}} + -e Yardstick_TAG=stable -e OUTPUT_FILE={{testcase}}.out' volumes: - '-v /var/run/docker.sock:/var/run/docker.sock' + - '-v {{dovetail_home}}/patches:/home/patches' - '-v {{dovetail_home}}/results/bottlenecks:/tmp' config: dir: '/home/opnfv/userconfig' pre_condition: - 'cp /home/opnfv/userconfig/images/ubuntu-16.04-server-cloudimg-amd64-disk1.img /tmp/yardstick.img' + - '/home/patches/bottlenecks/make-ram_num-configurable/apply.sh' cmds: - 'python /home/opnfv/bottlenecks/testsuites/run_testsuite.py testcase {{validate_testcase}} False' post_condition: - - 'mkdir -p /home/opnfv/bottlenecks/results' - - 'cp /tmp/bottlenecks.log /home/opnfv/bottlenecks/results' - - 'cp /tmp/bottlenecks.stress.ping.out /home/opnfv/bottlenecks/results' + - 'mkdir -p /home/opnfv/results' + - 'cp /tmp/bottlenecks.log /home/opnfv/results' + - 'cp /tmp/bottlenecks.stress.ping.out /home/opnfv/results' - 'rm /tmp/yardstick.img' result: - dir: '/home/opnfv/bottlenecks/results' + dir: '/home/opnfv/results' openrc: '/tmp/admin_rc.sh' extra_container: - 'Bottlenecks-Yardstick' diff --git a/etc/conf/cmd_config.yml b/etc/conf/cmd_config.yml index f02c864e..ca00075f 100644 --- a/etc/conf/cmd_config.yml +++ b/etc/conf/cmd_config.yml @@ -69,6 +69,10 @@ cli: flags: - '--deploy-scenario' help: 'Specify the DEPLOY_SCENARIO which will be used as input by each testcase respectively' + ramnum: + flags: + - '--ram-num' + help: "Specify the RAM_NUM if it's DPDK scenario. The default value is 512 if not set." mandatory: flags: - '--mandatory' diff --git a/etc/patches/bottlenecks/make-ram_num-configurable/0001-Allow-change-ram_num-when-enable-DPDK.patch b/etc/patches/bottlenecks/make-ram_num-configurable/0001-Allow-change-ram_num-when-enable-DPDK.patch new file mode 100644 index 00000000..148f656a --- /dev/null +++ b/etc/patches/bottlenecks/make-ram_num-configurable/0001-Allow-change-ram_num-when-enable-DPDK.patch @@ -0,0 +1,30 @@ +From f0443e9921efa7570dd3da1687ae94a8b442f5c2 Mon Sep 17 00:00:00 2001 +From: Dovetail +Date: Wed, 26 Dec 2018 03:36:36 +0000 +Subject: [PATCH] Allow change ram_num when enable DPDK + +Signed-off-by: Dovetail +--- + utils/infra_setup/runner/yardstick.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/utils/infra_setup/runner/yardstick.py b/utils/infra_setup/runner/yardstick.py +index 562e918..6071585 100644 +--- a/utils/infra_setup/runner/yardstick.py ++++ b/utils/infra_setup/runner/yardstick.py +@@ -46,9 +46,12 @@ def yardstick_command_parser(debug, cidr, outfile, parameter): + image_name = config.bottlenecks_config["yardstick_image_name"] + parameter["image_name"] = image_name + DEPLOY_SCENARIO = os.getenv("DEPLOY_SCENARIO") ++ RAM_NUM = os.getenv("RAM_NUM") + if DEPLOY_SCENARIO: + if "ovs" in DEPLOY_SCENARIO: + parameter["dpdk_enabled"] = True ++ if RAM_NUM: ++ parameter["ram_num"] = RAM_NUM + LOG.info(parameter) + if parameter is not None: + cmd += " --task-args " + '"' + str(parameter) + '"' +-- +2.7.4 + diff --git a/etc/patches/bottlenecks/make-ram_num-configurable/apply.sh b/etc/patches/bottlenecks/make-ram_num-configurable/apply.sh new file mode 100755 index 00000000..51ebeea0 --- /dev/null +++ b/etc/patches/bottlenecks/make-ram_num-configurable/apply.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e +set -u + +cd /home/opnfv/bottlenecks +# without setting the user, git does not allow to create a commit +git config --global user.email "verified@opnfv.org" +git config --global user.name "Dovetail" + +git am $(dirname $0)/0001-Allow-change-ram_num-when-enable-DPDK.patch + +cp utils/infra_setup/runner/yardstick.py /usr/local/lib/python2.7/dist-packages/utils/infra_setup/runner/yardstick.py + +exit 0 -- cgit 1.2.3-korg