Exemplo n.º 1
0
def testEmptyCommit(t, env):
    """Check for proper handling of empty LAYOUTCOMMIT.

    FLAGS: block
    CODE: BLOCK3
    """
    sess = env.c1.new_pnfs_client_session(env.testname(t))
    # Create the file
    res = create_file(sess, env.testname(t))
    check(res)
    # Get layout 1
    fh = res.resarray[-1].object
    open_stateid = res.resarray[-2].stateid
    print open_stateid
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
                        0, 8192, 8192, open_stateid, 0xffff)]
    res = sess.compound(ops)
    check(res)
    # Get layout 2
    lo_stateid1 = res.resarray[-1].logr_stateid
    print lo_stateid1
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
                        8192, 8192, 8192, lo_stateid1, 0xffff)]
    res = sess.compound(ops)
    check(res)
    lo_stateid2 = res.resarray[-1].logr_stateid
    print lo_stateid2
    # Parse opaque to get info for commit
    # STUB not very general
    layout = res.resarray[-1].logr_layout[-1]
    p = BlockUnpacker(layout.loc_body)
    opaque = p.unpack_pnfs_block_layout4()
    p.done()
    extent = opaque.blo_extents[-1]
    extent.bex_state = PNFS_BLOCK_READWRITE_DATA
    p = BlockPacker()
    p.pack_pnfs_block_layoutupdate4(pnfs_block_layoutupdate4([extent]))
    time = newtime4(True, get_nfstime())
    ops = [op.putfh(fh),
           op.layoutcommit(extent.bex_file_offset,
                           extent.bex_length,
                           False, lo_stateid2,
                           newoffset4(True, 2 * 8192 - 1),
                           time,
                           layoutupdate4(LAYOUT4_BLOCK_VOLUME, p.get_buffer()))]
    res = sess.compound(ops)
    check(res)
    # Send another LAYOUTCOMMIT, with an empty opaque
    time = newtime4(True, get_nfstime())
    ops = [op.putfh(fh),
           op.layoutcommit(extent.bex_file_offset,
                           extent.bex_length,
                           False, lo_stateid2,
                           newoffset4(True, 2 * 8192 - 1),
                           time,
                           layoutupdate4(LAYOUT4_BLOCK_VOLUME, ""))]
    res = sess.compound(ops)
    check(res)
Exemplo n.º 2
0
def testStateid2(t, env):
    """Check for proper sequence handling in layout stateids.

    FLAGS: block
    CODE: BLOCK2
    """
    c1 = env.c1.new_client_session(env.testname(t),
                                    flags=EXCHGID4_FLAG_USE_PNFS_MDS)
    # Create the file
    res = create_file(sess, env.testname(t))
    check(res)
    # Get layout 1
    fh = res.resarray[-1].object
    open_stateid = res.resarray[-2].stateid
    print open_stateid
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
                        0, 8192, 8192, open_stateid, 0xffff)]
    res = sess.compound(ops)
    check(res)
    # Get layout 2
    lo_stateid1 = res.resarray[-1].logr_stateid
    print lo_stateid1
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
                        8192, 8192, 8192, lo_stateid1, 0xffff)]
    res = sess.compound(ops)
    check(res)
    # Get layout 3 (merge of prior two)
    lo_stateid2 = res.resarray[-1].logr_stateid
    print lo_stateid2
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
                        0, 2*8192, 2*8192, lo_stateid2, 0xffff)]
    res = sess.compound(ops)
    check(res)
    lo_stateid3 = res.resarray[-1].logr_stateid
    print lo_stateid3
    # lo_stateid3.seqid = 3 # BUG - work around emc problem
    # Parse opaque to get info for commit
    # STUB not very general
    layout = res.resarray[-1].logr_layout[-1]
    p = BlockUnpacker(layout.loc_body)
    opaque = p.unpack_pnfs_block_layout4()
    p.done()
    extent = opaque.blo_extents[-1]
    extent.bex_state = PNFS_BLOCK_READWRITE_DATA
    p = BlockPacker()
    p.pack_pnfs_block_layoutupdate4(pnfs_block_layoutupdate4([extent]))
    time = newtime4(True, get_nfstime())
    ops = [op.putfh(fh),
           op.layoutcommit(extent.bex_file_offset,
                           extent.bex_length,
                           False, lo_stateid3,
                           newoffset4(True, 2 * 8192 - 1),
                           time,
                           layoutupdate4(LAYOUT4_BLOCK_VOLUME, p.get_buffer()))]
    res = sess.compound(ops)
    check(res)
