diff options
author | Lee Duncan <lduncan@suse.com> | 2018-01-16 13:30:51 -0800 |
---|---|---|
committer | Lee Duncan <lduncan@suse.com> | 2018-01-16 13:30:51 -0800 |
commit | 57b0463df9ec490c88bb979f6305344d07f5803a (patch) | |
tree | 3d360ebafb28188ce69bcd2e8ffb04e5e9f22995 | |
parent | c6ae303c2cdd34157dfc3a6dface0a7179e0d401 (diff) | |
download | open-iscsi-57b0463df9ec490c88bb979f6305344d07f5803a.tar.gz |
Automate logging into iSCSI FW targets.
Add a script that logs into all iSCSI firmware
targets, and add a udev rule to call that script
when new targets are detected. Also, add a
man page for the script.
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | doc/iscsi_fw_login.8 | 16 | ||||
-rw-r--r-- | utils/50-iscsi-firmware-login.rules | 15 | ||||
-rw-r--r-- | utils/iscsi_fw_login | 12 |
4 files changed, 54 insertions, 3 deletions
@@ -13,12 +13,16 @@ bindir = $(exec_prefix)/bin mandir = $(prefix)/share/man etcdir = /etc initddir = $(etcdir)/init.d +rulesdir = $(etcdir)/udev/rules.d -MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 iscsiuio/docs/iscsiuio.8 -PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname iscsiuio/src/unix/iscsiuio +MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 \ + iscsiuio/docs/iscsiuio.8 doc/iscsi_fw_login.8 +PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi-iname iscsiuio/src/unix/iscsiuio +SCRIPTS = utils/iscsi_discovery utils/iscsi_fw_login INSTALL = install ETCFILES = etc/iscsid.conf IFACEFILES = etc/iface.example +RULESFILES = utils/50-iscsi-firmware-login.rules # Compatibility: parse old OPTFLAGS argument ifdef OPTFLAGS @@ -92,7 +96,11 @@ install: install_programs install_doc install_etc \ install_user: install_programs install_doc install_etc \ install_initd install_iname install_iface -install_programs: $(PROGRAMS) +install_udev_rules: + $(INSTALL) -d $(DESTDIR)$(rulesdir) + $(INSTALL) -m 644 $(RULESFILES) $(DESTDIR)/$(rulesdir) + +install_programs: $(PROGRAMS) $(SCRIPTS) $(INSTALL) -d $(DESTDIR)$(sbindir) $(INSTALL) -m 755 $^ $(DESTDIR)$(sbindir) diff --git a/doc/iscsi_fw_login.8 b/doc/iscsi_fw_login.8 new file mode 100644 index 0000000..e9fccd2 --- /dev/null +++ b/doc/iscsi_fw_login.8 @@ -0,0 +1,16 @@ +.TH "iscsi_fw_login" 8 +.SH NAME +iscsi_fw_login \- Login to all iSCSI Firmware targets +.SH SYNOPSIS +.B iscsi_fw_login +.SH DESCRIPTION +This helper function logs into all known iSCSI firmware targets. +.P +It is meant as a helper function to be called by udev when new +firmware targets are detected asynchronously. +.SH AUTHOR +Written by Lee Duncan +.SH "REPORTING BUGS" +Report bugs to <lduncan@suse.com>. +.SH COPYRIGHT +Copyright \(co 2015 Lee Duncan <lduncan@suse.com> diff --git a/utils/50-iscsi-firmware-login.rules b/utils/50-iscsi-firmware-login.rules new file mode 100644 index 0000000..47b3cf9 --- /dev/null +++ b/utils/50-iscsi-firmware-login.rules @@ -0,0 +1,15 @@ +# This file contains the rules to handle iscsi firmware changes + +# DO NOT WRAP THIS LINE +# +# old udev does not understand some of it, +# and would end up skipping only some lines, not the full rule. +# which can cause all sort of trouble with strange-named device nodes +# for completely unrelated devices, +# resulting in unusable network lookback, etc. +# +# in case this is "accidentally" installed on a system with old udev, +# having it as one single line avoids those problems. +# +# DO NOT WRAP THIS LINE +SUBSYSTEM=="iscsi_boot*", ACTION=="add", DEVPATH=="*/target*", RUN+="/sbin/iscsi_fw_login" diff --git a/utils/iscsi_fw_login b/utils/iscsi_fw_login new file mode 100644 index 0000000..1312ed3 --- /dev/null +++ b/utils/iscsi_fw_login @@ -0,0 +1,12 @@ +#!/bin/bash +# +# iscsi_fw_login -- login to iscsi firmware targets, if any +# +# This script is called when udev discovers a new iscsi +# firmware target +# + +ARGS="-m fw -l" +ISCSIADM="/sbin/iscsiadm" + +$ISCSIADM $ARGS |