Exemplo n.º 1
0
 def __init__(self, opts):
     sec1, sec2 = self._get_security(opts)
     #        authsys1 = rpc.SecAuthSys(0, opts.machinename, opts.uid, opts.gid, [])
     authsys2 = rpc.SecAuthSys(0, opts.machinename, opts.uid + 1,
                               opts.gid + 1, [])
     self.c1 = NFS4Client('client1_pid%i' % os.getpid(),
                          opts.server,
                          opts.port,
                          opts.path,
                          sec_list=[sec1],
                          opts=opts)
     self.c2 = NFS4Client('client2_pid%i' % os.getpid(),
                          opts.server,
                          opts.port,
                          opts.path,
                          sec_list=[authsys2],
                          opts=opts)
     self.longname = "a" * 512
     self.uid = 0
     self.gid = 0
     self.opts = opts
     self.filedata = "This is the file test data."
     self.linkdata = "/etc/X11"
     self.stateid0 = stateid4(0, '')
     self.stateid1 = stateid4(0xffffffffL, '\xff' * 12)
Exemplo n.º 2
0
    def __init__(self, opts):
        sec1, sec2 = self._get_security(opts)
#        authsys1 = rpc.SecAuthSys(0, opts.machinename, opts.uid, opts.gid, [])
        authsys2 = rpc.SecAuthSys(0, opts.machinename, opts.uid+1, opts.gid+1, [])
        self.c1 = NFS4Client('client1_pid%i' % os.getpid(),
                             opts.server, opts.port, opts.path,
                             sec_list=[sec1], opts=opts)
        self.c2 = NFS4Client('client2_pid%i' % os.getpid(),
                             opts.server, opts.port, opts.path,
                             sec_list=[authsys2], opts=opts)
        self.longname = "a"*512
        self.uid = 0
        self.gid = 0
        self.opts = opts
        self.filedata = "This is the file test data."
        self.linkdata = "/etc/X11"
        self.stateid0 = stateid4(0, '')
        self.stateid1 = stateid4(0xffffffffL, '\xff'*12)
Exemplo n.º 3
0
    def __init__(self, opts):
        sec1, sec2 = self._get_security(opts)
#        authsys1 = rpc.SecAuthSys(0, opts.machinename, opts.uid, opts.gid, [])
        authsys2 = rpc.SecAuthSys(0, opts.machinename, opts.uid+1, opts.gid+1, [])
        authsys4 = rpc.SecAuthSys(0, opts.machinename, 10, 10, [])
        self.c1 = NFS4Client('client1_pid%i' % os.getpid(),
                             opts.server, opts.port, opts.path,
                             sec_list=[sec1], opts=opts)
        self.c2 = NFS4Client('client2_pid%i' % os.getpid(),
                             opts.server, opts.port, opts.path,
                             sec_list=[authsys2], opts=opts)
        # Same auth/UID as c1, different client name.
        self.c3 = NFS4Client('client3_pid%i' % os.getpid(),
                             opts.server, opts.port, opts.path,
                             sec_list=[sec1], opts=opts)
# Connection for admin. Used in st_idmap.py
        self.c4 = NFS4Client('client4_pid%i' % os.getpid(),
                             opts.server, opts.port, opts.path,
                             sec_list=[authsys4], opts=opts)

        if opts.secondserver:
            print "Using secondserver = %s" % opts.secondserver
            self.c1node2 = NFS4Client('client1_pid%i' % os.getpid(),
                                 opts.secondserver, opts.port, opts.path,
                                 sec_list=[sec1], opts=opts)
            self.c3node2 = NFS4Client('client3_pid%i' % os.getpid(),
                                 opts.secondserver, opts.port, opts.path,
                                 sec_list=[sec1], opts=opts)
            self.secondconns = [("clientid3", self.c3), ("clientid3-node2", self.c3node2)]
            self.secondconn = None
        else:
            self.secondconns = [("clientid3", self.c3)]
            #self.secondconns = []
            self.secondconn = None

        self.longname = "a"*512
        self.uid = 0
        self.gid = 0
        self.opts = opts
        self.filedata = "This is the file test data."
        self.linkdata = "/etc/X11"
        self.stateid0 = stateid4(0, '')
        self.stateid1 = stateid4(0xffffffffL, '\xff'*12)