Exemplo n.º 3
0
def testStateid2(t, env):
    """Check for proper sequence handling in layout stateids.

    FLAGS: block
    CODE: BLOCK2
    """
    sess = env.c1.new_pnfs_client_session(env.testname(t))
    # Create the file
    res = create_file(sess, env.testname(t))
    check(res)
    # Get layout 1
    fh = res.resarray[-1].object
    open_stateid = res.resarray[-2].stateid
    print open_stateid
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
                        0, 8192, 8192, open_stateid, 0xffff)]
    res = sess.compound(ops)
    check(res)
    # Get layout 2
    lo_stateid1 = res.resarray[-1].logr_stateid
    print lo_stateid1
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
                        8192, 8192, 8192, lo_stateid1, 0xffff)]
    res = sess.compound(ops)
    check(res)
    # Get layout 3 (merge of prior two)
    lo_stateid2 = res.resarray[-1].logr_stateid
    print lo_stateid2
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
                        0, 2*8192, 2*8192, lo_stateid2, 0xffff)]
    res = sess.compound(ops)
    check(res)
    lo_stateid3 = res.resarray[-1].logr_stateid
    print lo_stateid3
    # lo_stateid3.seqid = 3 # BUG - work around emc problem
    # Parse opaque to get info for commit
    # STUB not very general
    layout = res.resarray[-1].logr_layout[-1]
    p = BlockUnpacker(layout.loc_body)
    opaque = p.unpack_pnfs_block_layout4()
    p.done()
    extent = opaque.blo_extents[-1]
    extent.bex_state = PNFS_BLOCK_READWRITE_DATA
    p = BlockPacker()
    p.pack_pnfs_block_layoutupdate4(pnfs_block_layoutupdate4([extent]))
    time = newtime4(True, get_nfstime())
    ops = [op.putfh(fh),
           op.layoutcommit(extent.bex_file_offset,
                           extent.bex_length,
                           False, lo_stateid3,
                           newoffset4(True, 2 * 8192 - 1),
                           time,
                           layoutupdate4(LAYOUT4_BLOCK_VOLUME, p.get_buffer()))]
    res = sess.compound(ops)
    check(res)
Exemplo n.º 4
0
 def __init__(self):
     self.minor_id = 0
     self.major_id = "PyNFSv4.1"
     self._owner = server_owner4(self.minor_id, self.major_id)
     self.scope = "Default_Scope"
     self.impl_domain = "citi.umich.edu"
     self.impl_name = "pynfs X.X"
     self.impl_date = 1172852767  # int(time.time())
     self.impl_id = nfs_impl_id4(self.impl_domain, self.impl_name,
                                 nfs4lib.get_nfstime(self.impl_date))
Exemplo n.º 5
0
 def __init__(self):
     self.minor_id = os.getpid()
     self.major_id = "PyNFSv4.1"
     self._owner = server_owner4(self.minor_id, self.major_id)
     self.scope = "Default_Scope"
     self.impl_domain = "citi.umich.edu"
     self.impl_name = "pynfs X.X"
     self.impl_date = 1172852767 # int(time.time())
     self.impl_id = nfs_impl_id4(self.impl_domain, self.impl_name,
                              nfs4lib.get_nfstime(self.impl_date))
Exemplo n.º 6
0
    def __init__(self, host='localhost', port=2049, ctrl_proc=16):
        rpc.Client.__init__(self, 100003, 4)
        self.prog = 0x40000000
        self.versions = [1] # List of supported versions of prog

        self.minorversion = 1
        self.minor_versions = [1]
        self.tag = "default tag"
        self.impl_id = nfs_impl_id4("citi.umich.edu", "pynfs X.X",
                                    nfs4lib.get_nfstime())
        self.verifier = struct.pack('>d', time.time())
        self.server_address = (host, port)
        self.c1 = self.connect(self.server_address)
        self.sessions = {} # XXX Really, this should be per server
        self.ctrl_proc = ctrl_proc
