コード例 #1
0
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
コード例 #2
0
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
コード例 #3
0
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
コード例 #4
0
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)
コード例 #5
0
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)
コード例 #6
0
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)
コード例 #7
0
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)
コード例 #8
0
def check_result():
    out = cli.array_info(ARRAYNAME)
    situ = json_parser.get_situation(out)
    if situ == "FAULT":
        return "pass"
    return "fail"
コード例 #9
0
def get_situation():
    out = cli.array_info(ARRAYNAME)
    situ = json_parser.get_situation(out)
    return situ
コード例 #10
0
def check_result(detail):
    situ = json_parser.get_situation(detail)
    if situ == "DEGRADED":
        return "pass"
    return "fail"