From e2c76aaf3305b695dd415ae6e6d0ad5bc6e02db4 Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Fri, 3 Sep 2021 12:12:33 -0700 Subject: [PATCH] LU-10973 lutf: use configured tmp directory for tar After the LUTF run is done all the test results on all the agent nodes need to be tarred, in order to make them available for review later on. Don't assume the lutf tmp files are in /tmp/lutf. Use the tmp-dir directory configured in the lutf configuration. Add the master only once to the agent list. Pass PYTHOPATH to agent. Test-Parameters: trivial Signed-off-by: Amir Shehata Change-Id: Ic3effcb53f7d27bf31b6adfd8a22900767ff9524 Reviewed-on: https://review.whamcloud.com/44843 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Serguei Smirnov Reviewed-by: Oleg Drokin --- lustre/tests/lutf/python/config/lutf_start.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lustre/tests/lutf/python/config/lutf_start.py b/lustre/tests/lutf/python/config/lutf_start.py index f6132a9..d91d259 100644 --- a/lustre/tests/lutf/python/config/lutf_start.py +++ b/lustre/tests/lutf/python/config/lutf_start.py @@ -36,6 +36,7 @@ class LUTF: def __init__(self): self.nodes = {} self.__collect_nodes() + self.__cfg_yaml = {} def __collect_nodes(self): for k in os.environ: @@ -194,6 +195,9 @@ class LUTF: if 'PATH' in os.environ and host != os.environ['HOSTNAME']: cmd += " PATH="+os.environ['PATH'] + if 'PYTHONPATH' in os.environ and host != os.environ['HOSTNAME']: + cmd += " PYTHONPATH="+os.environ['PYTHONPATH'] + # start the LUTF on the remote if cmd: cmd += ' ' @@ -219,15 +223,22 @@ class LUTF: print(e) rc = -22 + self.__cfg_yaml = cfg return cfg, rc def __collect_lutf_logs(self, host): if host != os.environ['HOSTNAME']: rfname = "lutf."+host+".tar.gz" - tmp_dir = cfg['lutf']['tmp-dir'] + tmp_dir = self.__cfg_yaml['lutf']['tmp-dir'] rfpath = os.path.join(os.sep, 'tmp', rfname) - cmd = "tar -czf "+rfpath+" -C "+os.sep+" "+tmp_dir - lutf_exec_remote_cmd(cmd, host); + if tmp_dir[-1] == os.sep: + landing_dir = os.path.split(tmp_dir[:-1])[0] + tar_dir = os.path.split(tmp_dir[:-1])[1] + else: + landing_dir = os.path.split(tmp_dir)[0] + tar_dir = os.path.split(tmp_dir)[1] + cmd = "tar -czf "+rfpath+" -C "+landing_dir+" "+tar_dir + lutf_exec_remote_cmd(cmd, host, ignore_err=True); lutf_get_file(host, rfpath, os.path.join(tmp_dir, rfname)) def run(self): @@ -235,12 +246,12 @@ class LUTF: mname = '' if not os.environ['HOSTNAME'] in list(self.nodes.values()): + i = 1 for k in list(self.nodes.keys()): - i = 1 if 'CLIENTS' in k: i += 1 - key = "CLIENTS"+str(i) - self.nodes[key] = os.environ['HOSTNAME'] + key = "CLIENTS"+str(i) + self.nodes[key] = os.environ['HOSTNAME'] agent_list = list(self.nodes.keys()) if len(agent_list) == 0: -- 1.8.3.1