def testOpenSetattr(t, env): """test current state id processing by having OPEN and SETATTR in a single compound FLAGS: currentstateid all CODE: CSID8 """ size = 8 sess = env.c1.new_client_session(env.testname(t), flags=EXCHGID4_FLAG_USE_PNFS_MDS) open_op = open_create_file_op(sess, env.testname(t), open_create=OPEN4_CREATE) res = sess.compound( open_op + [ op.setattr(current_stateid, {FATTR4_SIZE: size})]) check(res, NFS4_OK)
def clean_dir(sess, path): stateid = nfs4lib.state00 # fh = self.do_getfh(path) entries = do_readdir(sess, path) for e in entries: # We separate setattr and remove to avoid an inode locking bug ops = use_obj(path + [e.name]) ops += [op.setattr(stateid, {FATTR4_MODE:0755})] res = sess.compound(ops) check(res, msg="Setting mode on %s" % repr(e.name)) ops = use_obj(path) ops += [op.remove(e.name)] res = sess.compound(ops) if res.status == NFS4ERR_NOTEMPTY: clean_dir(sess, path + [e.name]) res = sess.compound(ops) check(res, msg="Trying to remove %s" % repr(e.name))
def testOpenSetattr(t, env): """test current state id processing by having OPEN and SETATTR in a single compound FLAGS: currentstateid all CODE: CSID8 """ size = 8 sess = env.c1.new_client_session(env.testname(t), flags=EXCHGID4_FLAG_USE_PNFS_MDS) open_op = open_create_file_op(sess, env.testname(t), open_create=OPEN4_CREATE) res = sess.compound(open_op + [op.setattr(current_stateid, {FATTR4_SIZE: size})]) check(res, NFS4_OK)