Skip to content

Instantly share code, notes, and snippets.

@WaltHP
Created February 11, 2016 19:11
Show Gist options
  • Select an option

  • Save WaltHP/b33f65bc1fe858739804 to your computer and use it in GitHub Desktop.

Select an option

Save WaltHP/b33f65bc1fe858739804 to your computer and use it in GitHub Desktop.
def process_lun_id(lun_id):
if isinstance(lun_id, list):
processed = []
for x in lun_id:
if x > 255:
val = hex(x)
length = 18-len(val)
for i in range(length):
val+='0'
processed.append(val)
else:
processed.append(x)
return processed
else:
if lun_id < 255:
return lun_id
else:
processed = hex(lun_id)
length = 18-len(processed)
for i in range(length):
processed+='0'
return processed
for lun in range(0, 65536):
lun_id = process_lun_id(lun)
print "LUN(%s) = lun-%s" % (lun, lun_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment