From ff04e1921729bb504733f4061060f25a73b490bf Mon Sep 17 00:00:00 2001 From: yanshuai01 Date: Wed, 8 May 2024 15:54:29 +0800 Subject: [PATCH] target: remove the reference to MAX_LUN (cherry picked from commit 8ebaf3da26206bea549aee672dd77bb5f080675f) --- remove-reference-to-MAX_LUN.patch | 43 +++++++++++++++++++++++++++++++ targetcli.spec | 8 ++++-- 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 remove-reference-to-MAX_LUN.patch diff --git a/remove-reference-to-MAX_LUN.patch b/remove-reference-to-MAX_LUN.patch new file mode 100644 index 0000000..26b7f75 --- /dev/null +++ b/remove-reference-to-MAX_LUN.patch @@ -0,0 +1,43 @@ +From 4424eba4ba9f5c66c0cd8691fd4aad87ee19640f Mon Sep 17 00:00:00 2001 +From: Maurizio Lombardi +Date: Thu, 19 Oct 2023 14:15:54 +0200 +Subject: [PATCH] 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 + +--- + targetcli/ui_target.py | 15 +++++---------- + 1 file changed, 5 insertions(+), 10 deletions(-) + +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" +-- +2.27.0 + diff --git a/targetcli.spec b/targetcli.spec index 239f8ba..bc09fe9 100644 --- a/targetcli.spec +++ b/targetcli.spec @@ -2,9 +2,10 @@ Name: targetcli License: ASL 2.0 Summary: Generic SCSI target CLI shell Version: 2.1.56 -Release: 1 +Release: 2 URL: https://github.com/open-iscsi/targetcli-fb Source: https://github.com/open-iscsi/targetcli-fb/archive/v%{version}/targetcli-fb-%{version}.tar.gz +Patch01: remove-reference-to-MAX_LUN.patch BuildArch: noarch BuildRequires: python3-devel python3-setuptools systemd Requires: python3-rtslib target-restore python3-configshell python3-six python3-dbus python3-gobject-base @@ -20,7 +21,7 @@ Summary: Help document for the %{name} package Help document for the %{name} package. %prep -%setup -q -n targetcli-fb-%{version} +%autosetup -n targetcli-fb-%{version} -p1 %build %py3_build @@ -47,6 +48,9 @@ install -m 644 systemd/* %{buildroot}%{_unitdir}/ %{_mandir}/man8/targetcli*.8* %changelog +* Wed May 8 2024 yanshuai - 2.1.56-2 +- remove the reference to MAX_LUN + * Mon Jul 24 2023 zhangchenglin - 2.1.56-1 - upgrade version to 2.1.56 -- Gitee