Exemplo n.º 7
0
    def __init__(self, host="localhost", port=2049, minorversion=1, ctrl_proc=16, summary=None):
        rpc.Client.__init__(self, 100003, 4)
        self.prog = 0x40000000
        self.versions = [1]  # List of supported versions of prog

        self.minorversion = minorversion
        self.minor_versions = [minorversion]
        self.tag = "default tag"
        self.impl_id = nfs_impl_id4("citi.umich.edu", "pynfs X.X", nfs4lib.get_nfstime())
        self.verifier = struct.pack(">d", time.time())
        self.server_address = (host, port)
        self.c1 = self.connect(self.server_address)
        self.sessions = {}  # XXX Really, this should be per server
        self.ctrl_proc = ctrl_proc
        self.summary = summary
Exemplo n.º 8
0
def testSplitCommit(t, env):
    """Check for proper handling of disjoint LAYOUTCOMMIT.opaque

    FLAGS: block
    CODE: BLOCK4
    """
    sess = env.c1.new_client_session(env.testname(t),
                                     flags=EXCHGID4_FLAG_USE_PNFS_MDS)
    # Create the file
    res = create_file(sess, env.testname(t))
    check(res)
    # Get layout 1
    fh = res.resarray[-1].object
    open_stateid = res.resarray[-2].stateid
    print open_stateid
    ops = [
        op.putfh(fh),
        op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW, 0,
                     2 * 8192, 2 * 8192, open_stateid, 0xffff)
    ]
    res = sess.compound(ops)
    check(res)

    lo_stateid1 = res.resarray[-1].logr_stateid
    print lo_stateid1
    # Parse opaque to get info for commit
    # STUB not very general
    layout = res.resarray[-1].logr_layout[-1]
    p = BlockUnpacker(layout.loc_body)
    opaque = p.unpack_pnfs_block_layout4()
    p.done()
    dev = opaque.blo_extents[-1].bex_vol_id
    extent1 = pnfs_block_extent4(dev, 0, 8192, 0, PNFS_BLOCK_READWRITE_DATA)
    extent2 = pnfs_block_extent4(dev, 8192, 8192, 0, PNFS_BLOCK_READWRITE_DATA)

    p = BlockPacker()
    p.pack_pnfs_block_layoutupdate4(
        pnfs_block_layoutupdate4([extent1, extent2]))
    time = newtime4(True, get_nfstime())
    ops = [
        op.putfh(fh),
        op.layoutcommit(0, 2 * 8192, False, lo_stateid1,
                        newoffset4(True, 2 * 8192 - 1), time,
                        layoutupdate4(LAYOUT4_BLOCK_VOLUME, p.get_buffer()))
    ]
    res = sess.compound(ops)
    check(res)
Exemplo n.º 9
0
def testSplitCommit(t, env):
    """Check for proper handling of disjoint LAYOUTCOMMIT.opaque

    FLAGS: block
    CODE: BLOCK4
    """
    sess = env.c1.new_client_session(env.testname(t),
                                        flags=EXCHGID4_FLAG_USE_PNFS_MDS)
    # Create the file
    res = create_file(sess, env.testname(t))
    check(res)
    # Get layout 1
    fh = res.resarray[-1].object
    open_stateid = res.resarray[-2].stateid
    print open_stateid
    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
                        0, 2*8192, 2*8192, open_stateid, 0xffff)]
    res = sess.compound(ops)
    check(res)

    lo_stateid1 = res.resarray[-1].logr_stateid
    print lo_stateid1
    # Parse opaque to get info for commit
    # STUB not very general
    layout = res.resarray[-1].logr_layout[-1]
    p = BlockUnpacker(layout.loc_body)
    opaque = p.unpack_pnfs_block_layout4()
    p.done()
    dev = opaque.blo_extents[-1].bex_vol_id
    extent1 = pnfs_block_extent4(dev, 0, 8192, 0, PNFS_BLOCK_READWRITE_DATA)
    extent2 = pnfs_block_extent4(dev, 8192, 8192, 0, PNFS_BLOCK_READWRITE_DATA)

    p = BlockPacker()
    p.pack_pnfs_block_layoutupdate4(pnfs_block_layoutupdate4([extent1,
                                                              extent2]))
    time = newtime4(True, get_nfstime())
    ops = [op.putfh(fh),
           op.layoutcommit(0,
                           2*8192,
                           False, lo_stateid1,
                           newoffset4(True, 2 * 8192 - 1),
                           time,
                           layoutupdate4(LAYOUT4_BLOCK_VOLUME, p.get_buffer()))]
    res = sess.compound(ops)
    check(res)
