rtslib: Add support for cpus_allowed_list attribute
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
This commit is contained in:
parent
99c1186289
commit
c0df8e2055
@ -0,0 +1,82 @@
|
||||
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
|
||||
|
@ -7,10 +7,11 @@ Name: python-rtslib
|
||||
License: ASL 2.0
|
||||
Summary: API for Linux kernel LIO SCSI target
|
||||
Version: 2.1.74
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
URL: https://github.com/open-iscsi/%{oname}
|
||||
Source: %{url}/archive/v%{version}/%{oname}-%{version}.tar.gz
|
||||
Patch0: 0001-disable-xen_pvscsi.patch
|
||||
Patch1: 0002-handle-target-kernel-module-new-attribute-cpus_allow.patch
|
||||
BuildArch: noarch
|
||||
%if %{with apidocs}
|
||||
BuildRequires: epydoc
|
||||
@ -70,6 +71,7 @@ on system restart.
|
||||
%prep
|
||||
%setup -q -n %{oname}-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
|
||||
%build
|
||||
@ -126,6 +128,9 @@ install -m 644 doc/saveconfig.json.5 %{buildroot}%{_mandir}/man5/
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Mar 30 2022 Maurizio Lombardi <mlombard@redhat.com> - 2.1.74-7
|
||||
- Add support for cpus_allowed_list attribute
|
||||
|
||||
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.74-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user