Exemplo n.º 4
0
def makeBadID(stateid):
    """Given a good stateid, makes it bad

    NOTE this looks into server opaque data, thus is very specific
    to the CITI linux server.  All tests which use this function have
    the flag 'badid'
    """

    boottime = stateid.other[0:4]
    bad = stateid4(stateid.seqid , boottime+"\0\0\0\0\0\0\0\0")
    return bad
Exemplo n.º 5
0
def makeBadID(stateid):
    """Given a good stateid, makes it bad

    NOTE this looks into server opaque data, thus is very specific
    to the CITI linux server.  All tests which use this function have
    the flag 'badid'
    """

    boottime = stateid.other[0:4]
    bad = stateid4(stateid.seqid , boottime+"\0\0\0\0\0\0\0\0")
    return bad
Exemplo n.º 6
0
def testBadStateid(t, env):
    """LOCK should return NFS4ERR_BAD_STATEID if use a bad id

    FLAGS: lock badid all
    DEPEND: MKFILE
    CODE: LOCK11
    """
    c = env.c1
    c.init_connection()
    fh, stateid = c.create_confirm(t.code)
    res = c.lock_file(t.code, fh, stateid4(0, ''))
    check(res, NFS4ERR_BAD_STATEID, "LOCK with a bad stateid")
Exemplo n.º 7
0
def testBadStateid(t, env):
    """OPEN_CONFIRM with a bad state should return NFS4ERR_BAD_STATEID

    FLAGS: openconfirm badid all
    CODE: OPCF5
    """
    c = env.c1
    c.init_connection()
    res = c.create_file(t.code)
    check(res)
    fh = res.resarray[-1].switch.switch.object
    res = _confirm(t, c, fh, stateid4(0, ''))
    check(res, NFS4ERR_BAD_STATEID, "OPEN_CONFIRM with a bad state")
Exemplo n.º 8
0
def makeStaleId(stateid):
    """Given a good stateid, makes it stale

    NOTE this looks into server opaque data, thus is very specific
    to the CITI linux server.  All tests which use this function have
    the flag 'staleid'
    """
    # The first 4 bytes of the linux stateid correspond to a time.
    # Choose a value older than any reasonable time, without
    # risking the chance of conflict with the zero-stateid.
    staletime = "\0\0\0\1"
    stale = stateid4(stateid.seqid , staletime+"\0\0\0\0\0\0\0\0")
    return stale
Exemplo n.º 9
0
def testBadStateid(t, env):
    """OPEN_CONFIRM with a bad state should return NFS4ERR_BAD_STATEID

    FLAGS: openconfirm badid all
    CODE: OPCF5
    """
    c = env.c1
    c.init_connection()
    res = c.create_file(t.code)
    check(res)
    fh = res.resarray[-1].arm.arm.object
    res = _confirm(t, c, fh, stateid4(0, ''))
    check(res, NFS4ERR_BAD_STATEID, "OPEN_CONFIRM with a bad state")
Exemplo n.º 10
0
def makeStaleId(stateid):
    """Given a good stateid, makes it stale

    NOTE this looks into server opaque data, thus is very specific
    to the CITI linux server.  All tests which use this function have
    the flag 'staleid'
    """
    # The first 4 bytes of the linux stateid correspond to a time.
    # Choose a value older than any reasonable time, without
    # risking the chance of conflict with the zero-stateid.
    staletime = "\0\0\0\1"
    stale = stateid4(stateid.seqid , staletime+"\0\0\0\0\0\0\0\0")
    return stale
Exemplo n.º 11
0
def testBadLockStateid(t, env):
    """LOCKU should return NFS4ERR_BAD_STATEID if use a bad id

    FLAGS: locku badid all
    DEPEND: MKFILE
    CODE: LKU8
    """
    c = env.c1
    c.init_connection()
    fh, stateid = c.create_confirm(t.code)
    res1 = c.lock_file(t.code, fh, stateid)
    check(res1)
    res2 = c.unlock_file(1, fh, stateid4(0, ''))
    check(res2, NFS4ERR_BAD_STATEID, "LOCKU with a bad stateid")
