2021-04-13 19:06:29 +00:00
|
|
|
From fd538429be486d057b092e3b9c148add2c5ea9c2 Mon Sep 17 00:00:00 2001
|
2020-10-15 11:47:25 +00:00
|
|
|
From: rpm-build <rpm-build>
|
|
|
|
Date: Tue, 4 Jun 2019 13:23:32 -0700
|
2021-04-13 19:06:29 +00:00
|
|
|
Subject: [PATCH 1/1] unit file tweaks
|
2020-10-15 11:47:25 +00:00
|
|
|
|
|
|
|
---
|
2020-11-04 22:15:53 +00:00
|
|
|
etc/systemd/iscsi-mark-root-nodes | 34 ++++++++++++++++++++++++++++++
|
|
|
|
etc/systemd/iscsi-onboot.service | 15 +++++++++++++
|
|
|
|
etc/systemd/iscsi-shutdown.service | 15 +++++++++++++
|
|
|
|
etc/systemd/iscsi.service | 16 +++++++-------
|
|
|
|
etc/systemd/iscsid.service | 3 +--
|
|
|
|
etc/systemd/iscsiuio.service | 4 +---
|
|
|
|
6 files changed, 74 insertions(+), 13 deletions(-)
|
2020-10-15 11:47:25 +00:00
|
|
|
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
|
2020-11-04 22:15:53 +00:00
|
|
|
index 0000000..9d48805
|
2020-10-15 11:47:25 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/etc/systemd/iscsi-mark-root-nodes
|
2020-11-04 22:15:53 +00:00
|
|
|
@@ -0,0 +1,34 @@
|
2020-10-15 11:47:25 +00:00
|
|
|
+#!/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
|
2020-11-04 22:15:53 +00:00
|
|
|
+fi
|
|
|
|
+if [ "$start_iscsiuio" -eq 1 ]; then
|
|
|
|
+ systemctl --no-block start iscsiuio.service
|
|
|
|
+fi
|
|
|
|
+
|
2020-10-15 11:47:25 +00:00
|
|
|
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
|
2020-11-04 22:15:53 +00:00
|
|
|
index 0000000..caee933
|
2020-10-15 11:47:25 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/etc/systemd/iscsi-shutdown.service
|
2020-11-04 22:15:53 +00:00
|
|
|
@@ -0,0 +1,15 @@
|
2020-10-15 11:47:25 +00:00
|
|
|
+[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
|
2020-11-04 22:15:53 +00:00
|
|
|
+ExecStop=-/usr/sbin/iscsiadm -m node --logoutall=all
|
2020-10-15 11:47:25 +00:00
|
|
|
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
|
2021-04-13 19:06:29 +00:00
|
|
|
index 5e394b9..175cb2c 100644
|
2020-10-15 11:47:25 +00:00
|
|
|
--- a/etc/systemd/iscsi.service
|
|
|
|
+++ b/etc/systemd/iscsi.service
|
2020-11-04 22:15:53 +00:00
|
|
|
@@ -1,18 +1,18 @@
|
2020-10-15 11:47:25 +00:00
|
|
|
[Unit]
|
|
|
|
Description=Login and scanning of iSCSI devices
|
|
|
|
Documentation=man:iscsiadm(8) man:iscsid(8)
|
2020-11-04 22:15:53 +00:00
|
|
|
-Before=remote-fs.target
|
2021-04-13 19:06:29 +00:00
|
|
|
-After=network-online.target iscsid.service
|
2020-11-04 22:15:53 +00:00
|
|
|
-Requires=iscsid.socket iscsi-init.service
|
2021-04-13 19:06:29 +00:00
|
|
|
-Wants=network-online.target
|
2020-10-15 11:47:25 +00:00
|
|
|
+DefaultDependencies=no
|
2020-11-04 22:15:53 +00:00
|
|
|
+Before=remote-fs-pre.target
|
|
|
|
+After=network.target network-online.target iscsid.service iscsiuio.service systemd-remount-fs.service
|
2020-10-15 11:47:25 +00:00
|
|
|
+Wants=remote-fs-pre.target iscsi-shutdown.service
|
|
|
|
+ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=oneshot
|
2021-04-13 19:06:29 +00:00
|
|
|
-ExecStart=/sbin/iscsiadm -m node --loginall=automatic -W
|
2020-10-15 11:47:25 +00:00
|
|
|
-ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
|
|
|
|
-ExecStop=/sbin/iscsiadm -m node --logoutall=manual
|
2020-11-04 22:15:53 +00:00
|
|
|
-SuccessExitStatus=21 15
|
|
|
|
RemainAfterExit=true
|
2020-10-15 11:47:25 +00:00
|
|
|
+ExecStart=-/usr/sbin/iscsiadm -m node --loginall=automatic
|
|
|
|
+ExecReload=-/usr/sbin/iscsiadm -m node --loginall=automatic
|
2020-11-04 22:15:53 +00:00
|
|
|
+SuccessExitStatus=21
|
2020-10-15 11:47:25 +00:00
|
|
|
|
2020-11-04 22:15:53 +00:00
|
|
|
[Install]
|
|
|
|
WantedBy=remote-fs.target
|
2020-10-15 11:47:25 +00:00
|
|
|
diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
|
2021-04-13 19:06:29 +00:00
|
|
|
index 3fd7dd3..324c593 100644
|
2020-10-15 11:47:25 +00:00
|
|
|
--- a/etc/systemd/iscsid.service
|
|
|
|
+++ b/etc/systemd/iscsid.service
|
2021-04-13 19:06:29 +00:00
|
|
|
@@ -4,13 +4,12 @@ Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
|
2020-10-15 11:47:25 +00:00
|
|
|
DefaultDependencies=no
|
2021-04-13 19:06:29 +00:00
|
|
|
After=network-online.target iscsiuio.service iscsi-init.service
|
2020-10-15 11:47:25 +00:00
|
|
|
Before=remote-fs-pre.target
|
2020-11-04 22:15:53 +00:00
|
|
|
-Wants=remote-fs-pre.target
|
2021-04-13 19:06:29 +00:00
|
|
|
Requires=iscsi-init.service
|
2020-11-04 22:15:53 +00:00
|
|
|
|
2020-10-15 11:47:25 +00:00
|
|
|
[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
|
2020-11-04 22:15:53 +00:00
|
|
|
index 923e019..fc0be93 100644
|
2020-10-15 11:47:25 +00:00
|
|
|
--- a/etc/systemd/iscsiuio.service
|
|
|
|
+++ b/etc/systemd/iscsiuio.service
|
2020-11-04 22:15:53 +00:00
|
|
|
@@ -2,17 +2,15 @@
|
|
|
|
Description=iSCSI UserSpace I/O driver
|
|
|
|
Documentation=man:iscsiuio(8)
|
|
|
|
DefaultDependencies=no
|
|
|
|
-Conflicts=shutdown.target
|
|
|
|
Requires=iscsid.service
|
|
|
|
BindTo=iscsid.service
|
|
|
|
After=network.target
|
|
|
|
Before=remote-fs-pre.target iscsid.service
|
|
|
|
-Wants=remote-fs-pre.target
|
|
|
|
|
2020-10-15 11:47:25 +00:00
|
|
|
[Service]
|
|
|
|
Type=notify
|
|
|
|
NotifyAccess=main
|
|
|
|
-ExecStart=/sbin/iscsiuio -f
|
|
|
|
+ExecStart=/usr/sbin/iscsiuio -f
|
|
|
|
KillMode=mixed
|
|
|
|
Restart=on-failure
|
|
|
|
|
|
|
|
--
|
2021-04-13 19:06:29 +00:00
|
|
|
2.26.3
|
2020-10-15 11:47:25 +00:00
|
|
|
|