def test(server_node, client_node): print client_node, "->", server_node server_pod_name = "server-" + "-".join(server_node.split(".")) PodBuilder(server_pod_name, namespace).add_container( name=server_pod_name + "-container", image=image, args=server_args, limits=glimit, requests=grequest, ports=[ server_port ]).set_node(server_node).attache_service(server_service).deploy() # wait for server pod running wait_for_pod_state(namespace, server_pod_name, timeout=600, expect_status=RUNNING) time.sleep(3) # get server pod ip server_pod_ip = get_pod_ip(namespace, server_pod_name) run_client(client_node, server_node, server_pod_ip) run_client(client_node, server_node, global_server_name) delete_pod(namespace, server_pod_name) wait_for_pod_state(namespace, server_pod_name, timeout=240, expect_status=NOT_FOUND)
def test(node): print node pod_name = "fio-" + "-".join(node.split(".")) reports = [] for n, v in volumes.items(): print n for e in io_engines: print e PodBuilder( pod_name, namespace, ).set_node(node).add_container(pod_name + "-container", image=image, args=args, limits={ 'cpu': '1', 'memory': '2Gi' }, requests={ 'cpu': '0', 'memory': '0' }, volumes=[v], FIO_DIR=FIO_DIR, IOENGINE=e, FILE_SIZE="64g").deploy() # wait to complete wait_for_pod_state(namespace, pod_name, timeout=3600, expect_status=SUCCEEDED) logs = tail_pod_logs(namespace, pod_name).strip() # delete the pod delete_pod(namespace, pod_name) wait_for_pod_state(namespace, pod_name, timeout=240, expect_status=NOT_FOUND) # report = json.loads(logs) report = eval(logs) for job in report["jobs"]: print "READ:", job['read']['bw'], "KB/s" print "WRITE:", job['write']['bw'], "KB/s" reports.append({ "vtype": n, "io_engine": e, "read(KB/s)": report["jobs"][0]['read']['bw'], "write(KB/S)": report["jobs"][0]['write']['bw'] }) return reports
def stress_pv_fio(): pvc_name = "myfiopvc" for i in range(1000): print "round", i pvc = PVCBuilder(pvc_name, namespace) pv = HostPVBuilder("100Gi", "myfiopv") pv.attach_pvc(pvc) pv.deploy("/mnt/mypv/mydata/") pvc.deploy() time.sleep(5) print "PV/PVC created, creat pod now" hostpath_pvc = HostPathPVCVolume('pvcvolume', FIO_DIR, pvc_name) pod_name = "hostpathpvfiotest" pod = PodBuilder(pod_name, namespace).set_node("10.19.137.159").add_container( pod_name, image=fio_image, args=fio_args, requests={ 'cpu': '0', 'memory': '0' }, limits={ 'cpu': '0', 'memory': '0' }, volumes=[hostpath_pvc], FIO_DIR=FIO_DIR, IOENGINE="mmap", FILE_SIZE='64g') pod.deploy() wait_for_pod_state(namespace, pod_name, timeout=600, expect_status=RUNNING) time.sleep(120) # delete the pod delete_pod(namespace, pod_name) wait_for_pod_state(namespace, pod_name, timeout=240, expect_status=NOT_FOUND) pvc.un_deploy() pv.un_deploy()
def un_deploy(): delete_pod(namespace, name) wait_for_pod_state(namespace, name, 60, NOT_FOUND)
def un_deploy(name): delete_pod(namespace, name)