コード例 #1
0
def do_getattrdict(sess, file, attrlist):
    """file can be either a fh or a path"""
    ops = use_obj(file)
    ops += [op.getattr(nfs4lib.list2bitmap(attrlist))]
    res = sess.compound(ops)
    check(res)
    return res.resarray[-1].obj_attributes
コード例 #2
0
ファイル: environment.py プロジェクト: ajaynair/pynfs-1
def do_getattrdict(sess, file, attrlist):
    """file can be either a fh or a path"""
    ops = use_obj(file)
    ops += [op.getattr(nfs4lib.list2bitmap(attrlist))]
    res = sess.compound(ops)
    check(res)
    return res.resarray[-1].obj_attributes
コード例 #3
0
def testACLsupport(t, env):
    """SETATTR/GETATTR of a simple ACL

    FLAGS: acl all
    DEPEND: LOOKFILE
    CODE: ACL0
    """
    c = env.c1
    c.init_connection()

    supported = c.supportedAttrs(env.opts.usefile)
    if not (supported & list2bitmap([FATTR4_ACL])):
        t.fail_support("FATTR4_ACL not supported")
コード例 #4
0
ファイル: st_acl.py プロジェクト: ajaynair/pynfs-1
def testACLsupport(t, env):
    """SETATTR/GETATTR of a simple ACL

    FLAGS: acl all
    DEPEND: LOOKFILE
    CODE: ACL0
    """
    c = env.c1
    c.init_connection()

    supported = c.supportedAttrs(env.opts.usefile)
    if supported & list2bitmap([FATTR4_ACL]):
        t.fail_support("FATTR4_ACL not supported")
コード例 #5
0
def testAttr1b(t, env):
    """READDIR with attributes should return _MOVED

    FLAGS: fslocations
    CODE: FSLOC4b
    """
    c = env.c1
    c.init_connection()
    path = env.opts.usespecial[:-1]
    attrlist = [FATTR4_SIZE, FATTR4_FILEHANDLE, FATTR4_FSID]
    ops = c.use_obj(path)
    ops += [c.readdir_op(0, '', 4096, 4096, list2bitmap(attrlist))]
    res = c.compound(ops)
    check(res, NFS4ERR_MOVED, "READDIR w/o FSLOC or RDATTR_ERROR")
コード例 #6
0
def testRepTooBig(t, env):
    """If requester sends a request for which the size of the reply
       would exceed ca_maxresponsesize, the replier will return
       NFS4ERR_REP_TOO_BIG

    FLAGS: create_session all
    CODE: CSESS26
    """
    name = env.testname(t)
    c1 = env.c1.new_client(name)
    # create session with a small ca_maxresponsesize
    chan_attrs = channel_attrs4(0,400,400,400,128,8,[])
    sess1 = c1.create_session(fore_attrs=chan_attrs)
    sess1.compound([op.reclaim_complete(FALSE)])

    mandatory = [attr.bitnum for attr in env.attr_info if attr.mandatory]
    print(mandatory);
    ops = [op.putrootfh()]
    getattrop = op.getattr(nfs4lib.list2bitmap(mandatory))
    ops += [getattrop, getattrop, getattrop, getattrop]
    res = sess1.compound(ops)
    check(res, NFS4ERR_REP_TOO_BIG)
コード例 #7
0
ファイル: st_create_session.py プロジェクト: kofemann/pynfs
def testRepTooBig(t, env):
    """If requester sends a request for which the size of the reply
       would exceed ca_maxresponsesize, the replier will return
       NFS4ERR_REP_TOO_BIG

    FLAGS: create_session all
    CODE: CSESS26
    """
    name = env.testname(t)
    c1 = env.c1.new_client(name)
    # create session with a small ca_maxresponsesize
    chan_attrs = channel_attrs4(0,400,400,400,128,8,[])
    sess1 = c1.create_session(fore_attrs=chan_attrs)
    sess1.compound([op.reclaim_complete(FALSE)])

    mandatory = [attr.bitnum for attr in env.attr_info if attr.mandatory]
    print(mandatory);
    ops = [op.putrootfh()]
    getattrop = op.getattr(nfs4lib.list2bitmap(mandatory))
    ops += [getattrop, getattrop, getattrop, getattrop]
    res = sess1.compound(ops)
    check(res, NFS4ERR_REP_TOO_BIG)
コード例 #8
0
    def init(self, name):
        """Run once before any test is run"""
        if self.opts.noinit:
            return
        # sess = self.c1.new_client_session("Environment.init_%i" % self.timestamp)
        c = self.c1.new_client("Linux NFSv4.1 %s" %
                               str(name + str(random.randint(0, 100))))
        sess = c.create_session()
        res = sess.compound([op.reclaim_complete(FALSE)])
        res = sess.compound([op.putrootfh(), op.secinfo_no_name(0)])
        res = sess.compound([
            op.putrootfh(),
            op.getfh(),
            op.getattr(
                nfs4lib.list2bitmap(
                    [1, 3, 4, 8, 20, 33, 35, 36, 37, 41, 45, 47, 52, 53, 55]))
        ])
        fh = res.resarray[1].object
        print("-1-----------------")
        print(fh)
        res = sess.compound([
            op.putfh(fh),
            op.getattr(nfs4lib.list2bitmap([0, 2, 5, 6, 13, 75]))
        ])
        res = sess.compound([
            op.putfh(fh),
            op.getattr(nfs4lib.list2bitmap([10, 27, 30, 31, 51, 62, 65]))
        ])
        res = sess.compound([
            op.putfh(fh),
            op.getattr(nfs4lib.list2bitmap([0, 2, 5, 6, 13, 75]))
        ])
        res = sess.compound([
            op.putfh(fh),
            op.getattr(nfs4lib.list2bitmap([10, 27, 30, 31, 51, 62, 65]))
        ])
        res = sess.compound(
            [op.putfh(fh),
             op.getattr(nfs4lib.list2bitmap([28, 29]))])
        res = sess.compound([
            op.putfh(fh),
            op.getattr(nfs4lib.list2bitmap([0, 2, 5, 6, 13, 75]))
        ])
        res = sess.compound([
            op.putfh(fh),
            op.getattr(
                nfs4lib.list2bitmap(
                    [1, 3, 4, 8, 20, 33, 35, 36, 37, 41, 45, 47, 52, 53, 55]))
        ])
        res = sess.compound([
            op.putfh(fh),
            op.access(0x1f),
            op.getattr(nfs4lib.list2bitmap([3, 4, 52, 53]))
        ])
        res = sess.compound([
            op.putfh(fh),
            op.lookup("nfs"),
            op.getfh(),
            op.getattr(
                nfs4lib.list2bitmap(
                    [1, 3, 4, 8, 20, 33, 35, 36, 37, 41, 45, 47, 52, 53, 55]))
        ])

        print("0-----------------")

        # oldfh = res.resarray[1].resok4
        # un = NFS4Unpacker(oldfh)
        # fh = un.unpack_GETFH4resok()
        #print (fh)
        # print(sess.sessionid, sess.seqid, sess.client, sess.c)
        # print(c)
        time.sleep(100)
        if self.opts.maketree:
            self._maketree(sess)
        # Make sure opts.home exists
        res = sess.compound(use_obj(self.opts.home))
        check(res, msg="Could not LOOKUP /%s," % '/'.join(self.opts.home))
        # Make sure it is empty
        clean_dir(sess, self.opts.home)
        sess.c.null()
        print("chenggongle")
        self.c1
        self.clean_sessions()
        self.clean_clients()