Exemplo n.º 12
0
def testBadLockStateid(t, env):
    """LOCKU should return NFS4ERR_BAD_STATEID if use a bad id

    FLAGS: locku badid all
    DEPEND: MKFILE
    CODE: LKU8
    """
    c = env.c1
    c.init_connection()
    fh, stateid = c.create_confirm(t.code)
    res1 = c.lock_file(t.code, fh, stateid)
    check(res1)
    res2 = c.unlock_file(1, fh, stateid4(0, ''))
    check(res2, NFS4ERR_BAD_STATEID, "LOCKU with a bad stateid")
Exemplo n.º 13
0
def makeStaleId(stateid):
    """Given a good stateid, makes it stale

    NOTE this looks into server opaque data, thus is very specific
    to the CITI linux server.  All tests which use this function have
    the flag 'staleid'
    """
    boottime = stateid.other[0:4]
    if ord(boottime[0]):
        staletime = "\0" + boottime[1:4]
    else:
        staletime = "a" + boottime[1:4]
    stale = stateid4(stateid.seqid , staletime+"\0\0\0\0\0\0\0\0")
    return stale
Exemplo n.º 14
0
def makeStaleId(stateid):
    """Given a good stateid, makes it stale

    NOTE this looks into server opaque data, thus is very specific
    to the CITI linux server.  All tests which use this function have
    the flag 'staleid'
    """
    boottime = stateid.other[0:4]
    if ord(boottime[0]):
        staletime = "\0" + boottime[1:4]
    else:
        staletime = "a" + boottime[1:4]
    stale = stateid4(stateid.seqid, staletime + "\0\0\0\0\0\0\0\0")
    return stale
Exemplo n.º 15
0
    def __init__(self, opts):
        sec1, sec2 = self._get_security(opts)
        #        authsys1 = rpc.SecAuthSys(0, opts.machinename, opts.uid, opts.gid, [])
        authsys2 = rpc.SecAuthSys(0, opts.machinename, opts.uid + 1,
                                  opts.gid + 1, [])
        authsys4 = rpc.SecAuthSys(0, opts.machinename, 10, 10, [])
        self.c1 = NFS4Client('client1_pid%i' % os.getpid(),
                             opts.server,
                             opts.port,
                             opts.path,
                             sec_list=[sec1],
                             opts=opts)
        self.c2 = NFS4Client('client2_pid%i' % os.getpid(),
                             opts.server,
                             opts.port,
                             opts.path,
                             sec_list=[authsys2],
                             opts=opts)
        # Same auth/UID as c1, different client name.
        self.c3 = NFS4Client('client3_pid%i' % os.getpid(),
                             opts.server,
                             opts.port,
                             opts.path,
                             sec_list=[sec1],
                             opts=opts)
        # Connection for admin. Used in st_idmap.py
        self.c4 = NFS4Client('client4_pid%i' % os.getpid(),
                             opts.server,
                             opts.port,
                             opts.path,
                             sec_list=[authsys4],
                             opts=opts)

        if opts.secondserver:
            print "Using secondserver = %s" % opts.secondserver
            self.c1node2 = NFS4Client('client1_pid%i' % os.getpid(),
                                      opts.secondserver,
                                      opts.port,
                                      opts.path,
                                      sec_list=[sec1],
                                      opts=opts)
            self.c3node2 = NFS4Client('client3_pid%i' % os.getpid(),
                                      opts.secondserver,
                                      opts.port,
                                      opts.path,
                                      sec_list=[sec1],
                                      opts=opts)
            self.secondconns = [("clientid3", self.c3),
                                ("clientid3-node2", self.c3node2)]
            self.secondconn = None
        else:
            self.secondconns = [("clientid3", self.c3)]
            #self.secondconns = []
            self.secondconn = None

        self.longname = "a" * 512
        self.uid = 0
        self.gid = 0
        self.opts = opts
        self.filedata = "This is the file test data."
        self.linkdata = "/etc/X11"
        self.stateid0 = stateid4(0, '')
        self.stateid1 = stateid4(0xffffffffL, '\xff' * 12)