boot session handling improvements

Fix iscsi-mark-root for changed iscsiadm output

Make sure iscsiuio is running for boot session recovery when using the
bnx2i transport by forcing iscsiuio.service start

Make NM dispatch triggered re-check for autostart sessions async

Accept exit code 21, no records, from iscsiadm as success in
iscsi.service

Resolves: #1069825

Signed-off-by: Chris Leech <cleech@redhat.com>
This commit is contained in:
Chris Leech 2014-02-26 16:52:52 -08:00
parent 4b292f8a07
commit fbd856304d
5 changed files with 106 additions and 3 deletions

View File

@ -0,0 +1,55 @@
From 83f291bd475f3d11abaf1f7346732f75af585ed8 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 26 Feb 2014 16:33:48 -0800
Subject: update handling of boot sessions
force start iscsiuio if needed, socket activation does not seem to be
working for recovery
---
etc/systemd/iscsi-mark-root-nodes | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes
index 157be62..d106ac6 100644
--- a/etc/systemd/iscsi-mark-root-nodes
+++ b/etc/systemd/iscsi-mark-root-nodes
@@ -1,13 +1,30 @@
#!/bin/bash
ISCSIADM=/sbin/iscsiadm
+start_iscsid=0
+start_iscsiuio=0
-$ISCSIADM -m session >/dev/null 2>&1 || exit 0
+while read t num p target flash; do
+ # strip tag number from portal, keep "ip:port"
+ portal=${p%,*}
+ transport=${t%:}
-$ISCSIADM -m session | while read t num i target; do
- ip=${i%:*}
- $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot
-done
+ $ISCSIADM -m node -p $portal -T $target -o update -n node.startup -v onboot
-systemctl start iscsid.service
+ start_iscsid=1
+
+ if [ "$transport" = bnx2i ]; 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
+fi
+if [ "$start_iscsiuio" -eq 1 ]; then
+ systemctl --no-block start iscsiuio.service
+fi
--
1.8.3.1

View File

@ -0,0 +1,34 @@
From 969e26197c792ec5377d2c261a934a9c907e82f0 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Fri, 14 Mar 2014 09:22:21 -0700
Subject: [PATCH] update iscsi.service for boot session recovery
---
etc/systemd/iscsi.service | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index d5712bd..3de76c5 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -5,14 +5,15 @@ DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
Before=remote-fs-pre.target
-ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes
+ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes
+ConditionDirectoryNotEmpty=|/sys/class/iscsi_session
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/libexec/iscsi-mark-root-nodes
+SuccessExitStatus=21
ExecStart=/sbin/iscsiadm -m node --loginall=automatic
-ExecStop=/bin/sync
ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
ExecReload=/sbin/iscsiadm -m node --loginall=automatic
--
1.8.3.1

View File

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

View File

@ -2,6 +2,6 @@
case "$2" in
up|vpn-up)
/bin/systemctl reload iscsi.service || :
/bin/systemctl --no-block reload iscsi.service || :
;;
esac

View File

@ -4,7 +4,7 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
Release: 20%{?dist}
Release: 21%{?dist}
Group: System Environment/Daemons
License: GPLv2+
URL: http://www.open-iscsi.org
@ -107,6 +107,8 @@ Patch164: 0164-libiscsi-fix-incorrect-strncpy-use.patch
Patch165: 0165-fix-hardened-build-of-iscsiuio.patch
Patch166: 0166-start-socket-listeners-on-iscsiadm-command.patch
Patch167: 0167-Revert-iscsiadm-return-error-when-login-fails.patch
Patch168: 0168-update-handling-of-boot-sessions.patch
Patch169: 0169-update-iscsi.service-for-boot-session-recovery.patch
# version string, needs to be updated with each build
Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
@ -240,6 +242,8 @@ developing applications that use %{name}.
%patch165 -p1
%patch166 -p1
%patch167 -p1
%patch168 -p1
%patch169 -p1
# version string
%patch199 -p1
@ -399,6 +403,16 @@ fi
%{_includedir}/libiscsi.h
%changelog
* Tue Mar 18 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-21
- 1069825
- boot session handling improvements
- Fix iscsi-mark-root for changed iscsiadm output
- Make sure iscsiuio is running for boot session recovery when using the
bnx2i transport by forcing iscsiuio.service start
- Make NM dispatch triggered re-check for autostart sessions async
- Accept exit code 21, no records, from iscsiadm as success in
iscsi.service
* Tue Feb 25 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-20
- 1049710 host0 being treated as an invalid in the host stats command
- 1015563 revert change to return code when calling login_portal for sessions