Merge branch 'pr9'

This commit is contained in:
Chris Leech 2020-09-17 09:19:38 -07:00
commit 0b630fa962
5 changed files with 228 additions and 84 deletions

158
0001-unit-file-tweaks.patch Normal file
View File

@ -0,0 +1,158 @@
From 52806cfdca12164f0757dcecd05c25c6aa4dda43 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 4 Jun 2019 13:23:32 -0700
Subject: [PATCH] unit file tweaks
---
etc/systemd/iscsi-mark-root-nodes | 29 +++++++++++++++++++++++++++++
etc/systemd/iscsi-onboot.service | 15 +++++++++++++++
etc/systemd/iscsi-shutdown.service | 14 ++++++++++++++
etc/systemd/iscsi.service | 10 +++++++---
etc/systemd/iscsid.service | 4 ++--
etc/systemd/iscsiuio.service | 2 +-
6 files changed, 68 insertions(+), 6 deletions(-)
create mode 100755 etc/systemd/iscsi-mark-root-nodes
create mode 100644 etc/systemd/iscsi-onboot.service
create mode 100644 etc/systemd/iscsi-shutdown.service
diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes
new file mode 100755
index 0000000..e5a09c6
--- /dev/null
+++ b/etc/systemd/iscsi-mark-root-nodes
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+ISCSIADM=/usr/sbin/iscsiadm
+start_iscsid=0
+start_iscsiuio=0
+
+while read t num p target flash; do
+ # strip tag number from portal, keep "ip:port"
+ portal=${p%,*}
+ transport=${t%:}
+
+ # use session number to find the iface name in use
+ num=${num#[}; num=${num%]}
+ iface=$(iscsiadm -m session -r $num | grep iface.iscsi_ifacename | cut -d= -f2)
+
+ $ISCSIADM -m node -p $portal -T $target -I $iface -o update -n node.startup -v onboot
+
+ start_iscsid=1
+
+ if [ "$transport" = bnx2i ] || [ "$transport" = qedi ]; then
+ start_iscsiuio=1
+ fi
+done < <( $ISCSIADM -m session )
+
+# force iscsid and iscsiuio to start if needed for
+# recovering sessions created in the initrd
+
+if [ "$start_iscsid" -eq 1 ]; then
+ systemctl --no-block start iscsid.service
diff --git a/etc/systemd/iscsi-onboot.service b/etc/systemd/iscsi-onboot.service
new file mode 100644
index 0000000..42ced68
--- /dev/null
+++ b/etc/systemd/iscsi-onboot.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Special handling of early boot iSCSI sessions
+Documentation=man:iscsiadm(8) man:iscsid(8)
+DefaultDependencies=no
+RefuseManualStart=true
+Before=iscsi.service
+After=systemd-remount-fs.service
+ConditionDirectoryNotEmpty=/sys/class/iscsi_session
+
+[Service]
+Type=oneshot
+ExecStart=-/usr/libexec/iscsi-mark-root-nodes
+
+[Install]
+WantedBy=sysinit.target
diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service
new file mode 100644
index 0000000..6848a72
--- /dev/null
+++ b/etc/systemd/iscsi-shutdown.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Logout off all iSCSI sessions on shutdown
+Documentation=man:iscsid(8) man:iscsiadm(8)
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
+Before=remote-fs-pre.target
+Wants=remote-fs-pre.target
+RefuseManualStop=yes
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=-/usr/bin/true
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index 2f2bf81..51810c9 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -1,16 +1,20 @@
[Unit]
Description=Login and scanning of iSCSI devices
Documentation=man:iscsiadm(8) man:iscsid(8)
+DefaultDependencies=no
+Conflicts=shutdown.target
Before=remote-fs.target
+After=systemd-remount-fs.service iscsiuio.service
After=network.target network-online.target
After=iscsid.service iscsi-init.service
Requires=iscsid.socket iscsi-init.service
+Wants=remote-fs-pre.target iscsi-shutdown.service
+ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes
[Service]
Type=oneshot
-ExecStart=/sbin/iscsiadm -m node --loginall=automatic
-ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
-ExecStop=/sbin/iscsiadm -m node --logoutall=manual
+ExecStart=-/usr/sbin/iscsiadm -m node --loginall=automatic
+ExecReload=-/usr/sbin/iscsiadm -m node --loginall=automatic
SuccessExitStatus=21 15
RemainAfterExit=true
diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
index 648ceea..79e63cd 100644
--- a/etc/systemd/iscsid.service
+++ b/etc/systemd/iscsid.service
@@ -1,6 +1,6 @@
[Unit]
Description=Open-iSCSI
-Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
+Documentation=man:iscsid(8) man:iscsiuio(8)
DefaultDependencies=no
After=network.target iscsiuio.service
Before=remote-fs-pre.target
@@ -9,7 +9,7 @@ Wants=remote-fs-pre.target
[Service]
Type=notify
NotifyAccess=main
-ExecStart=/sbin/iscsid -f
+ExecStart=/usr/sbin/iscsid -f
KillMode=mixed
Restart=on-failure
diff --git a/etc/systemd/iscsiuio.service b/etc/systemd/iscsiuio.service
index 923e019..f92b0e7 100644
--- a/etc/systemd/iscsiuio.service
+++ b/etc/systemd/iscsiuio.service
@@ -12,7 +12,7 @@ Wants=remote-fs-pre.target
[Service]
Type=notify
NotifyAccess=main
-ExecStart=/sbin/iscsiuio -f
+ExecStart=/usr/sbin/iscsiuio -f
KillMode=mixed
Restart=on-failure
--
2.26.2

View File

@ -45,14 +45,14 @@ index 2499d9a..c05814a 100644
--------
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index 70985af..2f3a28c 100644
index f21ed3d..56c56a9 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
@@ -19,7 +19,7 @@
# the time then leave this attribute commented out.
#
# Default for Fedora and RHEL. (uncomment to activate).
-# iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.soccket
-# iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket
+iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket
#
# Default if you are not using systemd (uncomment to activate)
@ -68,7 +68,7 @@ index 70985af..2f3a28c 100644
# For "automatic" startup nodes, setting this to "Yes" will try logins on each
# available iface until one succeeds, and then stop. The default "No" will try
@@ -264,28 +264,27 @@ node.conn[0].iscsi.MaxXmitDataSegmentLength = 0
@@ -271,25 +271,22 @@ node.conn[0].iscsi.MaxXmitDataSegmentLength = 0
discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
# To allow the targets to control the setting of the digest checking,
@ -77,7 +77,6 @@ index 70985af..2f3a28c 100644
+# the following lines (Data digests are not supported.):
#node.conn[0].iscsi.HeaderDigest = CRC32C,None
-#node.conn[0].iscsi.DataDigest = CRC32C,None
+
#
# To allow the targets to control the setting of the digest checking,
# with the initiator requesting a preference of disabling the checking,
@ -94,16 +93,13 @@ index 70985af..2f3a28c 100644
#
# To disable digest checking for the header and/or data part of
-# iSCSI PDUs, uncomment one or both of the following lines:
+# iSCSI PDUs, uncomment the following line:
#node.conn[0].iscsi.HeaderDigest = None
-#node.conn[0].iscsi.HeaderDigest = None
-#node.conn[0].iscsi.DataDigest = None
+# iSCSI PDUs, uncomment the following line:
+node.conn[0].iscsi.HeaderDigest = None
#
# The default is to never use DataDigests or HeaderDigests.
#
+node.conn[0].iscsi.HeaderDigest = None
# For multipath configurations, you may want more than one session to be
# created on each iface record. If node.session.nr_sessions is greater
diff --git a/usr/idbm.c b/usr/idbm.c
index a2332cc..aed08f2 100644
--- a/usr/idbm.c

View File

@ -15,7 +15,7 @@ index 4fa9179..c5c9e76 100644
* This may not be the same value as the kernel versions because
* some other maintainer could merge a patch without going through us
*/
-#define ISCSI_VERSION_STR "2.1.1"
-#define ISCSI_VERSION_STR "2.1.2"
+#define ISCSI_VERSION_STR "6.2.1.1-0"
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"

View File

@ -1,15 +1,15 @@
From d4ed4972df1ffe9381e33f2800f8e574f632948c Mon Sep 17 00:00:00 2001
From a37c8753f277c156bcd4b3e7596931e3de2e67d7 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 2 Mar 2020 15:21:30 -0800
Subject: [PATCH 1/1] iscsi_if.h replace zero-length array with flexible-array
Date: Tue, 11 Aug 2020 21:00:29 +0200
Subject: [PATCH] iscsi_if.h replace zero-length array with flexible-array
member
---
include/iscsi_if.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
include/iscsi_if.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 2d46214..e8cee0d 100644
index 5a1c614..e8cee0d 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -337,7 +337,7 @@ enum iscsi_param_type {
@ -39,24 +39,6 @@ index 2d46214..e8cee0d 100644
} __attribute__((__packed__));
enum iscsi_discovery_parent_type {
@@ -841,7 +841,7 @@ struct iscsi_stats {
* up to ISCSI_STATS_CUSTOM_MAX
*/
uint32_t custom_length;
- struct iscsi_stats_custom custom[0]
+ struct iscsi_stats_custom custom[]
__attribute__ ((aligned (sizeof(uint64_t))));
};
@@ -972,7 +972,7 @@ struct iscsi_offload_host_stats {
* up to ISCSI_HOST_STATS_CUSTOM_MAX
*/
uint32_t custom_length;
- struct iscsi_host_stats_custom custom[0]
+ struct iscsi_host_stats_custom custom[]
__attribute__ ((aligned (sizeof(uint64_t))));
};
--
2.21.1
2.26.2

View File

@ -1,6 +1,6 @@
%global open_iscsi_version 2.1
%global open_iscsi_build 1
%global commit0 ac87641cd3d87b38480e212e7bdff7a44810036d
%global open_iscsi_build 2
%global commit0 802688debcd88c48edabe86deb7e7ed47ebadc26
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
# Disable python2 build by default
@ -9,14 +9,14 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
Release: 0.git%{shortcommit0}%{?dist}.2
Release: 0.git%{shortcommit0}%{?dist}
License: GPLv2+
URL: http://www.open-iscsi.org
Source0: https://github.com/open-iscsi/open-iscsi/archive/%{commit0}.tar.gz#/open-iscsi-%{shortcommit0}.tar.gz
Source4: 04-iscsi
Source5: iscsi-tmpfiles.conf
Patch0001: 0001-service-file-tweaks.patch
Patch0001: 0001-unit-file-tweaks.patch
Patch0002: 0002-idmb_rec_write-check-for-tpgt-first.patch
Patch0003: 0003-idbm_rec_write-seperate-old-and-new-style-writes.patch
Patch0004: 0004-idbw_rec_write-pick-tpgt-from-existing-record.patch
@ -36,10 +36,9 @@ Patch0017: 0017-dont-install-scripts.patch
Patch0018: 0018-use-var-lib-iscsi-in-libopeniscsiusr.patch
Patch0019: 0019-Coverity-scan-fixes.patch
Patch0020: 0020-fix-upstream-build-breakage-of-iscsiuio-LDFLAGS.patch
Patch0021: 0021-improve-systemd-service-files-for-boot-session-handl.patch
Patch0022: 0022-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
Patch0023: 0023-iscsi_if.h-replace-zero-length-array-with-flexible-a.patch
Patch0024: 0001-stop-using-Werror-for-now.patch
Patch0021: 0021-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
Patch0022: 0022-iscsi_if.h-replace-zero-length-array-with-flexible-a.patch
Patch0023: 0001-stop-using-Werror-for-now.patch
BuildRequires: flex bison doxygen kmod-devel systemd-units
BuildRequires: autoconf automake libtool libmount-devel openssl-devel
@ -65,21 +64,21 @@ Protocol networks.
# I don't think we're ready to expose these just yet
# For now just add the needed library to the base package
#%package -n libopeniscsiusr
#%%package -n libopeniscsiusr
#Summary: library providing access to Open-iSCSI initiator functionality
#Group: Development/Libraries
#License: BSD
#%description -n libopeniscsiusr
#%%description -n libopeniscsiusr
#The libopeniscsiusr library provides a C API for access to the Open-iSCSI
#initiator. It is used by the Open-iSCSI command line tools.
#%package -n libopeniscsiusr-devel
#%%package -n libopeniscsiusr-devel
#Summary: Development files for libopeniscsiusr
#Group: Development/Libraries
#Requires: libopeniscsiusr = %{version}-%{release}
#Requires: libopeniscsiusr = %%{version}-%%{release}
#%description -n libopeniscsiusr-devel
#%%description -n libopeniscsiusr-devel
#The libopeniscsiusr-devel package contains libraries and header files for
#developing applications that use libopeniscsiusr.
@ -111,7 +110,8 @@ BuildRequires: python2-setuptools
%description -n python2-%{name}
The %{name}-python2 package contains Python %{python2_version} bindings to the
libiscsi interface for interacting with %{name}
%endif # with python2
%endif
# ended with python2
%package -n python3-%{name}
%{?python_provide:%python_provide python3-%{name}}
@ -145,7 +145,8 @@ cd ..
pushd libiscsi
%if %{with python2}
%py2_build
%endif # with python2
%endif
# ended with python2
%py3_build
touch -r libiscsi.doxy html/*
popd
@ -154,7 +155,7 @@ popd
%install
%{__make} DESTDIR=%{?buildroot} install_programs install_doc install_etc install_libopeniscsiusr
# upstream makefile doesn't get everything the way we like it
#rm $RPM_BUILD_ROOT%{_sbindir}/iscsi_discovery
#rm $RPM_BUILD_ROOT%%{_sbindir}/iscsi_discovery
rm $RPM_BUILD_ROOT%{_mandir}/man8/iscsi_discovery.8
rm $RPM_BUILD_ROOT%{_mandir}/man8/iscsi_fw_login.8
%{__install} -pm 755 usr/iscsistart $RPM_BUILD_ROOT%{_sbindir}
@ -172,12 +173,13 @@ rm $RPM_BUILD_ROOT%{_mandir}/man8/iscsi_fw_login.8
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/ifaces
# for %%ghost
%{__install} -d $RPM_BUILD_ROOT/var/lock/iscsi
touch $RPM_BUILD_ROOT/var/lock/iscsi/lock
%{__install} -d $RPM_BUILD_ROOT%{_rundir}/lock/iscsi
touch $RPM_BUILD_ROOT%{_rundir}/lock/iscsi/lock
%{__install} -d $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi-init.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi-shutdown.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsid.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsid.socket $RPM_BUILD_ROOT%{_unitdir}
@ -201,12 +203,14 @@ touch $RPM_BUILD_ROOT/var/lock/iscsi/lock
%if %{with python2}
%{__install} -d $RPM_BUILD_ROOT%{python2_sitearch}
%endif # with python2
%endif
# ended with python2
%{__install} -d $RPM_BUILD_ROOT%{python3_sitearch}
pushd libiscsi
%if %{with python2}
%py2_install
%endif # with python2
%endif
# ended with python2
%py3_install
popd
@ -214,22 +218,9 @@ popd
%post
%systemd_post iscsi.service iscsi-shutdown.service iscsid.service iscsid.socket
if [ $1 -eq 1 ]; then
if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then
echo "InitiatorName=`/usr/sbin/iscsi-iname`" > %{_sysconfdir}/iscsi/initiatorname.iscsi
fi
# enable socket activation and persistant session startup by default
/bin/systemctl enable iscsi.service >/dev/null 2>&1 || :
/bin/systemctl enable iscsid.socket >/dev/null 2>&1 || :
fi
%post iscsiuio
%systemd_post iscsiuio.service iscsiuio.socket
if [ $1 -eq 1 ]; then
/bin/systemctl enable iscsiuio.socket >/dev/null 2>&1 || :
fi
%preun
%systemd_preun iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket
@ -277,9 +268,9 @@ fi
%dir %{_sharedstatedir}/iscsi/slp
%dir %{_sharedstatedir}/iscsi/ifaces
%dir %{_sharedstatedir}/iscsi/send_targets
%ghost %{_var}/lock/iscsi
%ghost %{_var}/lock/iscsi/lock
%ghost %{_rundir}/lock/iscsi
%{_unitdir}/iscsi.service
%{_unitdir}/iscsi-init.service
%{_unitdir}/iscsi-shutdown.service
%{_unitdir}/iscsid.service
%{_unitdir}/iscsid.socket
@ -303,19 +294,20 @@ fi
%exclude %{_includedir}/libopeniscsiusr.h
%exclude %{_includedir}/libopeniscsiusr_common.h
%exclude %{_includedir}/libopeniscsiusr_iface.h
%exclude %{_includedir}/libopeniscsiusr_node.h
%exclude %{_includedir}/libopeniscsiusr_session.h
%exclude %{_libdir}/pkgconfig/libopeniscsiusr.pc
# %files -n libopeniscsiusr
# %{_libdir}/libopeniscsiusr.so.*
# %%files -n libopeniscsiusr
# %%{_libdir}/libopeniscsiusr.so.*
#
# %files -n libopeniscsiusr-devel
# %{_libdir}/libopeniscsiusr.so
# %{_includedir}/libopeniscsiusr.h
# %{_includedir}/libopeniscsiusr_common.h
# %{_includedir}/libopeniscsiusr_iface.h
# %{_includedir}/libopeniscsiusr_session.h
# %{_libdir}/pkgconfig/libopeniscsiusr.pc
# %%files -n libopeniscsiusr-devel
# %%{_libdir}/libopeniscsiusr.so
# %%{_includedir}/libopeniscsiusr.h
# %%{_includedir}/libopeniscsiusr_common.h
# %%{_includedir}/libopeniscsiusr_iface.h
# %%{_includedir}/libopeniscsiusr_session.h
# %%{_libdir}/pkgconfig/libopeniscsiusr.pc
%files iscsiuio
%{_sbindir}/iscsiuio
@ -332,19 +324,35 @@ fi
%if %{with python2}
%files -n python2-%{name}
%{python2_sitearch}/*
%endif # with python2
%endif
# ended with python2
%files -n python3-%{name}
%{python3_sitearch}/*
%changelog
* Tue Aug 11 2020 Christian Glombek <cglombek@redhat.com> - 6.2.1.2-0.git802688d
- Update to upstream v2.1.2
- Remove systemctl enable calls, as this is now handled by Fedora presets
- per the guidelines
- Remove initiator name generation, as this is now handled by an init service
- Install ghost lockfile and dir to /run instead of /var
- Rebased/fixed up patches
- Fixed macros in comments and comments after macros
- Merged service-file-tweaks.patch and
- improve-systemd-service-files-for-boot-session-handl.patch
- into unit-file-tweaks.patch
- Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1493296
- Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1729740
- Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1834509
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 6.2.1.1-0.gitac87641.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 6.2.1.1-0.gitac87641.1
- Rebuilt for Python 3.9
* Mon Mar 02 2020 Chris Leech <cleech@redhat.com> - 6.2.1.1-0.gitac87641.
* Mon Mar 02 2020 Chris Leech <cleech@redhat.com> - 6.2.1.1-0.gitac87641
- rebase to new upstream v2.1.1
- enhanced CHAP options are now a configuration to deal with broken targets (#1774746)
@ -370,7 +378,7 @@ fi
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu May 30 2019 Chris Leech <cleech@redhat.com> - 6.2.0.876-9.gitf3c8e90
- FTBFS: %systemd_postun scriptlets need service files as an argument
- FTBFS: %%systemd_postun scriptlets need service files as an argument
* Tue Feb 12 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 6.2.0.876-8.gitf3c8e90
- Remove obsolete scriptlets