def testCreateUncheckedFile(t, env): """OPEN normal file with create and unchecked flags FLAGS: open all DEPEND: INIT CODE: OPEN2 """ c = env.c1 c.init_connection() # Create the file orig_attrs = { FATTR4_MODE: 0644, FATTR4_SIZE: 32 } res = c.create_file(t.code, attrs=orig_attrs, deny=OPEN4_SHARE_DENY_NONE) check(res, msg="Trying to create file %s" % t.code) fh, stateid = c.confirm(t.code, res) rcvd_attrs = c.do_getattrdict(fh, orig_attrs.keys()) checkdict(orig_attrs, rcvd_attrs, get_bitnumattr_dict(), "Checking attrs on creation") # Create the file again...it should ignore attrs attrs = { FATTR4_MODE: 0600, FATTR4_SIZE: 16 } res = c.create_file(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) check(res, msg="Trying to recreate file %s" % t.code) fh, stateid = c.confirm(t.code, res) rcvd_attrs = c.do_getattrdict(fh, orig_attrs.keys()) checkdict(orig_attrs, rcvd_attrs, get_bitnumattr_dict(), "Attrs on recreate should be ignored") # Create the file again, should truncate size to 0 and ignore other attrs attrs = { FATTR4_MODE: 0600, FATTR4_SIZE: 0 } res = c.create_file(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) check(res, msg="Trying to truncate file %s" % t.code) fh, stateid = c.confirm(t.code, res) rcvd_attrs = c.do_getattrdict(fh, orig_attrs.keys()) expect = { FATTR4_MODE: 0644, FATTR4_SIZE: 0 } checkdict(expect, rcvd_attrs, get_bitnumattr_dict(), "Attrs on recreate should be ignored, except for size")
def testCreateUncheckedFile(t, env): """OPEN normal file with create and unchecked flags FLAGS: open all DEPEND: INIT CODE: OPEN2 """ c = env.c1 c.init_connection() # Create the file orig_attrs = {FATTR4_MODE: 0o644, FATTR4_SIZE: 32} res = c.create_file(t.code, attrs=orig_attrs, deny=OPEN4_SHARE_DENY_NONE) check(res, msg="Trying to create file %s" % t.code) fh, stateid = c.confirm(t.code, res) rcvd_attrs = c.do_getattrdict(fh, orig_attrs.keys()) checkdict(orig_attrs, rcvd_attrs, get_bitnumattr_dict(), "Checking attrs on creation") # Create the file again...it should ignore attrs attrs = {FATTR4_MODE: 0o600, FATTR4_SIZE: 16} res = c.create_file(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) check(res, msg="Trying to recreate file %s" % t.code) fh, stateid = c.confirm(t.code, res) rcvd_attrs = c.do_getattrdict(fh, orig_attrs.keys()) checkdict(orig_attrs, rcvd_attrs, get_bitnumattr_dict(), "Attrs on recreate should be ignored") # Create the file again, should truncate size to 0 and ignore other attrs attrs = {FATTR4_MODE: 0o600, FATTR4_SIZE: 0} res = c.create_file(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) check(res, msg="Trying to truncate file %s" % t.code) fh, stateid = c.confirm(t.code, res) rcvd_attrs = c.do_getattrdict(fh, orig_attrs.keys()) expect = {FATTR4_MODE: 0o644, FATTR4_SIZE: 0} checkdict(expect, rcvd_attrs, get_bitnumattr_dict(), "Attrs on recreate should be ignored, except for size")
def importops(self): d = self.locals for attr in dir(self.client): if attr.endswith("_op"): key = attr[:-3].upper() d[key] = getattr(self.client, attr) d["COMPOUND"] = self.client.compound d["NULL"] = self.client.null d['fattr4_from_dict'] = nfs4lib.dict2fattr d['fattr4_to_dict'] = nfs4lib.fattr2dict d['fattr4_names'] = nfs4lib.get_bitnumattr_dict() d['bitmap4_from_list'] = nfs4lib.list2bitmap d['bitmap4_to_list'] = nfs4lib.bitmap2list