Merge "dovetail tool: Bugfix about the prepare_env of yardstick and get the yardstick...
authorhongbo tian <hongbo.tianhongbo@huawei.com>
Wed, 22 Mar 2017 09:18:57 +0000 (09:18 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Wed, 22 Mar 2017 09:18:57 +0000 (09:18 +0000)
1  2 
dovetail/conf/yardstick_config.yml
dovetail/container.py

@@@ -2,12 -2,16 +2,12 @@@
  yardstick:
    image_name: opnfv/yardstick
    docker_tag: latest
 -  envs: '-e INSTALLER_TYPE=compass -e INSTALLER_IP=192.168.200.2
 -         -e NODE_NAME=dovetail-pod -e DEPLOY_SCENARIO=ha_nosdn
 -         -e BUILD_TAG=dovetail -e CI_DEBUG=true -e DEPLOY_TYPE=baremetal
 -         -e EXTERNAL_NETWORK=ext-net'
    opts: '-id --privileged=true'
    pre_condition:
-     - 'source /home/opnfv/repos/yardstick/tests/ci/prepare_env.sh &&
-          source /home/opnfv/repos/yardstick/tests/ci/clean_images.sh && cleanup'
-     - 'source /home/opnfv/repos/yardstick/tests/ci/prepare_env.sh &&
-          cd /home/opnfv/repos/yardstick && source tests/ci/load_images.sh'
+     - 'cd /home/opnfv/repos/yardstick && source tests/ci/prepare_env.sh &&
+          source tests/ci/clean_images.sh && cleanup'
+     - 'cd /home/opnfv/repos/yardstick && source tests/ci/prepare_env.sh &&
+          source tests/ci/load_images.sh'
    cmds:
      - 'mkdir -p /home/opnfv/yardstick/results/'
      - 'cd /home/opnfv/repos/yardstick && source tests/ci/prepare_env.sh &&
@@@ -56,31 -57,13 +56,34 @@@ class Container(object)
              cls.logger.error("File %s is not exist", dovetail_config['openrc'])
              return None
  
 +        # This is used for showing the debug logs of the upstream projects
 +        envs = ' -e CI_DEBUG=true'
 +
 +        # These are all just used by Functest's function push_results_to_db
 +        if type.lower() == "functest":
 +            ins_type = " -e INSTALLER_TYPE=vendor-specific"
 +            scenario = " -e DEPLOY_SCENARIO=default"
 +            node = " -e NODE_NAME=default"
 +            tag = " -e BUILD_TAG=daily-master-001"
 +
 +            envs = "%s %s %s %s %s" % (envs, ins_type, scenario, node, tag)
 +
 +        if type.lower() == "yardstick":
 +            ext_net = dt_utils.get_ext_net_name(dovetail_config['openrc'],
 +                                                cls.logger)
 +            if ext_net:
 +                envs = "%s%s%s" % (envs, " -e EXTERNAL_NETWORK=", ext_net)
 +            else:
 +                cls.logger.error("Can't find any external network.")
 +                return None
 +
          result_volume = ' -v %s:%s ' % (dovetail_config['result_dir'],
                                          dovetail_config[type]['result']['dir'])
-         cmd = 'sudo docker run %s %s %s %s %s %s /bin/bash' % \
-             (opts, envs, sshkey, openrc, result_volume, docker_image)
+         log_volume = ' -v %s:%s ' % (dovetail_config['result_dir'],
+                                      dovetail_config[type]['result']['log'])
+         cmd = 'sudo docker run %s %s %s %s %s %s %s /bin/bash' % \
+             (opts, envs, sshkey, openrc, result_volume,
+              log_volume, docker_image)
          dt_utils.exec_cmd(cmd, cls.logger)
          ret, container_id = \
              dt_utils.exec_cmd("sudo docker ps | grep " + docker_image +