本文整理汇总了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']]
)
示例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)
示例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
示例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