Exemplo n.º 10
0
    def __init__(self, host=b'localhost', port=2049, minorversion=1, ctrl_proc=16, summary=None, secure=False):
        rpc.Client.__init__(self, 100003, 4)
        self.prog = 0x40000000
        self.versions = [1] # List of supported versions of prog

        self.minorversion = minorversion
        self.minor_versions = [minorversion]
        self.tag = b"default tag"
        self.impl_id = nfs_impl_id4(b"citi.umich.edu", b"pynfs X.X",
                                    nfs4lib.get_nfstime())
        self.verifier = struct.pack('>d', time.time())
        self.server_address = (host, port)
        self.c1 = self.connect(self.server_address,secure=secure)
        self.sessions = {} # XXX Really, this should be per server
        self.clients = {} # XXX Really, this should be per server
        self.ctrl_proc = ctrl_proc
        self.summary = summary
Exemplo n.º 11
0
def _LayoutStats(t, env, stats):
    '''Loop over the provided layoutstats, sending them on in time
    '''
    sess = env.c1.new_pnfs_client_session(env.testname(t))

    # Create the file
    res = create_file(sess, env.testname(t))
    check(res)
    fh = res.resarray[-1].object
    open_stateid = res.resarray[-2].stateid
    lo_stateid = open_stateid

    ops = [op.putfh(fh),
           op.layoutget(False, LAYOUT4_FLEX_FILES,
                        LAYOUTIOMODE4_RW,
                        0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
    res = sess.compound(ops)
    check(res)
    lo_stateid = res.resarray[-1].logr_stateid
    check_seqid(lo_stateid, 1)

    layout = res.resarray[-1].logr_layout[-1]
    p = FlexUnpacker(layout.loc_body)
    opaque = p.unpack_ff_layout4()
    p.done()

    stats_hint = opaque.ffl_stats_collect_hint

    # Assume one mirror/storage device
    ds = opaque.ffl_mirrors[-1].ffm_data_servers[-1]

    deviceid = ds.ffds_deviceid

    ops = [op.putfh(fh),
           op.getdeviceinfo(deviceid, LAYOUT4_FLEX_FILES, 0xffffffff, 0)]
    res = sess.compound(ops)
    check(res)

    gda = res.resarray[-1].gdir_device_addr

    p = FlexUnpacker(gda.da_addr_body)
    da = p.unpack_ff_device_addr4()
    p.done()

    rd_io = io_info4()
    wr_io = io_info4()

    rd_lat = ff_io_latency4()
    wr_lat = ff_io_latency4()

    for s in stats:
        dur = get_nfstime(s[1])

        # Did not capture these in the gathered traces
        offset = 0
        file_length = 0xffffffffffffffff
        rd_io.ii_count = 0
        rd_io.ii_bytes = 0
        wr_io.ii_count = 0
        wr_io.ii_bytes = 0

        rd_lat.ffil_ops_requested = s[5]
        rd_lat.ffil_bytes_requested = s[4]
        rd_lat.ffil_ops_completed = s[6]
        rd_lat.ffil_bytes_completed = s[2]
        rd_lat.ffil_bytes_not_delivered = s[3]
        rd_lat.ffil_total_busy_time = get_nfstime(s[7])
        rd_lat.ffil_aggregate_completion_time = get_nfstime(s[8])
        wr_lat.ffil_ops_requested = s[12]
        wr_lat.ffil_bytes_requested = s[11]
        wr_lat.ffil_ops_completed = s[13]
        wr_lat.ffil_bytes_completed = s[9]
        wr_lat.ffil_bytes_not_delivered = s[10]
        wr_lat.ffil_total_busy_time = get_nfstime(s[14])
        wr_lat.ffil_aggregate_completion_time = get_nfstime(s[15])

        sleeper = s[0]
        env.sleep(sleeper)
        fflu = ff_layoutupdate4(da.ffda_netaddrs[-1], ds.ffds_fh_vers[-1],
                                rd_lat, wr_lat, dur, True)
        p = FlexPacker()
        p.pack_ff_layoutupdate4(fflu)
        lu4 = layoutupdate4(LAYOUT4_FLEX_FILES, p.get_buffer())

        ops = [op.putfh(fh),
               op.layoutstats(offset, file_length, lo_stateid, rd_io, wr_io, deviceid, lu4)]
        res = sess.compound(ops)
        check(res)

    ops = [op.putfh(fh),
           op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
                           layoutreturn4(LAYOUTRETURN4_FILE,
                                         layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, "")))]
    res = sess.compound(ops)
    check(res)
    res = close_file(sess, fh, stateid=open_stateid)
    check(res)
