def execute(): clear_result() out = CREATE_ARRAY_BASIC_1.execute() ret = json_parser.get_response_code(out) if ret == 0: out = cli.mount_ibofos() ret = json_parser.get_response_code(out) if ret ==0: out = cli.delete_array("") return out
def set_result(detail): out = detail code = json_parser.get_response_code(detail) result = test_result.expect_false(code) if result == "pass": out = cli.array_info("") code = json_parser.get_response_code(out) result = check_result(out) with open(__file__ + ".result", "w") as result_file: result_file.write(result + " (" + str(code) + ")" + "\n" + out)
def execute(): out = UNMOUNT_ARRAY_WITH_VOL_MOUNTED.execute() ret = json_parser.get_response_code(out) if ret == 0: out = cli.delete_array(UNMOUNT_ARRAY_WITH_VOL_MOUNTED.ARRAYNAME) print(out) return out
def execute(): clear_result() out = DELETE_ARRAY_BASIC_1.execute() ret = json_parser.get_response_code(out) if ret == 0: out = cli.load_array("") return out
def execute(): clear_result() out = CREATE_ARRAY_BASIC_1.execute() ret = json_parser.get_response_code(out) if ret == 0: out = cli.list_array_device("") return out
def set_result(detail): code = json_parser.get_response_code(detail) result = test_result.expect_true(code) if result == "pass": result = check_result(detail) with open(__file__ + ".result", "w") as result_file: result_file.write(result + " (" + str(code) + ")" + "\n" + detail)
def set_result(detail): print ("set result") code = json_parser.get_response_code(detail) result = test_result.expect_false(code) print (result) with open(__file__ + ".result", "w") as result_file: result_file.write(result + " (" + str(code) + ")" + "\n" + detail)
def get_file_size(arrayId, fd): out = cli.send_request("wbt mfs_get_file_size --fd " + str(fd) + " --array " + TEST_SETUP_POS.get_arrayname(arrayId)) if json_parser.get_response_code(out) != 0: return -1 else: return json_parser.get_data_code(out)
def flush_gcov(result): if json_parser.get_response_code(result) != 0: print("* Gcov flush failed, check WBT option") elif json_parser.get_data_code(result) != 0: print("* Gcov flush failed, check gcov option") else: print("* Flush gcov completed")
def scan_device(): out = cli.scan_device() ret = json_parser.get_response_code(out) if ret != 0: TEST_LOG.print_err("Failed to scan device") TEST_LOG.print_debug(out) sys.exit(1)
def set_result(detail): code = json_parser.get_response_code(detail) result = "fail" if code == 2522: result = "pass" with open(__file__ + ".result", "w") as result_file: result_file.write(result + " (" + str(code) + ")" + "\n" + detail)
def flush_gcov(): out = cli.send_request("wbt flush_gcov") if json_parser.get_response_code(out) != 0: TEST_LOG.print_err("* Gcov flush failed, check WBT option") elif json_parser.get_data_code(out) != 0: TEST_LOG.print_info("* Gcov flush failed, check gcov option") else: TEST_LOG.print_info("* Flush gcov completed")
def exit_pos(): out = cli.exit_pos() code = json_parser.get_response_code(out) if code == 0: pos_proc.wait() global isExecuted isExecuted = False return out
def mount_array(): out = cli.mount_ibofos() ret = json_parser.get_response_code(out) if ret != 0: TEST_LOG.print_err("Failed to mount ibofos") TEST_LOG.print_debug(out) sys.exit(1) TEST_LOG.print_info("* POS mounted")
def load_array(): out = cli.load_array("") ret = json_parser.get_response_code(out) if ret != 0: TEST_LOG.print_err("Failed to load array") TEST_LOG.print_debug(out) sys.exit(1) TEST_LOG.print_info("* Array loaded")
def create_array(): out = cli.create_array("uram0", "unvme-ns-0,unvme-ns-1,unvme-ns-2", "unvme-ns-3", "", "") ret = json_parser.get_response_code(out) if ret != 0: TEST_LOG.print_err("Failed to create array") TEST_LOG.print_debug(out) sys.exit(1) TEST_LOG.print_info("* Array created")
def delete_array(arrayId): out = cli.delete_array(get_arrayname(arrayId)) ret = json_parser.get_response_code(out) if ret != 0: TEST_LOG.print_err("Failed to delete array{}".format(arrayId)) TEST_LOG.print_debug(out) sys.exit(1) TEST_LOG.print_info("* {} delete".format(get_arrayname(arrayId)))
def get_checkpoint_status(arrayId=0): out = cli.send_request("wbt get_journal_status --array " + TEST_SETUP_POS.get_arrayname(arrayId)) if json_parser.get_response_code(out) != 0: return -1 else: total_info = json_parser.get_data(out) return total_info["journalStatus"]["checkpointStatus"]["status"]
def dump_log_buffer(arrayId, fd, filesize, dumpfile): out = cli.send_request("wbt mfs_read_file --fd " + str(fd) + " --offset 0 --count " + str(filesize) + " --array " + TEST_SETUP_POS.get_arrayname(arrayId) + " --output " + dumpfile) if json_parser.get_response_code(out) != 0: return -1 return 0
def unmount_ibofos(): out = cli.unmount_ibofos() code = json_parser.get_response_code(out) if code == 0: write_log("array unmounted successfully") return True else: write_log("array unmounting failed code: " + str(code)) return False
def dump_stripemap(dump_file): if TEST.dump_map == False: return out = cli.send_request("wbt read_stripemap --array " + TEST_SETUP_POS.get_arrayname(arrayId) + " --output " + dump_file) if json_parser.get_response_code(out) != 0: return -1
def set_result(detail): code = json_parser.get_response_code(detail) if code == 0: result = check_result(detail) else: result = "fail" with open(__file__ + ".result", "w") as result_file: result_file.write(result + " (" + str(code) + ")" + "\n" + detail)
def get_log_buffer_size(arrayId=0): out = cli.send_request("wbt get_journal_status --array " + TEST_SETUP_POS.get_arrayname(arrayId)) if json_parser.get_response_code(out) != 0: return -1 else: total_info = json_parser.get_data(out) return total_info["journalStatus"]["logBufferStatus"][ "logBufferSizeInBytes"]
def mount_pos(): out = cli.mount_array(ARRAYNAME) code = json_parser.get_response_code(out) if code == 0: write_log("array mounted successfully") return True else: write_log("array mounting failed code: " + str(code)) return False
def add_spare(spare): out = cli.add_device(spare, "") code = json_parser.get_response_code(out) if code == 0: write_log ("Spare device: " + spare + " has been added successfully") return True else: write_log ("Spare device: " + spare + " adding failed, code: " + str(code)) return False
def mount_vol(vol_name): out = cli.mount_volume(vol_name, "", "") code = json_parser.get_response_code(out) if code == 0: write_log("volume: " + vol_name + " mounted successfully") return True else: write_log("volume: " + vol_name + " mounting failed, code: " + str(code)) return False
def create_array(): DATA = DEV_1 + "," + DEV_2 + "," + DEV_3 out = cli.create_array("uram0", DATA, "", "", "") code = json_parser.get_response_code(out) if code == 0: write_log("array created successfully") return True else: write_log("array creation failed, code: " + str(code)) return False
def dump_vsamap(arrayId, volid, dump_file): if TEST.dump_map == False: return volname = TEST_SETUP_POS.get_volname(volid) out = cli.send_request("wbt read_vsamap --name " + volname + " --array " + TEST_SETUP_POS.get_arrayname(arrayId) + " --output " + dump_file) if json_parser.get_response_code(out) != 0: return -1
def create_volume(volumeId, subnqn=""): out = cli.create_volume("vol"+str(volumeId), str(TEST.volSize), "0", "0", "") ret = json_parser.get_response_code(out) if ret != 0: TEST_LOG.print_err("Failed to create volume") TEST_LOG.print_debug(out) sys.exit(1) TEST_LOG.print_info("* Volume {} created".format(volumeId)) mount_volume(volumeId)
def set_result(detail): out = detail code = json_parser.get_response_code(detail) result = test_result.expect_true(code) if result == "pass": out = cli.list_array_device(ARRAYNAME) result = check_result(out) with open(__file__ + ".result", "w") as result_file: result_file.write(result + " (" + str(code) + ")" + "\n" + out)