def testLockWriteLocku(t, env): """test current state id processing by having LOCK, WRITE and LOCKU in a single compound FLAGS: currentstateid all CODE: CSID4 """ sess1 = env.c1.new_client_session(env.testname(t)) res = create_file(sess1, env.testname(t)) check(res) fh = res.resarray[-1].object stateid = res.resarray[-2].stateid data = "write test data" open_to_lock_owner = open_to_lock_owner4(0, stateid, 0, lock_owner4(0, "lock1")) lock_owner = locker4(open_owner=open_to_lock_owner, new_lock_owner=True) lock_ops = [ op.lock(WRITE_LT, False, 0, NFS4_UINT64_MAX, lock_owner), op.write(current_stateid, 5, FILE_SYNC4, data), op.locku(WRITE_LT, 0, current_stateid, 0, NFS4_UINT64_MAX), op.close(0, stateid) ] res = sess1.compound([op.putfh(fh)] + lock_ops) check(res, NFS4_OK)
def testLockWriteLocku(t, env): """test current state id processing by having LOCK, WRITE and LOCKU in a single compound FLAGS: currentstateid all CODE: CSID4 """ sess1 = env.c1.new_client_session(env.testname(t)) res = create_file(sess1, env.testname(t)) check(res) fh = res.resarray[-1].object stateid = res.resarray[-2].stateid data = "write test data" open_to_lock_owner = open_to_lock_owner4(0, stateid, 0, lock_owner4(0, "lock1")) lock_owner = locker4(open_owner=open_to_lock_owner, new_lock_owner=True) lock_ops = [ op.lock(WRITE_LT, False, 0, NFS4_UINT64_MAX, lock_owner), op.write(current_stateid, 5, FILE_SYNC4, data), op.locku(WRITE_LT, 0, current_stateid, 0, NFS4_UINT64_MAX), op.close(0, stateid), ] res = sess1.compound([op.putfh(fh)] + lock_ops) check(res, NFS4_OK)
def testLockLockU(t, env): """test current state id processing by having LOCK and LOCKU in a single compound FLAGS: currentstateid all CODE: CSID2 """ sess1 = env.c1.new_client_session(env.testname(t)) res = create_file(sess1, env.testname(t)) check(res) fh = res.resarray[-1].object stateid = res.resarray[-2].stateid open_to_lock_owner = open_to_lock_owner4( 0, stateid, 0, lock_owner4(0, "lock1")) lock_owner = locker4(open_owner=open_to_lock_owner, new_lock_owner=True) lock_ops = [ op.lock(WRITE_LT, False, 0, NFS4_UINT64_MAX, lock_owner), op.locku(WRITE_LT, 0, current_stateid, 0, NFS4_UINT64_MAX) ] res = sess1.compound([op.putfh(fh)] + lock_ops) check(res, NFS4_OK) res = close_file(sess1, fh, stateid=stateid) check(res)
def testLockLockU(t, env): """test current state id processing by having LOCK and LOCKU in a single compound FLAGS: currentstateid all CODE: CSID2 """ sess1 = env.c1.new_client_session(env.testname(t)) res = create_file(sess1, env.testname(t)) check(res) fh = res.resarray[-1].object stateid = res.resarray[-2].stateid open_to_lock_owner = open_to_lock_owner4( 0, stateid, 0, lock_owner4(0, b"lock1")) lock_owner = locker4(open_owner=open_to_lock_owner, new_lock_owner=True) lock_ops = [ op.lock(WRITE_LT, False, 0, NFS4_UINT64_MAX, lock_owner), op.locku(WRITE_LT, 0, current_stateid, 0, NFS4_UINT64_MAX) ] res = sess1.compound([op.putfh(fh)] + lock_ops) check(res, NFS4_OK) res = close_file(sess1, fh, stateid=stateid) check(res)
def cour_lockargs(fh, stateid): open_to_lock_owner = open_to_lock_owner4(0, stateid, 0, lock_owner4(0, b"lock1")) lock_owner = locker4(open_owner=open_to_lock_owner, new_lock_owner=True) lock_ops = [op.lock(WRITE_LT, False, 0, NFS4_UINT64_MAX, lock_owner)] return [op.putfh(fh)] + lock_ops