iscsi boot related fixes

make sure iscsid gets started if there are any boot sessions running
add reload target to fix double session problem when restarting from NM
don't rely on session list passed from initrd, never got fully implemented
remove patches related to running iscsid from initrd, possible to revisit later
This commit is contained in:
Chris Leech 2013-08-19 07:37:26 -07:00
parent c2d5d21256
commit 2a4a67d694
3 changed files with 89 additions and 17 deletions

View File

@ -0,0 +1,75 @@
From 8f79529354b4023c371e00091f11bdd523497639 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Aug 2013 07:18:25 -0700
Subject: iscsi boot related service file updates
make sure iscsid gets started if there are any boot sessions running
add reload target to fix double session problem when restarting from NM
don't rely on session list passed from initrd, never got fully implemented
---
etc/systemd/iscsi-mark-root-nodes | 13 +++++++++++++
etc/systemd/iscsi.service | 3 ++-
etc/systemd/iscsi_mark_root_nodes | 14 --------------
3 files changed, 15 insertions(+), 15 deletions(-)
create mode 100644 etc/systemd/iscsi-mark-root-nodes
delete mode 100644 etc/systemd/iscsi_mark_root_nodes
diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes
new file mode 100644
index 0000000..157be62
--- /dev/null
+++ b/etc/systemd/iscsi-mark-root-nodes
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+ISCSIADM=/sbin/iscsiadm
+
+$ISCSIADM -m session >/dev/null 2>&1 || exit 0
+
+$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
+
+systemctl start iscsid.service
+
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index 7b4efee..d5712bd 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -10,10 +10,11 @@ ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes
[Service]
Type=oneshot
RemainAfterExit=true
-ExecStart=/usr/libexec/iscsi_mark_root_nodes
+ExecStart=/usr/libexec/iscsi-mark-root-nodes
ExecStart=/sbin/iscsiadm -m node --loginall=automatic
ExecStop=/bin/sync
ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
+ExecReload=/sbin/iscsiadm -m node --loginall=automatic
[Install]
WantedBy=sysinit.target
diff --git a/etc/systemd/iscsi_mark_root_nodes b/etc/systemd/iscsi_mark_root_nodes
deleted file mode 100644
index c68475c..0000000
--- a/etc/systemd/iscsi_mark_root_nodes
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-ISCSIADM=/sbin/iscsiadm
-SESSION_FILE=/run/initramfs/iscsi.sessions
-
-if [ ! -f $SESSION_FILE ] ; then
- exit 0
-fi
-
-while read t num i target; do
- ip=${i%:*}
- $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot
-done < $SESSION_FILE
-
--
1.8.1.4

View File

@ -1,7 +1,7 @@
#!/bin/sh
case "$2" in
up|down|vpn-up|vpn-down)
/bin/systemctl try-restart iscsi.service || :
up|vpn-up)
/bin/systemctl 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: 10%{?dist}
Release: 11%{?dist}
Group: System Environment/Daemons
License: GPLv2+
URL: http://www.open-iscsi.org
@ -42,18 +42,14 @@ Patch25: 0025-iscsid-Fix-strlen-parameter.patch
Patch26: 0026-iscsiuio-Change-socket-bind-to-use-the-same-struct-s.patch
Patch27: 0027-Make-rescan-run-in-parallel.patch
# not (yet) upstream merged
Patch40: 0040-ISCSISTART-Saved-ibft-boot-info-to-the-session-sysfs.patch
Patch41: 0041-ISCSID-Added-the-extraction-of-the-session-boot-info.patch
Patch42: 0042-ISCSID-Added-iface-content-override-fix.patch
Patch43: 0043-idmb_rec_write-check-for-tpgt-first.patch
Patch44: 0044-iscsid-add-initrd-option-to-set-run-from-initrd-hint.patch
Patch45: 0045-idbm_rec_write-seperate-old-and-new-style-writes.patch
Patch46: 0046-idbw_rec_write-pick-tpgt-from-existing-record.patch
Patch47: 0047-iscsiadm-iscsid-newroot-command-to-survive-switch_ro.patch
Patch48: 0048-iscsiadm-param-parsing-for-advanced-node-creation.patch
Patch49: 0049-update-systemd-service-files-add-iscsi.service-for-s.patch
Patch50: 0050-iscsi-boot-related-service-file-updates.patch
# distro specific modifications
Patch51: 0051-update-initscripts-and-docs.patch
Patch52: 0052-use-var-for-config.patch
@ -61,7 +57,6 @@ Patch53: 0053-use-red-hat-for-name.patch
Patch54: 0054-add-libiscsi.patch
Patch55: 0055-dont-use-static.patch
Patch56: 0056-remove-the-offload-boot-supported-ifdef.patch
Patch58: 0058-iscsiuio-IPC-newroot-command.patch
Patch59: 0059-iscsiuio-systemd-unit-files.patch
Patch60: 0060-use-systemctl-to-start-iscsid.patch
Patch61: 0061-resolve-565245-multilib-issues-caused-by-doxygen.patch
@ -71,8 +66,6 @@ Patch64: 0064-libiscsi-fix-incorrect-strncpy-use.patch
# version string, needs to be updated with each build
Patch99: 0099-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
# 44 47 48 58
BuildRequires: flex bison python-devel doxygen kmod-devel systemd-devel
# For dir ownership
Requires(post): systemd
@ -132,12 +125,10 @@ developing applications that use %{name}.
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
# distro specific modifications
%patch51 -p1
%patch52 -p1
@ -145,7 +136,6 @@ developing applications that use %{name}.
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
@ -196,7 +186,7 @@ install -pm 644 etc/systemd/iscsiuio.service $RPM_BUILD_ROOT%{_unitdir}
install -pm 644 etc/systemd/iscsiuio.socket $RPM_BUILD_ROOT%{_unitdir}
install -d $RPM_BUILD_ROOT%{_libexecdir}
install -pm 755 etc/systemd/iscsi_mark_root_nodes $RPM_BUILD_ROOT%{_libexecdir}
install -pm 755 etc/systemd/iscsi-mark-root-nodes $RPM_BUILD_ROOT%{_libexecdir}
install -d $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d
install -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d
@ -271,7 +261,7 @@ fi
%{_unitdir}/iscsid.socket
%{_unitdir}/iscsiuio.service
%{_unitdir}/iscsiuio.socket
%{_libexecdir}/iscsi_mark_root_nodes
%{_libexecdir}/iscsi-mark-root-nodes
%{_sysconfdir}/NetworkManager/dispatcher.d/04-iscsi
%{_tmpfilesdir}/iscsi.conf
%dir %{_sysconfdir}/iscsi
@ -288,6 +278,13 @@ fi
%{_includedir}/libiscsi.h
%changelog
* Mon Aug 19 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-11
- iscsi boot related fixes
make sure iscsid gets started if there are any boot sessions running
add reload target to fix double session problem when restarting from NM
don't rely on session list passed from initrd, never got fully implemented
remove patches related to running iscsid from initrd, possible to revisit later
* Sun Aug 18 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-10
- sync with upstream git, minor context fixes after rebase of out-of-tree patches
- iscsiuio is merged upstream, remove old source archive and patches