Update to version 2.1.75

This commit is contained in:
Maurizio Lombardi 2022-05-16 16:06:38 +02:00
parent c0df8e2055
commit 57ec8303ba
5 changed files with 7 additions and 133 deletions

1
.gitignore vendored
View File

@ -58,3 +58,4 @@
/rtslib-fb-2.1.fb69.tar.gz /rtslib-fb-2.1.fb69.tar.gz
/rtslib-fb-2.1.73.tar.gz /rtslib-fb-2.1.73.tar.gz
/rtslib-fb-2.1.74.tar.gz /rtslib-fb-2.1.74.tar.gz
/rtslib-fb-2.1.75.tar.gz

View File

@ -1,82 +0,0 @@
From 8d2543c4da62e962661011fea5b19252b9660822 Mon Sep 17 00:00:00 2001
From: Mingzhe Zou <zoumingzhe@qq.com>
Date: Fri, 11 Feb 2022 15:49:23 +0800
Subject: [PATCH] handle target kernel module new attribute cpus_allowed_list
target has been added cpus_allowed_list attribute in sysfs.
Therefore, the rtslib should handle the new attribute:
1. add cpus_allowed_list item in target_names_excludes
2. add cpus_allowed_list feature in ISCSIFabricModule
Signed-off-by: Zou Mingzhe mingzhe.zou@easystack.cn
---
rtslib/fabric.py | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/rtslib/fabric.py b/rtslib/fabric.py
index 86da3f6..eb8f115 100644
--- a/rtslib/fabric.py
+++ b/rtslib/fabric.py
@@ -118,9 +118,15 @@ from .utils import RTSLibError, modprobe, ignored
from .target import Target
from .utils import _get_auth_attr, _set_auth_attr
-version_attributes = set(["lio_version", "version"])
-discovery_auth_attributes = set(["discovery_auth"])
-target_names_excludes = version_attributes | discovery_auth_attributes
+excludes_list = [
+ # version_attributes
+ "lio_version", "version",
+ # discovery_auth_attributes
+ "discovery_auth",
+ # cpus_allowed_list_attributes
+ "cpus_allowed_list",
+]
+target_names_excludes = set(excludes_list)
class _BaseFabricModule(CFSNode):
@@ -144,7 +150,8 @@ class _BaseFabricModule(CFSNode):
self.name = name
self.spec_file = "N/A"
self._path = "%s/%s" % (self.configfs_dir, self.name)
- self.features = ('discovery_auth', 'acls', 'auth', 'nps', 'tpgts')
+ self.features = ('discovery_auth', 'acls', 'auth', 'nps', 'tpgts',
+ 'cpus_allowed_list')
self.wwn_types = ('free',)
self.kernel_module = "%s_target_mod" % self.name
@@ -220,6 +227,18 @@ class _BaseFabricModule(CFSNode):
raise RTSLibError("Fabric module %s does not implement "
+ "the %s feature" % (self.name, feature))
+ def _get_cpus_allowed_list(self):
+ self._check_self()
+ self._assert_feature('cpus_allowed_list')
+ path = "%s/cpus_allowed_list" % self.path
+ return fread(path)
+
+ def _set_cpus_allowed_list(self, allowed):
+ self._check_self()
+ self._assert_feature('cpus_allowed_list')
+ path = "%s/cpus_allowed_list" % self.path
+ fwrite(path, allowed)
+
def clear_discovery_auth_settings(self):
self._check_self()
self._assert_feature('discovery_auth')
@@ -267,6 +286,11 @@ class _BaseFabricModule(CFSNode):
self._assert_feature('discovery_auth')
_set_auth_attr(self, *args, **kwargs)
+ cpus_allowed_list = \
+ property(_get_cpus_allowed_list,
+ _set_cpus_allowed_list,
+ doc="Set or get the cpus_allowed_list attribute.")
+
discovery_enable_auth = \
property(_get_discovery_enable_auth,
_set_discovery_enable_auth,
--
2.27.0

View File

@ -6,12 +6,11 @@
Name: python-rtslib Name: python-rtslib
License: ASL 2.0 License: ASL 2.0
Summary: API for Linux kernel LIO SCSI target Summary: API for Linux kernel LIO SCSI target
Version: 2.1.74 Version: 2.1.75
Release: 7%{?dist} Release: 1%{?dist}
URL: https://github.com/open-iscsi/%{oname} URL: https://github.com/open-iscsi/%{oname}
Source: %{url}/archive/v%{version}/%{oname}-%{version}.tar.gz Source: %{url}/archive/v%{version}/%{oname}-%{version}.tar.gz
Patch0: 0001-disable-xen_pvscsi.patch Patch0: 0001-disable-xen_pvscsi.patch
Patch1: 0002-handle-target-kernel-module-new-attribute-cpus_allow.patch
BuildArch: noarch BuildArch: noarch
%if %{with apidocs} %if %{with apidocs}
BuildRequires: epydoc BuildRequires: epydoc
@ -71,7 +70,6 @@ on system restart.
%prep %prep
%setup -q -n %{oname}-%{version} %setup -q -n %{oname}-%{version}
%patch0 -p1 %patch0 -p1
%patch1 -p1
%build %build
@ -128,6 +126,9 @@ install -m 644 doc/saveconfig.json.5 %{buildroot}%{_mandir}/man5/
%endif %endif
%changelog %changelog
* Mon May 16 2022 Maurizio Lombardi <mlombard@redhat.com> - 2.1.75-1
- Update to new upstream version
* Wed Mar 30 2022 Maurizio Lombardi <mlombard@redhat.com> - 2.1.74-7 * Wed Mar 30 2022 Maurizio Lombardi <mlombard@redhat.com> - 2.1.74-7
- Add support for cpus_allowed_list attribute - Add support for cpus_allowed_list attribute

View File

@ -1,46 +0,0 @@
diff --git a/rtslib/root.py b/rtslib/root.py
index 246c285..d558445 100644
--- a/rtslib/root.py
+++ b/rtslib/root.py
@@ -70,6 +70,7 @@ class RTSRoot(CFSNode):
base kernel modules (tcm)
'''
super(RTSRoot, self).__init__()
+ modprobe('configfs')
mount_configfs()
modprobe('target_core_mod')
self._create_in_cfs_ine('any')
@@ -247,7 +248,7 @@ class RTSRoot(CFSNode):
if not restore_file:
restore_file = default_save_file
- with open(from_file, "r") as f:
+ with open(restore_file, "r") as f:
config = json.loads(f.read())
return self.restore(config, clear_existing=True,
abort_on_error=abort_on_error)
diff --git a/scripts/targetctl b/scripts/targetctl
index db8e0d2..bdf59f4 100755
--- a/scripts/targetctl
+++ b/scripts/targetctl
@@ -42,8 +42,7 @@ def save(to_file):
RTSRoot().save_to_file(save_file=to_file)
def restore(from_file):
- errors = RTSRoot().restore_from_file(restore_file=from_file,
- clear_existing=True)
+ errors = RTSRoot().restore_from_file(restore_file=from_file)
if errors:
print("Restore failed, %d errors:" % len(errors), file=err)
diff --git a/setup.py b/setup.py
index 7f41d52..5886fbc 100755
--- a/setup.py
+++ b/setup.py
@@ -27,5 +27,6 @@ setup (
maintainer_email = 'agrover@redhat.com',
url = 'http://github.com/agrover/rtslib-fb',
packages = ['rtslib'],
+ scripts = ['scripts/targetctl'],
use_2to3 = True,
)

View File

@ -1 +1 @@
SHA512 (rtslib-fb-2.1.74.tar.gz) = 181b57f699dd4e6bc050585e1abffe75a7eaf5ae8325220d61d37f932912f2cec878c4643172c584f0d4c231441d25ff0e09aa1f48c2305061b75acdce051c86 SHA512 (rtslib-fb-2.1.75.tar.gz) = 204729e779da1d0961ecff822c6ce914de5fa80e8159f440e0e69a7ba986da6d627a6377c143043d855bcaacaf086f4c73f3ccb4697dfaf061434c197ae24c3e