示例#1
0
def testLayoutReturnAll(t, env):
    """
    Return all of a client's layouts
    
    FLAGS: layoutreturn all
    DEPEND: GETLAYOUT1
    CODE: LAYOUTRET3
    """
    # Make sure E_ID returns MDS capabilities
    c1 = env.c1.new_client(env.testname(t), flags=EXCHGID4_FLAG_USE_PNFS_MDS)
    if not c1.flags & EXCHGID4_FLAG_USE_PNFS_MDS:
        fail("Server can not be used as pnfs metadata server")
    sess = c1.create_session()
    print sess.c.homedir
    # Create the file
    res = create_file(sess, env.testname(t))
    check(res)
    # Get layout
    fh = res.resarray[-1].object
    open_stateid = res.resarray[-2].stateid
    ops = [
        op.putfh(fh),
        op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_READ, 0,
                     0xffffffffffffffff, 0, open_stateid, 0xffff)
    ]
    res = sess.compound(ops)
    check(res)
    # Return layout
    ops = [
        op.layoutreturn(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_ANY,
                        layoutreturn4(LAYOUTRETURN4_ALL))
    ]
    res = sess.compound(ops)
    check(res)
示例#2
0
def testLayoutReturnAll(t, env):
    """
    Return all of a client's layouts
    
    FLAGS: pnfs
    DEPEND: GETLAYOUT1
    CODE: LAYOUTRET3
    """
    # Make sure E_ID returns MDS capabilities
    c1 = env.c1.new_client(env.testname(t), flags=EXCHGID4_FLAG_USE_PNFS_MDS)
    if not c1.flags & EXCHGID4_FLAG_USE_PNFS_MDS:
        fail("Server can not be used as pnfs metadata server")
    sess = c1.create_session()
    print sess.c.homedir
    # Create the file
    res = create_file(sess, env.testname(t))
    check(res)
    # Get layout
    fh = res.resarray[-1].object
    open_stateid = res.resarray[-2].stateid
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_READ,
                        0, 0xffffffffffffffff, 0, open_stateid, 0xffff)]
    res = sess.compound(ops)
    check(res)
    # Return layout
    ops = [op.layoutreturn(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_ANY,
                           layoutreturn4(LAYOUTRETURN4_ALL))]
    res = sess.compound(ops)
    check(res)