rtslib: explicitely import kmod's error and Kmod modules

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
This commit is contained in:
Maurizio Lombardi 2023-08-02 14:20:03 +02:00
parent 8d3d1b5b01
commit 4b02f1df76
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From c1378f28f7abce6f8993a43c34d5e287b092bb1e Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Wed, 2 Aug 2023 12:00:41 +0200
Subject: [PATCH] rtslib: explicitely import "kmod.error" and "kmod.Kmod"
While updating python-kmod to be able to be compiled with Cython 3.0,
I encountered a failure due to rtslib not finding the "error" and "Kmod"
modules.
$ targetcli
module 'kmod' has no attribute 'error'
If I explicitely import those two modules the failure goes away.
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
rtslib/utils.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rtslib/utils.py b/rtslib/utils.py
index 61e486a80836..630ebb721465 100644
--- a/rtslib/utils.py
+++ b/rtslib/utils.py
@@ -423,6 +423,8 @@ def modprobe(module):
try:
import kmod
+ import kmod.error
+ import kmod.Kmod
except ImportError:
process = subprocess.Popen(("modprobe", module),
stdout=subprocess.PIPE,
--
2.39.3

View File

@ -7,10 +7,11 @@ 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.76 Version: 2.1.76
Release: 3%{?dist} Release: 4%{?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-rtslib-explicitely-import-kmod.error-and-kmod.Kmod.patch
BuildArch: noarch BuildArch: noarch
%if %{with apidocs} %if %{with apidocs}
BuildRequires: epydoc BuildRequires: epydoc
@ -70,6 +71,7 @@ on system restart.
%prep %prep
%setup -q -n %{oname}-%{version} %setup -q -n %{oname}-%{version}
%patch0 -p1 %patch0 -p1
%patch1 -p1
%build %build
@ -126,6 +128,9 @@ install -m 644 doc/saveconfig.json.5 %{buildroot}%{_mandir}/man5/
%endif %endif
%changelog %changelog
* Wed Aug 02 2023 Maurizio Lombardi <mlombard@redhat.com> - 2.1.76-4
- Fix kmod import
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.76-3 * Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.76-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild