File: target-remove-the-reference-to-max_lun.patch

package info (click to toggle)
targetcli-fb 1%3A2.1.53-1.3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 492 kB
  • sloc: python: 2,878; makefile: 70; sh: 21
file content (41 lines) | stat: -rw-r--r-- 1,752 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Thu, 19 Oct 2023 14:15:54 +0200
X-Dgit-Generated: 1:2.1.53-1.3 ae9718771e0894b5cb3d6f17e9109b44e364d0c8
Subject: target: remove the reference to MAX_LUN

The MappedLUN.MAX_LUN symbol has been removed from rtslib.
Remove the reference to it.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Bug-Debian: https://bugs.debian.org/1109887
Origin: https://github.com/open-iscsi/targetcli-fb/commit/4424eba4ba9f5c66c0cd8691fd4aad87ee19640f
Last-Update: 2025-07-25

---

diff --git a/targetcli/ui_target.py b/targetcli/ui_target.py
index e8ba6c6..2c46765 100644
--- a/targetcli/ui_target.py
+++ b/targetcli/ui_target.py
@@ -1146,16 +1146,11 @@ class UILUNs(UINode):
                     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"