From ed7f8ee3697be3751dc6cfb243cc55092ddd1dd5 Mon Sep 17 00:00:00 2001 From: xudan Date: Thu, 25 May 2017 04:35:18 -0400 Subject: Change the directories of results and some files to DOVETAIL_HOME JIRA: DOVETAIL-438 1. Need an env variable DOVETAIL_HOME in env_config.sh 2. env_config.sh, pod.yaml and id_rsa should be put in path DOVETAIL_HOME/pre_config 3. the results will also be put in this path 4. no need to give the path of openstack credential file while running a testsuite 5. if running with the code, source the env_config.sh file before running source $DOVETAIL_HOME/env_config.sh dovetail run --testsuite 6. if running with Dovetail docker image docker run -it --privileged=true -e DOVETAIL_HOME= -v : -v /var/run/docker.sock:/var/run/docker.sock opnfv/dovetail:latest /bin/bash Change-Id: Ia23078f27a34e293d0075e49c673930f41069cb6 Signed-off-by: xudan --- dovetail/container.py | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'dovetail/container.py') diff --git a/dovetail/container.py b/dovetail/container.py index d91c184b..c0a925e9 100644 --- a/dovetail/container.py +++ b/dovetail/container.py @@ -49,7 +49,8 @@ class Container(object): @classmethod def openrc_volume(cls, type): dovetail_config = dt_cfg.dovetail_config - dovetail_config['openrc'] = os.path.abspath(dovetail_config['openrc']) + dovetail_config['openrc'] = os.path.join(dovetail_config['config_dir'], + dovetail_config['env_file']) if os.path.isfile(dovetail_config['openrc']): openrc = ' -v %s:%s ' % (dovetail_config['openrc'], dovetail_config[type]['openrc']) @@ -106,9 +107,22 @@ class Container(object): log_vol = '-v %s:%s ' % (dovetail_config['result_dir'], dovetail_config["yardstick"]['result']['log']) - key_path = os.path.join(dovetail_config['userconfig_dir'], 'id_rsa') - key_con_path = dovetail_config["yardstick"]['result']['key_path'] - key_vol = '-v %s:%s ' % (key_path, key_con_path) + + # for yardstick, support pod.yaml configuration + pod_file = os.path.join(dovetail_config['config_dir'], + dovetail_config['pod_file']) + if not os.path.isfile(pod_file): + cls.logger.error("File %s doesn't exist.", pod_file) + return None + key_file = os.path.join(dovetail_config['config_dir'], + dovetail_config['pri_key']) + key_container_path = dovetail_config["yardstick"]['result']['key_path'] + if not os.path.isfile(key_file): + cls.logger.debug("Key file %s is not found, maybe can use passwd " + "method in %s to do HA test.", key_file, pod_file) + key_vol = '' + else: + key_vol = '-v %s:%s ' % (key_file, key_container_path) return "%s %s %s" % (envs, log_vol, key_vol) @classmethod @@ -137,17 +151,8 @@ class Container(object): return None # for refstack, support user self_defined configuration - # for yardstick, support pod.yaml configuration - pod_file = os.path.join(dovetail_config['userconfig_dir'], 'pod.yaml') - if type.lower() == "yardstick" and not os.path.exists(pod_file): - cls.logger.error("File %s doesn't exist.", pod_file) - return None - key_file = os.path.join(dovetail_config['userconfig_dir'], 'id_rsa') - if type.lower() == "yardstick" and not os.path.exists(key_file): - cls.logger.debug("File %s doesn't exist.", key_file) - cls.logger.debug("Can just use password in %s.", pod_file) config_volume = \ - ' -v %s:%s ' % (dovetail_config['userconfig_dir'], + ' -v %s:%s ' % (os.getenv("DOVETAIL_HOME"), dovetail_config[type]['config']['dir']) hosts_config = "" -- cgit 1.2.3-korg