def execute(): MOUNT_VOL_BASIC_1.execute() fio_proc = fio.start_fio(0, 20) fio.wait_fio(fio_proc) pos_util.pci_detach(DETACH_TARGET_DEV) time.sleep(5) fio_proc = fio.start_fio(0, 20) fio.wait_fio(fio_proc) rebuild_started = False wait_threshold = 60 for i in range(0, wait_threshold): out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ.find("REBUILD") >= 0: print ("rebuilding started") rebuild_started = True break time.sleep(1) if rebuild_started == True: fio_proc2 = fio.start_fio(0, 120) while True: out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ.find("REBUILD") == -1: print ("rebuilding done") fio.wait_fio(fio_proc2) break
def execute(): MOUNT_VOL_BASIC_1.execute() fio_proc = fio.start_fio(0, 200) time.sleep(10) pos_util.pci_detach_and_attach(DETACH_TARGET_DEV) detach_dev_timeout = 80 time.sleep(detach_dev_timeout) print(cli.list_device()) spare_dev_newly_attached = "unvme-ns-4" result = cli.add_device(spare_dev_newly_attached, ARRAYNAME) code = json_parser.get_response_code(result) if code == 0: print("device added successfully") rebuild_trigger_timeout = 100 rebuild_started = False for i in range(rebuild_trigger_timeout): out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ.find("REBUILD") >= 0: print("rebuilding started") rebuild_duration = 5 time.sleep(rebuild_duration) rebuild_started = True break time.sleep(1) if rebuild_started == False: fio.stop_fio(fio_proc) return False pos_util.pci_detach_and_attach(MOUNT_VOL_BASIC_1.SPARE) #waiting for rebuild stopped print("Waiting for rebuild stopped") rebuild_stop_delay = 60 time.sleep(rebuild_stop_delay) rebuild_started = False while True: out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ.find("REBUILD") == -1 and rebuild_started == True: print("2nd rebuilding done") fio.wait_fio(fio_proc) return True elif rebuild_started == False and situ.find("REBUILD") >= 0: print("2nd rebuilding started") rebuild_started = True time.sleep(1) else: print("device added failure") fio.stop_fio(fio_proc) return False
def check_result(): out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ == "DEGRADED": data = json.loads(out) for item in data['Response']['result']['data']['devicelist']: if item['name'] == DETACH_TARGET_DEV: return "fail", out return "pass", out return "fail", out
def set_result(detail): code = json_parser.get_response_code(detail) result = test_result.expect_true(code) if result == "pass": out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ.find("REBUILD") >= 0: result = "pass" else: result = "fail" with open(__file__ + ".result", "w") as result_file: result_file.write(result + " (" + str(code) + ")" + "\n" + detail)
def execute(): DETACH_DEV_DATA_AND_DEGRADED_IO.execute() out = cli.add_device(NEW_SPARE, ARRAYNAME) rebuild_started = False while True: out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ.find("REBUILD") == -1 and rebuild_started == True: print ("rebuilding done") break elif rebuild_started == False and situ.find("REBUILD") >= 0: print ("rebuilding started") rebuild_started = True time.sleep(1)
def execute(): MOUNT_VOL_BASIC_1.execute() fio_proc = fio.start_fio(0, 60) fio.wait_fio(fio_proc) pos_util.pci_detach(DETACH_TARGET_DEV) time.sleep(0.1) while True: out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ.find("REBUILD") >= 0: print("rebuilding started") pos_util.pci_detach_and_attach(SECOND_DETACH_TARGET_DEV) break time.sleep(1) timeout = 80 for i in range(timeout): out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ.find("REBUILD") < 0: break time.sleep(1)
def execute(): MOUNT_VOL_BASIC_1.execute() fio_proc = fio.start_fio(0, 120) time.sleep(10) pos_util.pci_detach(DETACH_TARGET_DEV) time.sleep(0.1) rebuild_started = False while True: out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ.find("REBUILD") == -1 and rebuild_started == True: print("rebuilding done") fio.wait_fio(fio_proc) break elif rebuild_started == False and situ.find("REBUILD") >= 0: print("rebuilding started") rebuild_started = True time.sleep(1)
def check_result(): out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) if situ == "FAULT": return "pass" return "fail"
def get_situation(): out = cli.array_info(ARRAYNAME) situ = json_parser.get_situation(out) return situ
def check_result(detail): situ = json_parser.get_situation(detail) if situ == "DEGRADED": return "pass" return "fail"