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)
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)