Exemplo n.º 12
0
def _LayoutStats(t, env, stats):
    '''Loop over the provided layoutstats, sending them on in time
    '''
    sess = env.c1.new_pnfs_client_session(env.testname(t))

    # Create the file
    res = create_file(sess, env.testname(t))
    check(res)
    fh = res.resarray[-1].object
    open_stateid = res.resarray[-2].stateid
    lo_stateid = open_stateid

    ops = [
        op.putfh(fh),
        op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_RW, 0,
                     0xffffffffffffffff, 8192, lo_stateid, 0xffff)
    ]
    res = sess.compound(ops)
    check(res)
    lo_stateid = res.resarray[-1].logr_stateid
    check_seqid(lo_stateid, 1)

    layout = res.resarray[-1].logr_layout[-1]
    p = FlexUnpacker(layout.loc_body)
    opaque = p.unpack_ff_layout4()
    p.done()

    stats_hint = opaque.ffl_stats_collect_hint

    # Assume one mirror/storage device
    ds = opaque.ffl_mirrors[-1].ffm_data_servers[-1]

    deviceid = ds.ffds_deviceid

    ops = [
        op.putfh(fh),
        op.getdeviceinfo(deviceid, LAYOUT4_FLEX_FILES, 0xffffffff, 0)
    ]
    res = sess.compound(ops)
    check(res)

    gda = res.resarray[-1].gdir_device_addr

    p = FlexUnpacker(gda.da_addr_body)
    da = p.unpack_ff_device_addr4()
    p.done()

    rd_io = io_info4()
    wr_io = io_info4()

    rd_lat = ff_io_latency4()
    wr_lat = ff_io_latency4()

    for s in stats:
        dur = get_nfstime(s[1])

        # Did not capture these in the gathered traces
        offset = 0
        file_length = 0xffffffffffffffff
        rd_io.ii_count = 0
        rd_io.ii_bytes = 0
        wr_io.ii_count = 0
        wr_io.ii_bytes = 0

        rd_lat.ffil_ops_requested = s[5]
        rd_lat.ffil_bytes_requested = s[4]
        rd_lat.ffil_ops_completed = s[6]
        rd_lat.ffil_bytes_completed = s[2]
        rd_lat.ffil_bytes_not_delivered = s[3]
        rd_lat.ffil_total_busy_time = get_nfstime(s[7])
        rd_lat.ffil_aggregate_completion_time = get_nfstime(s[8])
        wr_lat.ffil_ops_requested = s[12]
        wr_lat.ffil_bytes_requested = s[11]
        wr_lat.ffil_ops_completed = s[13]
        wr_lat.ffil_bytes_completed = s[9]
        wr_lat.ffil_bytes_not_delivered = s[10]
        wr_lat.ffil_total_busy_time = get_nfstime(s[14])
        wr_lat.ffil_aggregate_completion_time = get_nfstime(s[15])

        sleeper = s[0]
        env.sleep(sleeper)
        fflu = ff_layoutupdate4(da.ffda_netaddrs[-1], ds.ffds_fh_vers[-1],
                                rd_lat, wr_lat, dur, True)
        p = FlexPacker()
        p.pack_ff_layoutupdate4(fflu)
        lu4 = layoutupdate4(LAYOUT4_FLEX_FILES, p.get_buffer())

        ops = [
            op.putfh(fh),
            op.layoutstats(offset, file_length, lo_stateid, rd_io, wr_io,
                           deviceid, lu4)
        ]
        res = sess.compound(ops)
        check(res)

    ops = [
        op.putfh(fh),
        op.layoutreturn(
            False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
            layoutreturn4(
                LAYOUTRETURN4_FILE,
                layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, "")))
    ]
    res = sess.compound(ops)
    check(res)
    res = close_file(sess, fh, stateid=open_stateid)
    check(res)