コード例 #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():
    clear_result()
    CREATE_ARRAY_BASIC_1.execute()
    list1 = cli.array_info("")
    ibofos.exit_ibofos()
    ibofos.start_ibofos()
    cli.scan_device()
    cli.load_array("")
    list2 = cli.array_info("")
    return list1, list2
コード例 #3
0
def execute():
    clear_result()
    CREATE_ARRAY_BASIC_2.execute()
    list1 = cli.array_info(ARRAY_NAME)
    ibofos.exit_ibofos()
    ibofos.start_ibofos()
    cli.scan_device()
    out = cli.load_array(ARRAY_NAME)
    print(out)
    list2 = cli.array_info(ARRAY_NAME)
    return list1, list2
コード例 #4
0
def check_result():
    out = cli.array_info(ARRAYNAME)
    state = json_parser.get_state(out)
    if state == "NORMAL":
        list = cli.array_info(ARRAYNAME)
        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
コード例 #5
0
def execute():
    clear_result()
    MOUNT_ARRAY_NO_SPARE_3.execute()
    ibofos_util.pci_detach(MOUNT_ARRAY_NO_SPARE_3.DATA_DEV_1)
    time.sleep(2)
    ibofos_util.pci_detach(MOUNT_ARRAY_NO_SPARE_3.DATA_DEV_2)
    time.sleep(2)
    ibofos_util.pci_detach(MOUNT_ARRAY_NO_SPARE_3.DATA_DEV_3)
    time.sleep(2)
    cli.array_info(MOUNT_ARRAY_NO_SPARE_3.ARRAYNAME)
    out = cli.add_device(SPARE_DEV, MOUNT_ARRAY_NO_SPARE_3.ARRAYNAME)
    return out
コード例 #6
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
コード例 #7
0
def execute():
    clear_result()
    MOUNT_ARRAY_BASIC_1.execute()
    ibofos_util.pci_detach(MOUNT_ARRAY_BASIC_1.ANY_DATA)
    time.sleep(0.5)
    print(cli.list_device())
    ibofos_util.pci_detach(MOUNT_ARRAY_BASIC_1.ANY_OTHER_DATA)

    out = cli.unmount_ibofos()
    print(out)

    cur_info = json.loads(cli.array_info(""))
    cur_state = cur_info['Response']['info']['situation']
    print(cur_state)
    if cur_state != 'FAULT':
        print("STOP State is not triggered, try again")
        return cur_info
    wait_time = 20
    for i in reversed(range(wait_time)):
        print("Wait to cancel rebuild " + str(i) + " seconds left")
        time.sleep(1)

    out = cli.unmount_ibofos()
    print(out)
    return out
コード例 #8
0
def do_event(elapsed_hour):
    if elapsed_hour == 0:
        ret = init_test()
        if ret == True:
            for i in range(MAX_VOL_CNT):
                if add_new_vol_and_do_io() == False:
                    return False
                time.sleep(1)
            return check_state("NORMAL")
        return False

    elif elapsed_hour >= 1 and elapsed_hour <= 11:
        return check_state("NORMAL")

    elif elapsed_hour == 12:
        print (cli.array_info(""))
        detach_data(DEV_1)
        if wait_until_rebuild_start() == True:
            rebuild_start_time = datetime.now()
            if wait_until_rebuild_done() == True:
                duration = datetime.now() - rebuild_start_time
                write_log ("rebuild_duration(sec):" + str(duration.total_seconds()))
        kill_ibofos()
        return True
 
    else:
        write_log ("unaddressed timing")
        return False
コード例 #9
0
ファイル: CHECK_VOL_SPACE.py プロジェクト: yyu-nim/poseidonos
def execute():
    clear_result()
    MOUNT_VOL_BASIC_1.execute()
    out = cli.array_info(ARRAYNAME)
    used = json_parser.get_used(out)
    cli.unmount_array(MOUNT_VOL_BASIC_1.ARRAYNAME)
    cli.mount_array(MOUNT_VOL_BASIC_1.ARRAYNAME)
    return used
コード例 #10
0
ファイル: CHECK_VOL_SPACE.py プロジェクト: yyu-nim/poseidonos
def set_result(expected):
    out = cli.array_info(ARRAYNAME)
    used = json_parser.get_used(out)
    result = "fail"
    if used != 0 and used == expected:
        result = "pass"
    with open(__file__ + ".result", "w") as result_file:
        result_file.write(result + " (0)" + "\n" + out)
コード例 #11
0
def execute():
    ADD_SPARE_BASIC.execute()
    cli.unmount_array(ADD_SPARE_BASIC.ARRAYNAME)
    pos.exit_pos()
    pos.start_pos()
    cli.scan_device()
    cli.mount_array(ADD_SPARE_BASIC.ARRAYNAME)
    out = cli.array_info(ADD_SPARE_BASIC.ARRAYNAME)
    return out
