Ejemplo n.º 1
0
def mult_thread(func, num, pre_path="/"):
    #    pool = Pool(processes = num)
    thread = []
    results = []
    if pre_path != "/":
        path = pre_path + "/"
        curvefs = swig_operate.LibCurve()
        rc = curvefs.libcurve_statfs(pre_path,
                                     user_name=config.user_name,
                                     pass_word=config.pass_word)
        logger.debug("path is %s" % path)
        parentid = rc.id
    else:
        path = pre_path
        parentid = 0
    for i in xrange(num):
        #        results.append(pool.apply_async(globals().get(func),args=("/"+str(i),)))
        filename = path + str(i)
        logger.debug("filename is %s" % filename)
        t = mythread.runThread(globals().get(func), filename)
        thread.append(t)
        logger.debug("%s %s" % (func, str(i)))
    for t in thread:
        t.start()
    if str(func) == "statfs_libcurve_file":
        for t in thread:
            result = t.get_result()
            assert result.length == 10737418240, "file length is %d" % (
                result.length)
            assert result.parentid == parentid, "file parentid is %d,pre id is %d" % (
                result.parentid, parentid)
            assert result.filetype == 1, "file filetype is %d" % (
                result.filetype)
    elif str(func) == "open_libcurve_file":
        for t in thread:
            results.append(t.get_result())
            assert t.get_result(
            ) != None, "open file fd is %d" % t.get_result()
        return results
    elif str(func) == "create_libcurve_file":
        for t in thread:
            rc = t.get_result()
            logger.debug("get result is %d" % rc)
            if rc == -1:
                logger.error("file exist")
            else:
                assert rc == 0, "result is %s" % str(rc)
    elif str(func) == "delete_libcurve_file":
        for t in thread:
            rc = t.get_result()
            logger.debug("get result is %d" % rc)
            if rc == -6:
                logger.error("file not exist")
            else:
                assert rc == 0, "result is %s" % str(rc)
    else:
        for t in thread:
            rc = t.get_result()
            logger.debug("get result is %d" % rc)
            assert rc == 0, "result is %s" % str(rc)
Ejemplo n.º 2
0
def background_loop_write_file(fd,
                               num=1000000,
                               offset=config.offset,
                               length=config.length):
    t = mythread.runThread(loop_write_file, fd, num, offset, length)
    t.start()
    return t
Ejemplo n.º 3
0
def drop_all_chunkserver_dat():
    thread = []
    for host in config.chunkserver_list:
        t = mythread.runThread(initial_chunkserver, host)
        thread.append(t)
        logger.debug("%s %s" % (initial_chunkserver, host))
    for t in thread:
        t.start()
    for t in thread:
        logger.debug("drop cs dat get result is %d" % t.get_result())
        assert t.get_result() == 0
Ejemplo n.º 4
0
def mult_thread_close_file(fd, num):
    #    pool = Pool(processes = num)
    thread = []
    for i in fd:
        #        results.append(pool.apply_async(globals().get(func),args=("/"+str(i),)))
        t = mythread.runThread(close_libcurve_file, i)
        thread.append(t)
        logger.debug("%s %s" % (close_libcurve_file, i))
    for t in thread:
        t.start()
    for t in thread:
        logger.debug("get result is %d" % t.get_result())
        assert t.get_result() == 0
Ejemplo n.º 5
0
def begin_kill_snapshotserver():
    t = mythread.runThread(loop_kill_snapshotserver)
    t.start()
Ejemplo n.º 6
0
def begin_snapshot_test():
    t = mythread.runThread(test_snapshot_all,config.snapshot_volid)
    config.snapshot_thread = t
    t.start()
Ejemplo n.º 7
0
def start_cto_file_md5check():
    thread = mythread.runThread(checksum_cto_data, "test4")
    logger.debug("check cto file md5")
    config.fs_md5check_thread = thread
    thread.start()
Ejemplo n.º 8
0
def loop_mount_umount():
    thread = mythread.runThread(mount_umount_test)
    logger.debug("thrash mount umount")
    config.fs_mount_thread = thread
    thread.start()