当前位置: 首页>>代码示例>>Python>>正文


Python SCSI.readcapacity16方法代码示例

本文整理汇总了Python中pyscsi.pyscsi.scsi.SCSI.readcapacity16方法的典型用法代码示例。如果您正苦于以下问题:Python SCSI.readcapacity16方法的具体用法?Python SCSI.readcapacity16怎么用?Python SCSI.readcapacity16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyscsi.pyscsi.scsi.SCSI的用法示例。


在下文中一共展示了SCSI.readcapacity16方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import readcapacity16 [as 别名]
def main():
    i = 1
    lba = 0
    while i < len(sys.argv):
        if sys.argv[i] == '--help':
            return usage()
        if sys.argv[i] == '-l':
            del sys.argv[i]
            lba = int(sys.argv[i], 10)
            del sys.argv[i]
            continue
        i += 1

    if len(sys.argv) < 2:
        return usage()

    device = sys.argv[1]

    sd = SCSIDevice(device)
    s = SCSI(sd)

    r = s.readcapacity16().result
    if not r['lbpme']:
        print 'LUN is fully provisioned.'
        return

    r = s.getlbastatus(lba).result
    for i in range(len(r['lbas'])):
        print 'LBA:%d-%d %s' % (
            r['lbas'][i]['lba'],
            r['lbas'][i]['lba'] + r['lbas'][i]['num_blocks'] - 1,
            P_STATUS[r['lbas'][i]['p_status']]
        )
开发者ID:Katana-Steel,项目名称:python-scsi,代码行数:35,代码来源:getlbastatus.py

示例2: main

# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import readcapacity16 [as 别名]
def main(device):
    try:
        sd = SCSIDevice(device)
        s = SCSI(sd)

        print 'ReadCapacity16'
        print '==========================================\n'
        r = s.readcapacity16().result
        for k, v in r.iteritems():
            print '%s - %s' % (k, v)
    except Exception as e:
        print(e.message)
开发者ID:Katana-Steel,项目名称:python-scsi,代码行数:14,代码来源:readcapacity16.py

示例3: main

# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import readcapacity16 [as 别名]
def main():
    dev = MockReadCapacity16()
    dev.opcodes = sbc
    s = SCSI(dev)

    i = s.readcapacity16().result
    assert i['returned_lba'] == 281474976710656
    assert i['block_length'] == 4096
    assert i['p_type'] == 4
    assert i['prot_en'] == 1
    assert i['p_i_exponent'] == 8
    assert i['lbppbe'] == 8
    assert i['lbpme'] == 1
    assert i['lbprz'] == 1
    assert i['lowest_aligned_lba'] == 8193

    d = ReadCapacity16.unmarshall_datain(ReadCapacity16.marshall_datain(i))
    assert d == i
开发者ID:Katana-Steel,项目名称:python-scsi,代码行数:20,代码来源:test_unmarshall_readcapacity16.py

示例4: main

# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import readcapacity16 [as 别名]
def main():
    dev = MockReadCapacity16()
    dev.opcodes = sbc
    s = SCSI(dev)

    r = s.readcapacity16(alloclen=37)
    cdb = r.cdb
    assert cdb[0] == s.device.opcodes.SBC_OPCODE_9E.value
    assert cdb[1] == s.device.opcodes.SBC_OPCODE_9E.serviceaction.READ_CAPACITY_16
    assert cdb[2:10] == bytearray(8)
    assert scsi_ba_to_int(cdb[10:14]) == 37
    assert cdb[14:16] == bytearray(2)
    cdb = r.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.SBC_OPCODE_9E.value
    assert cdb['service_action'] == s.device.opcodes.SBC_OPCODE_9E.serviceaction.READ_CAPACITY_16
    assert cdb['alloc_len'] == 37

    d = ReadCapacity16.unmarshall_cdb(ReadCapacity16.marshall_cdb(cdb))
    assert d == cdb
开发者ID:Katana-Steel,项目名称:python-scsi,代码行数:21,代码来源:test_cdb_readcapacity16.py


注:本文中的pyscsi.pyscsi.scsi.SCSI.readcapacity16方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。