コード例 #12
0
def execute():
    EXIT_POS_AFTER_UNMOUNT_VOL.execute()
    time.sleep(5)
    ibofos_mbr_reset = POS_ROOT + "/test/script/mbr_reset.sh"
    subprocess.call([ibofos_mbr_reset])
    pos.start_pos()
    cli.scan_device()
    out = cli.array_info(EXIT_POS_AFTER_UNMOUNT_VOL.ARRAYNAME)
    return out
コード例 #13
0
def execute():
    clear_result()
    MOUNT_ARRAY_BASIC.execute()
    out = cli.array_info(ARRAYNAME)
    capacity = json_parser.get_capacity(out)
    print("capa: " + str(capacity))
    size = capacity + pos_constant.SIZE_1GB
    out = cli.create_volume("vol1", str(size), "", "", ARRAYNAME)
    return out
コード例 #14
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
コード例 #15
0
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(ARRAYNAME)
        result = check_result(out)
    
    with open(__file__ + ".result", "w") as result_file:
        result_file.write(result + " (" + str(code) + ")" + "\n" + out)
コード例 #16
0
def check_result():
    out = cli.get_ibofos_info()
    data = json.loads(out)
    if data['Response']['info']['situation'] == "NORMAL":
        list = cli.array_info("")
        data = json.loads(list)
        for item in data['Response']['result']['data']['devicelist']:
            if item['name'] == DETACH_TARGET_DEV :
                return "fail", list
        return "pass", out
    return "fail", out
コード例 #17
0
def execute():
    clear_result()
    ADD_DEV_BASIC_1.execute()
    cli.unmount_ibofos()
    ibofos.exit_ibofos()
    ibofos.start_ibofos()
    cli.scan_device()
    cli.load_array("")
    cli.mount_ibofos()
    out = cli.array_info("")
    return out
コード例 #18
0
def set_result(detail):
    code = json_parser.get_response_code(detail)
    if code == 0:
        out = cli.array_info("")
        result = check_result(out)
    else:
        result = "fail"
        out = detail

    with open(__file__ + ".result", "w") as result_file:
        result_file.write(result + " (" + str(code) + ")" + "\n" + out)
コード例 #19
0
def set_result():
    out = cli.array_info(ARRAYNAME)
    code = json_parser.get_response_code(out)
    result = "fail"
    if code == 0:
        state = json_parser.get_state(out)
        capacity = json_parser.get_capacity(out)
        used = json_parser.get_used(out)
        if state == "NORMAL" and capacity != 0 and used != 0 and used <= capacity:
            result = "pass"
    with open(__file__ + ".result", "w") as result_file:
        result_file.write(result + " (" + str(code) + ")" + "\n" + out)
コード例 #20
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)
コード例 #21
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)
コード例 #22
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)
コード例 #23
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)
コード例 #24
0
import api
import json
import MOUNT_VOL_BASIC_1
import fio
import time

DETACH_TARGET_DEV = MOUNT_VOL_BASIC_1.ANY_DATA
SECOND_DETACH_TARGET_DEV = MOUNT_VOL_BASIC_1.SPARE
ARRAYNAME = MOUNT_VOL_BASIC_1.ARRAYNAME


def execute():
    MOUNT_VOL_BASIC_1.execute()
    fio_proc = fio.start_fio(0, 60)
    fio.wait_fio(fio_proc)
    api.detach_ssd(DETACH_TARGET_DEV)

    if api.wait_situation(ARRAYNAME, "REBUILDING") is True:
        api.detach_ssd(SECOND_DETACH_TARGET_DEV)
        timeout = 80000  #80s
        if api.wait_situation(ARRAYNAME, "DEGRADED", timeout) is True:
            return "pass"
    return "fail"


if __name__ == "__main__":
    api.clear_result(__file__)
    result = execute()
    ret = api.set_result_manually(cli.array_info(ARRAYNAME), result, __file__)
    pos.kill_pos()
    exit(ret)
コード例 #25
0
def check_result():
    out = cli.array_info(ARRAYNAME)
    if json_parser.is_online(out) == False:
        return "pass"
    return "fail"
コード例 #26
0
def get_situation():
    out = cli.array_info(ARRAYNAME)
    situ = json_parser.get_situation(out)
    return situ
コード例 #27
0
def check_result():
    out = cli.array_info(ARRAYNAME)
    situ = json_parser.get_situation(out)
    if situ == "FAULT":
        return "pass"
    return "fail"
コード例 #28
0
def check_result():
    out = cli.array_info(ARRAYNAME)
    state = json_parser.get_state(out)
    if state == "NORMAL":
        return "pass", out
    return "fail", out
コード例 #29
0
def execute():
    DELETE_ARRAY_WITH_VOL.execute()
    cli.create_array("uram0", DATA, SPARE, ARRAYNAME, "")
    cli.mount_array(ARRAYNAME)
    out = cli.array_info(ARRAYNAME)
    return out
コード例 #30
0
def get_state():
    out = cli.array_info(ARRAYNAME)
    state = json_parser.get_state(out)
    return state