summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-05-30 15:36:45 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-06-12 13:03:55 +1000
commite54e26065cea435fed19b8b2687c87927f1b63f1 (patch)
tree9e3fb8f89aeac264cdab38910ce3c963a03401c1
parent917f7aa880a7c6ab08991ae0c969d0489ba48845 (diff)
downloadtalos-petitboot-e54e26065cea435fed19b8b2687c87927f1b63f1.zip
talos-petitboot-e54e26065cea435fed19b8b2687c87927f1b63f1.tar.gz
discover: Rescan SCSI devices on reinit
Explicitly rescan SCSI devices on reinit rather than just remounting them in case a device did not init properly on boot. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
-rw-r--r--configure.ac1
-rw-r--r--discover/device-handler.c3
-rw-r--r--lib/system/system.c1
-rw-r--r--lib/system/system.h1
-rw-r--r--utils/Makefile.am3
-rwxr-xr-xutils/scsi-rescan5
6 files changed, 13 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index bdd7f70..9eb0855 100644
--- a/configure.ac
+++ b/configure.ac
@@ -343,6 +343,7 @@ DEFINE_HOST_PROG(VGCHANGE, vgchange, [/usr/sbin/vgchange])
DEFINE_HOST_PROG(PB_PLUGIN, pb-plugin, [/usr/sbin/pb-plugin])
DEFINE_HOST_PROG(PB_EXEC, pb-exec, [/usr/sbin/pb-exec])
DEFINE_HOST_PROG(SH, sh, [/bin/sh])
+DEFINE_HOST_PROG(SCSI_RESCAN, scsi-rescan, [/usr/sbin/scsi-rescan])
AC_ARG_WITH(
[tftp],
diff --git a/discover/device-handler.c b/discover/device-handler.c
index 569e652..aa61bd2 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -451,6 +451,9 @@ void device_handler_reinit(struct device_handler *handler)
discover_server_notify_config(handler->server, config);
}
+ /* Force rediscovery on SCSI devices */
+ process_run_simple(handler, pb_system_apps.scsi_rescan, NULL);
+
device_handler_reinit_sources(handler);
}
diff --git a/lib/system/system.c b/lib/system/system.c
index b1121a1..6dafcb0 100644
--- a/lib/system/system.c
+++ b/lib/system/system.c
@@ -33,6 +33,7 @@ const struct pb_system_apps pb_system_apps = {
.pb_plugin = HOST_PROG_PB_PLUGIN,
.pb_exec = HOST_PROG_PB_EXEC,
.sh = HOST_PROG_SH,
+ .scsi_rescan = HOST_PROG_SCSI_RESCAN,
};
#ifndef TFTP_TYPE
diff --git a/lib/system/system.h b/lib/system/system.h
index d27c2cd..38fe392 100644
--- a/lib/system/system.h
+++ b/lib/system/system.h
@@ -18,6 +18,7 @@ struct pb_system_apps {
const char *pb_plugin;
const char *pb_exec;
const char *sh;
+ const char *scsi_rescan;
};
extern const struct pb_system_apps pb_system_apps;
diff --git a/utils/Makefile.am b/utils/Makefile.am
index c9015a0..a523430 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -12,7 +12,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-dist_sbin_SCRIPTS += utils/pb-udhcpc utils/pb-plugin utils/pb-sos utils/pb-exec
+dist_sbin_SCRIPTS += utils/pb-udhcpc utils/pb-plugin utils/pb-sos \
+ utils/pb-exec utils/scsi-rescan
dist_pkglibexec_SCRIPTS = utils/pb-console
sbin_PROGRAMS += utils/pb-event utils/pb-config
diff --git a/utils/scsi-rescan b/utils/scsi-rescan
new file mode 100755
index 0000000..1d1cb1b
--- /dev/null
+++ b/utils/scsi-rescan
@@ -0,0 +1,5 @@
+#/bin/sh
+
+for host in /sys/class/scsi_host/host*; do
+ echo "- - -" > ${host}/scan
+done
OpenPOWER on IntegriCloud