def start_test_close(vmIpList, host_ip): """vmIpdicts 是字典,key 是 vm_ip,value 是 vm_name""" start_vm(vmIpList[1], host_ip) time.sleep(100) os.system('ssh helen@' + vmIpList[0] + ' ' + '\'cd /home/helen/workspace/test_cpu_script && /bin/sh pretest.sh\'') time.sleep(100) stop_vm(vmIpList[1]) time.sleep(100)
if 'host' in j[1]: host_ip = j[0] for j in i: vmIpList = [] if 'vm' in j[1]: vmIpList.append(j[0]) vmIpList.append(j[1][:-4]) start_test_close(vmIpList, host_ip) time.sleep(30) # 开启所有的虚拟机 for i in machine_info: vm_name = [] for j in i: if 'host' in j[1]: host_ip = j[0] elif 'vm' in j[1]: vm_name.append(j[1][:-4]) else: print 'There is something wrong within it.' for vm in vm_name: start_vm(vm, host_ip) time.sleep(300) # 上传六台机器的测试结果 for i in machine_info: for j in i: scpTestResult(j) draw_test()