created iscsi-shutdown.service to ensure that session cleanup happens

Resolves: #1166713
This commit is contained in:
Chris Leech 2015-01-13 19:19:38 -08:00
parent 0ed757e32c
commit 0fab0a7413
3 changed files with 71 additions and 4 deletions

View File

@ -0,0 +1,55 @@
From 56d9d1c6a02dcad0915c0673f9cd2e653c86302f Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 13 Jan 2015 16:30:01 -0800
Subject: [PATCH] 0171-make-session-shutdown-a-seperate-service.patch
---
etc/systemd/iscsi-shutdown.service | 14 ++++++++++++++
etc/systemd/iscsi.service | 3 +--
2 files changed, 15 insertions(+), 2 deletions(-)
create mode 100644 etc/systemd/iscsi-shutdown.service
diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service
new file mode 100644
index 0000000..23758e9
--- /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
+ExecStop=-/sbin/iscsiadm -m node --logoutall=all
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index ad7be34..2736956 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -5,7 +5,7 @@ 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
+Wants=remote-fs-pre.target iscsi-shutdown.service
ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes
ConditionDirectoryNotEmpty=|/sys/class/iscsi_session
@@ -14,7 +14,6 @@ Type=oneshot
RemainAfterExit=true
ExecStart=-/usr/libexec/iscsi-mark-root-nodes
ExecStart=-/sbin/iscsiadm -m node --loginall=automatic
-ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic
ExecReload=-/sbin/iscsiadm -m node --loginall=automatic
[Install]
--
2.1.0

View File

@ -16,7 +16,7 @@ index a090522..aef0c3d 100644
* some other maintainer could merge a patch without going through us * some other maintainer could merge a patch without going through us
*/ */
-#define ISCSI_VERSION_STR "2.0-873" -#define ISCSI_VERSION_STR "2.0-873"
+#define ISCSI_VERSION_STR "6.2.0.873-24" +#define ISCSI_VERSION_STR "6.2.0.873-26"
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"
#endif #endif

View File

@ -4,7 +4,7 @@
Summary: iSCSI daemon and utility programs Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build} Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
Release: 25%{?dist} Release: 26%{?dist}
Group: System Environment/Daemons Group: System Environment/Daemons
License: GPLv2+ License: GPLv2+
URL: http://www.open-iscsi.org URL: http://www.open-iscsi.org
@ -123,6 +123,7 @@ Patch168: 0168-update-handling-of-boot-sessions.patch
Patch169: 0169-update-iscsi.service-for-boot-session-recovery.patch Patch169: 0169-update-iscsi.service-for-boot-session-recovery.patch
Patch170: 0170-fix-systemd-unit-wants.patch Patch170: 0170-fix-systemd-unit-wants.patch
Patch171: 0171-iscsiuio-strict-aliasing.patch Patch171: 0171-iscsiuio-strict-aliasing.patch
Patch172: 0172-move-cleanup-to-seperate-service.patch
# version string, needs to be updated with each build # version string, needs to be updated with each build
Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
@ -272,6 +273,7 @@ developing applications that use %{name}.
%patch169 -p1 %patch169 -p1
%patch170 -p1 %patch170 -p1
%patch171 -p1 %patch171 -p1
%patch172 -p1
# version string # version string
%patch199 -p1 %patch199 -p1
@ -323,6 +325,7 @@ touch $RPM_BUILD_ROOT/var/lock/iscsi/lock
%{__install} -d $RPM_BUILD_ROOT%{_unitdir} %{__install} -d $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi.service $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsi.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.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsid.socket $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsid.socket $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsiuio.service $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsiuio.service $RPM_BUILD_ROOT%{_unitdir}
@ -351,7 +354,7 @@ touch $RPM_BUILD_ROOT/var/lock/iscsi/lock
%post %post
/sbin/ldconfig /sbin/ldconfig
%systemd_post iscsi.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket %systemd_post iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket
if [ $1 -eq 1 ]; then if [ $1 -eq 1 ]; then
if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then
@ -364,7 +367,7 @@ if [ $1 -eq 1 ]; then
fi fi
%preun %preun
%systemd_preun iscsi.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket %systemd_preun iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket
%postun %postun
/sbin/ldconfig /sbin/ldconfig
@ -409,6 +412,11 @@ if [ $1 -gt 0 ]; then
fi fi
fi fi
%triggerun -- iscsi-initiator-utils < 6.2.0.873-26
if [ $1 -gt 0 ]; then
systemctl start iscsi-shutdown.service
fi
%files %files
%doc README %doc README
%dir %{_sharedstatedir}/iscsi %dir %{_sharedstatedir}/iscsi
@ -421,6 +429,7 @@ fi
%ghost %{_var}/lock/iscsi %ghost %{_var}/lock/iscsi
%ghost %{_var}/lock/iscsi/lock %ghost %{_var}/lock/iscsi/lock
%{_unitdir}/iscsi.service %{_unitdir}/iscsi.service
%{_unitdir}/iscsi-shutdown.service
%{_unitdir}/iscsid.service %{_unitdir}/iscsid.service
%{_unitdir}/iscsid.socket %{_unitdir}/iscsid.socket
%{_libexecdir}/iscsi-mark-root-nodes %{_libexecdir}/iscsi-mark-root-nodes
@ -452,6 +461,9 @@ fi
%{_includedir}/libiscsi.h %{_includedir}/libiscsi.h
%changelog %changelog
* Mon Jan 12 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-26
- 1166713 created iscsi-shutdown.service to ensure that session cleanup happens
* Thu Dec 11 2014 Andy Grover <agrover@redhat.com> - 6.2.0.873-25 * Thu Dec 11 2014 Andy Grover <agrover@redhat.com> - 6.2.0.873-25
- Add --with-slp=no for #1088020 - Add --with-slp=no for #1088020