From 4c27a6b94a0664418664569384ce236159385c71 Mon Sep 17 00:00:00 2001 From: MofassirArif Date: Thu, 28 Jan 2016 04:29:29 -0800 Subject: qtip: add condition for switching user to joid. Change-Id: I9898a4eb21fb197a59fc72686d156eb4ef115388 Signed-off-by: MofassirArif --- benchmarks/playbooks/dhrystone.yaml | 3 ++- benchmarks/playbooks/dpi.yaml | 5 +++- benchmarks/playbooks/fio.yaml | 3 ++- benchmarks/playbooks/iperf.yaml | 2 ++ benchmarks/playbooks/ramspeed.yaml | 3 ++- benchmarks/playbooks/ssl.yaml | 8 ++---- benchmarks/playbooks/whetstone.yaml | 3 ++- data/hosts | 6 ++--- data/my_key.pem | 50 ++++++++++++++++++------------------- func/cli.py | 10 +++++++- func/driver.py | 10 ++++++-- qtip.py | 2 +- test_list/compute | 18 +++++++------ test_list/network | 2 +- 14 files changed, 73 insertions(+), 52 deletions(-) diff --git a/benchmarks/playbooks/dhrystone.yaml b/benchmarks/playbooks/dhrystone.yaml index c3cfb333..3c1c7fb2 100644 --- a/benchmarks/playbooks/dhrystone.yaml +++ b/benchmarks/playbooks/dhrystone.yaml @@ -7,7 +7,8 @@ file: path={{workingdir}}/{{Dest_dir}}/dhrystone/dhrystone_temp state=directory - hosts: "{{role}}" - + become: yes + become_user: "{{username}}" tasks: - name: checking_home directory shell: echo $HOME diff --git a/benchmarks/playbooks/dpi.yaml b/benchmarks/playbooks/dpi.yaml index 19ab30ce..e4b7a0fc 100644 --- a/benchmarks/playbooks/dpi.yaml +++ b/benchmarks/playbooks/dpi.yaml @@ -7,8 +7,11 @@ file: path={{workingdir}}/{{Dest_dir}}/dpi/dpi_temp state=directory - hosts: "{{role}}" + become: yes + become_user: "{{username}}" tasks: - + - name: echo + shell: echo $USER - name: checking_home directory shell: echo $HOME register: home_dir diff --git a/benchmarks/playbooks/fio.yaml b/benchmarks/playbooks/fio.yaml index 7162dc3b..4f8697c3 100644 --- a/benchmarks/playbooks/fio.yaml +++ b/benchmarks/playbooks/fio.yaml @@ -9,7 +9,8 @@ - hosts: "{{role}}" tasks: - + become: yes + become_user: "{{username}}" - name: checking_home directory shell: echo $HOME register: home_dir diff --git a/benchmarks/playbooks/iperf.yaml b/benchmarks/playbooks/iperf.yaml index d6bc00ed..f139ff61 100644 --- a/benchmarks/playbooks/iperf.yaml +++ b/benchmarks/playbooks/iperf.yaml @@ -12,6 +12,8 @@ - hosts: "{{role}}" + become: yes + become_user: "{{username}}" tasks: - name: Rolename set_fact: diff --git a/benchmarks/playbooks/ramspeed.yaml b/benchmarks/playbooks/ramspeed.yaml index 1d45f028..0810946a 100644 --- a/benchmarks/playbooks/ramspeed.yaml +++ b/benchmarks/playbooks/ramspeed.yaml @@ -9,7 +9,8 @@ - hosts: "{{role}}" tasks: - + become: yes + become_user: "{{username}}" - name: checking_home directory shell: echo $HOME register: home_dir diff --git a/benchmarks/playbooks/ssl.yaml b/benchmarks/playbooks/ssl.yaml index 9416bb38..9ba16455 100644 --- a/benchmarks/playbooks/ssl.yaml +++ b/benchmarks/playbooks/ssl.yaml @@ -1,16 +1,14 @@ - hosts: 127.0.0.1 connection: local - remote_user: '{{ ansible_env.USER }}' - sudo: no tasks: - name: making ssl directory file: path={{workingdir}}/{{Dest_dir}}/ssl state=directory - name: making temporary ssl directory file: path={{workingdir}}/{{Dest_dir}}/ssl/ssl_temp state=directory - hosts: "{{role}}" - remote_user: root + become: yes + become_user: "{{username}}" tasks: - - name: checking_home directory shell: echo $HOME register: home_dir @@ -73,8 +71,6 @@ - hosts: 127.0.0.1 connection: local - remote_user: '{{ ansible_env.USER }}' - sudo: no tasks: - name: echo shell: echo $PWD diff --git a/benchmarks/playbooks/whetstone.yaml b/benchmarks/playbooks/whetstone.yaml index 599b98f3..7f062264 100644 --- a/benchmarks/playbooks/whetstone.yaml +++ b/benchmarks/playbooks/whetstone.yaml @@ -9,7 +9,8 @@ - hosts: "{{role}}" tasks: - + become: yes + become_user: "{{username}}" - name: storing_home shell: echo $HOME register: home_dir diff --git a/data/hosts b/data/hosts index 5efc7cb9..03db0db9 100644 --- a/data/hosts +++ b/data/hosts @@ -1,3 +1,3 @@ -[host] -172.18.1.39 -172.18.1.38 +[1Run] +10.20.0.5 +10.20.0.4 diff --git a/data/my_key.pem b/data/my_key.pem index c08dbd79..89c1a927 100644 --- a/data/my_key.pem +++ b/data/my_key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAwyZbVfdEZYsvX8x8cfuFzIlI1yIFOuLRxpW+A+AVQjBRHsJP -VIq27x9gIsHFC18jc5LyCOFpDC1k6TUhgDVwGTaY5CSD/D9JkYb8XxlbpvNQ/Hh8 -VCS5aeqGrFloho9hqKR9KLgrOBfKO5bQJLvmw4BpR8clRTHwfoQB90DHTpBJ3zLh -FedTKQb3keaE2xLv+fP5pRNPdLT8HIHR+DSMkk/k7k2wbHoEIBLoM/ehm9TTDpHw -FyrEdIs390t6yyKWFP0fMDI+QNkISkq1n6QNBXgq6ySUd5/Sn5UmlMtpKTab+qCc -FiB2YzazZQbc9+uespIlDnw4tF9+//r6A2NlPwIDAQABAoIBAHMaaZ7v5HC8QqoP -k4srXsTAaK0zjMApzq+B3PyuK/vJQd+RnnbwBmxOJkb54X4OlHtzvbyNL4eWMsH2 -q5bSbhcBA/b0rsCWl471fl+dNljnhOoVKsf6jT4yrVJ0vdk4MtLkikn9Lsi8B3VU -Q9qW1cqUMAS9KneAuCf3Nq2ekK/+FVjHCetEW27huP7tJ2Khd3rZmkEsJaqZEVuQ -42g1iGFdrR5zcMLEFI9LkbwCQYg2UXsa7GNu02OJ6olCVswrGgeGaie+y6UkwgX+ -rcWSm/ognBUmnFrXPuplABGvfVDfcwTGfs1iKiD+QbzB9xxEDxoUmX0FMK0KF9Zd -cLqUTZECgYEA3/EHv1W+wrkaCwQM2LX7UBTEXcnOL66byl6Yn3YmpfGB/pnuiZX6 -pDz6tuYgceXsHcv9wz9txpqmm4IJH+Gyowcs/mTqnQjGUTGdGruLkpDvG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PJRJ6e3rMWr/E+W +kcAppiQtnTRjrI3n1N37ptQ1s8HwqbuUi8iQ/6sjU8spXP+r0/8dAC6bl4o57zh1 +HNzkSwKBgQDRUMV2/06nfFC4zwvGzfx2hk96oNFws52GqNS2+7iVLvCC1E2wctIy +y0HZ8CWg4Fi/ctFHPl7OwNkZ0Gf8AaLHOhgCpJRxKqmz/ehJs8ewNQBNsFOftQX3 +dtJD662D08MsHRZ4eynDOkihuE/d2k8TGOj53i/ZH2g7lrspQ54Qew== -----END RSA PRIVATE KEY----- diff --git a/func/cli.py b/func/cli.py index 9b140874..a99e9d0f 100644 --- a/func/cli.py +++ b/func/cli.py @@ -43,6 +43,10 @@ class cli(): else: return False + def _get_fname(self,file_name): + + return file_name[0: file_name.find('.')] + def __init__(self): suite=[] @@ -93,7 +97,11 @@ class cli(): obj.callsshtest() obj.updateAnsible() dvr = Driver() - dvr.drive_bench(benchmark, obj.roles_dict.items(), benchmark_details, obj.ip_pw_dict.items()) + dvr.drive_bench(benchmark, + obj.roles_dict.items(), + self._get_fname(benchmarks[items]), + benchmark_details, + obj.ip_pw_dict.items()) else: print (args.benchmark, ' is not a Template in the Directory - \ Enter a Valid file name. or use qtip.py -h for list') diff --git a/func/driver.py b/func/driver.py index 9f7db237..3c3b75c0 100644 --- a/func/driver.py +++ b/func/driver.py @@ -21,7 +21,7 @@ class Driver: print os.environ['PWD'] self.dic_json = defaultdict() - def drive_bench(self, benchmark, roles, benchmark_detail = None, pip_dict = None): + def drive_bench(self, benchmark, roles, benchmark_fname, benchmark_detail = None, pip_dict = None): roles= sorted(roles) pip_dict = sorted(pip_dict) @@ -32,6 +32,12 @@ class Driver: self.dic_json['ip2']='' self.dic_json['installer']=str(os.environ['INSTALLER_TYPE']) self.dic_json['workingdir']=str(os.environ['PWD']) + self.dic_json['fname']=str(benchmark_fname) + self.dic_json['username']= str('root') + + if os.environ['INSTALLER_TYPE'] == str('joid'): + self.dic_json['username']=str('ubuntu') + for k,v in benchmark_detail: self.dic_json[k]=v for k, v in roles: @@ -49,5 +55,5 @@ class Driver: index= index+1 dic_json = json.dumps(dict(self.dic_json.items())) print dic_json - run_play = 'ansible-playbook -s ./benchmarks/playbooks/{0} --private-key=./data/QtipKey -i ./data/hosts --extra-vars \'{1}\' -v '.format(benchmark_name, dic_json) + run_play = 'ansible-playbook ./benchmarks/playbooks/{0} --private-key=./data/QtipKey -i ./data/hosts --extra-vars \'{1}\' -v'.format(benchmark_name, dic_json) status = os.system(run_play) diff --git a/qtip.py b/qtip.py index c540d700..0844ff12 100644 --- a/qtip.py +++ b/qtip.py @@ -18,7 +18,7 @@ def main(): os.system('cd data/ref_results && python compute_suite.py') os.system('cd data/ref_results && python storage_suite.py') os.system('cd data/ref_results && python network_suite.py') - os.system('cd data/report && python Qtip_Report.py') +# os.system('cd data/report && python Qtip_Report.py') if __name__ == "__main__": main() diff --git a/test_list/compute b/test_list/compute index 044d8de6..7fc76145 100644 --- a/test_list/compute +++ b/test_list/compute @@ -1,8 +1,10 @@ -dhrystone_bm.yaml -dhrystone_vm.yaml -whetstone_bm.yaml -whetstone_vm.yaml -ssl_bm.yaml -ssl_vm.yaml -dpi_bm.yaml -dpi_vm.yaml +dhrystone_bm.yaml +dhrystone_vm.yaml +whetstone_bm.yaml +whetstone_vm.yaml +ramspeed_bm.yaml +ramspeed_vm.yaml +dpi_bm.yaml +dpi_vm.yaml +ssl_bm.yaml +ssl_vm.yaml \ No newline at end of file diff --git a/test_list/network b/test_list/network index c468f815..677f2ba4 100644 --- a/test_list/network +++ b/test_list/network @@ -1,3 +1,3 @@ iperf_bm.yaml iperf_vm.yaml -iperf_vm_2.yaml +iperf_vm_2.yaml \ No newline at end of file -- cgit 1.2.3-korg