Beispiel #1
0
def testReplayCache003(t, env):
    """Send two unsuccessful idempotent compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9c
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    res1 = sess1.compound([op.putrootfh(), op.lookup("")], cache_this=True)
    check(res1, NFS4ERR_INVAL)
    res2 = sess1.compound([op.putrootfh(), op.lookup("")], seq_delta=0)
    check(res2, NFS4ERR_INVAL)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Beispiel #2
0
def lookup_obj(sess, path):
    compound = [op.putrootfh()]
    compound += [op.lookup(comp) for comp in path]
    compound += [op.getfh()]
    res = sess.compound(compound)
    check(res)
    return res.resarray[-1].object
Beispiel #3
0
def use_obj(file):
    """File is either None, a fh, or a list of path components"""
    if file is None or file == [None]:
        return []
    elif type(file) is str:
        return [op.putfh(file)]
    else:
        return [op.putrootfh()] + [op.lookup(comp) for comp in file]
Beispiel #4
0
def use_obj(file):
    """File is either None, a fh, or a list of path components"""
    if file is None or file == [None]:
        return []
    elif type(file) is str:
        return [op.putfh(file)]
    else:
        return [op.putrootfh()] + [op.lookup(comp) for comp in file]
Beispiel #5
0
def testLongName(t, env):
    """LOOKUP should fail with NFS4ERR_NAMETOOLONG with long filenames

    FLAGS: lookup longname all
    CODE: LOOK4
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    res = sess1.compound([op.putrootfh(), op.lookup('abc' * 512)])
    check(res, NFS4ERR_NAMETOOLONG, "LOOKUP with very long component")
Beispiel #6
0
def testZeroLength(t, env):
    """LOOKUP with zero length name should return NFS4ERR_INVAL

    FLAGS: lookup all
    CODE: LOOK3
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    res = sess1.compound([op.putrootfh(), op.lookup('')])
    check(res, NFS4ERR_INVAL, "LOOKUP with no zero-length component")
Beispiel #7
0
def testNoFh(t, env):
    """LOOKUP should fail with NFS4ERR_NOFILEHANDLE if no (cfh)

    FLAGS: lookup emptyfh all
    CODE: LOOK1
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    res = sess1.compound([op.lookup(env.testname(t))])
    check(res, NFS4ERR_NOFILEHANDLE, "LOOKUP with no <cfh>")
Beispiel #8
0
def testNonExistent(t, env):
    """LOOKUP with non-existent components should return NFS4ERR_NOENT

    FLAGS: lookup all
    CODE: LOOK2
    """
    name = env.testname(t)
    c1 = env.c1.new_client(name)
    sess1 = c1.create_session()
    res = sess1.compound(env.home + [op.lookup(name)])
    check(res, NFS4ERR_NOENT,
          "LOOKUP with non-existant component '%s'" % name)
Beispiel #9
0
def testRequestTooBig(t, env):
    """Send a request bigger than session can handle

    FLAGS: sequence all
    CODE: SEQ6
    """
    c1 = env.c1.new_client(env.testname(t))
    # Only allow 512 byte requests
    attrs = channel_attrs4(0, 512, 8192, 8192, 128, 8, [])
    sess1 = c1.create_session(fore_attrs = attrs)
    # Send a lookup request with a very long filename
    res = sess1.compound([op.putrootfh(), op.lookup("12345"*100)])
    # FIXME - NAME_TOO_BIG is valid, don't want it to be
    check(res, NFS4ERR_REQ_TOO_BIG)
Beispiel #10
0
def testOpenLookupClose(t, env):
    """test current state id processing by having OPEN, LOOKUP and CLOSE
       in a single compound

    FLAGS: currentstateid all
    CODE: CSID5
    """
    sess1 = env.c1.new_client_session(env.testname(t))

    fname = env.testname(t)
    open_op = open_create_file_op(sess1, fname, open_create=OPEN4_CREATE)
    lookup_op = env.home + [op.lookup(fname)]
    res = sess1.compound(open_op + lookup_op + [op.close(0, current_stateid)])
    checklist(res, [NFS4ERR_STALE_STATEID, NFS4ERR_BAD_STATEID])
Beispiel #11
0
def testXdev(t, env):
    """LOOKUPP with dir on different fs

    FLAGS: special
    CODE: LKPP4
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    ops = [op.putrootfh(), op.getfh()]
    op_pairs = [(op.lookup(component), op.getfh()) for component in env.opts.usespecial]
    ops += [op_pair[i] for op_pair in op_pairs for i in range(2)]
    ops += [op.lookupp(), op.getfh()]
    res = sess1.compound(ops)
    check(res)
    fh1 = res.resarray[-5].object
    fh2 = res.resarray[-1].object
    if fh1 != fh2:
        t.fail("file handles not equal")
Beispiel #12
0
def testXdev(t, env):
    """LOOKUPP with dir on different fs

    FLAGS: special
    CODE: LKPP4
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    ops = [op.putrootfh(), op.getfh()]
    op_pairs = [(op.lookup(component), op.getfh())
                for component in env.opts.usespecial]
    ops += [op_pair[i] for op_pair in op_pairs for i in range(2)]
    ops += [op.lookupp(), op.getfh()]
    res = sess1.compound(ops)
    check(res)
    fh1 = res.resarray[-5].object
    fh2 = res.resarray[-1].object
    if fh1 != fh2:
        t.fail("file handles not equal")