Skip to content

Commit

Permalink
Merge pull request #201 from maurizio-lombardi/max_lunx_sym
Browse files Browse the repository at this point in the history
target: remove the reference to MAX_LUN
  • Loading branch information
maurizio-lombardi authored Oct 24, 2023
2 parents e868e08 + 4424eba commit c7adb6f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions targetcli/ui_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,16 +1146,11 @@ def ui_command_create(self, storage_object, lun=None,
mapped_lun = 0
existing_mluns = [mlun.mapped_lun for mlun in acl.mapped_luns]
if mapped_lun in existing_mluns:
mapped_lun = None
for possible_mlun in six.moves.range(MappedLUN.MAX_LUN):
if possible_mlun not in existing_mluns:
mapped_lun = possible_mlun
break

if mapped_lun == None:
self.shell.log.warning(
"Cannot map new lun %s into ACL %s"
% (lun_object.lun, acl.node_wwn))
possible_mlun = 0
while possible_mlun in existing_mluns:
possible_mlun += 1
mapped_lun = possible_mlun

else:
mlun = MappedLUN(acl, mapped_lun, lun_object, write_protect=False)
self.shell.log.info("Created LUN %d->%d mapping in node ACL %s"
Expand Down

0 comments on commit c7adb6f

Please sign in to comment.