2020-05-30 01:47:35 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-05-25 22:12:56 +00:00
|
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
|
Date: Wed, 15 Oct 2014 10:39:30 -0500
|
|
|
|
Subject: [PATCH] RH: don't start without a config file
|
|
|
|
|
|
|
|
If /etc/multipath.conf doesn't exist, don't start multipathd and blacklist
|
|
|
|
all devices when running multipath. A completely blank configuration file
|
|
|
|
is almost never what users want. Also, people may have the multipath
|
|
|
|
packages installed but don't want to use them. This patch provides a
|
|
|
|
simple way to disable multipath. Simply removing or renaming
|
|
|
|
/etc/multipath.conf will keep multipath from doing anything.
|
|
|
|
|
|
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
|
---
|
2021-01-20 00:06:09 +00:00
|
|
|
libmultipath/config.c | 13 +++++++++++++
|
2017-05-25 22:12:56 +00:00
|
|
|
libmultipath/config.h | 1 +
|
2022-11-16 20:11:59 +00:00
|
|
|
multipath/multipath.rules.in | 1 +
|
2017-06-02 05:34:02 +00:00
|
|
|
multipathd/multipathd.8 | 2 ++
|
2017-05-25 22:12:56 +00:00
|
|
|
multipathd/multipathd.service | 1 +
|
2021-10-07 03:13:34 +00:00
|
|
|
multipathd/multipathd.socket | 1 +
|
|
|
|
6 files changed, 19 insertions(+)
|
2017-05-25 22:12:56 +00:00
|
|
|
|
|
|
|
diff --git a/libmultipath/config.c b/libmultipath/config.c
|
2022-11-16 20:11:59 +00:00
|
|
|
index 5c5c0726..183b319d 100644
|
2017-05-25 22:12:56 +00:00
|
|
|
--- a/libmultipath/config.c
|
|
|
|
+++ b/libmultipath/config.c
|
2022-11-16 20:11:59 +00:00
|
|
|
@@ -966,6 +966,19 @@ int _init_config (const char *file, struct config *conf)
|
2017-05-25 22:12:56 +00:00
|
|
|
}
|
2018-07-17 19:55:00 +00:00
|
|
|
factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
|
2022-07-13 21:51:42 +00:00
|
|
|
validate_pctable(conf->overrides, 0, file);
|
2017-05-25 22:12:56 +00:00
|
|
|
+ } else {
|
|
|
|
+ condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
|
|
|
|
+ if (conf->blist_devnode == NULL) {
|
|
|
|
+ conf->blist_devnode = vector_alloc();
|
|
|
|
+ if (!conf->blist_devnode) {
|
|
|
|
+ condlog(0, "cannot allocate blacklist\n");
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
+ }
|
2021-01-20 00:06:09 +00:00
|
|
|
+ if (store_ble(conf->blist_devnode, ".*", ORIGIN_NO_CONFIG)) {
|
2017-05-25 22:12:56 +00:00
|
|
|
+ condlog(0, "cannot store default no-config blacklist\n");
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
conf->processed_main_config = 1;
|
|
|
|
diff --git a/libmultipath/config.h b/libmultipath/config.h
|
2022-11-16 20:11:59 +00:00
|
|
|
index 87947469..0dc89c16 100644
|
2017-05-25 22:12:56 +00:00
|
|
|
--- a/libmultipath/config.h
|
|
|
|
+++ b/libmultipath/config.h
|
2022-11-16 20:11:59 +00:00
|
|
|
@@ -10,6 +10,7 @@
|
2017-05-25 22:12:56 +00:00
|
|
|
|
|
|
|
#define ORIGIN_DEFAULT 0
|
|
|
|
#define ORIGIN_CONFIG 1
|
|
|
|
+#define ORIGIN_NO_CONFIG 2
|
|
|
|
|
2021-01-20 00:06:09 +00:00
|
|
|
enum devtypes {
|
|
|
|
DEV_NONE,
|
2022-11-16 20:11:59 +00:00
|
|
|
diff --git a/multipath/multipath.rules.in b/multipath/multipath.rules.in
|
|
|
|
index 8d3cf33a..5c4447a2 100644
|
|
|
|
--- a/multipath/multipath.rules.in
|
|
|
|
+++ b/multipath/multipath.rules.in
|
2018-06-12 19:11:55 +00:00
|
|
|
@@ -9,6 +9,7 @@ IMPORT{cmdline}="nompath"
|
2017-05-25 22:12:56 +00:00
|
|
|
ENV{nompath}=="?*", GOTO="end_mpath"
|
|
|
|
IMPORT{cmdline}="multipath"
|
|
|
|
ENV{multipath}=="off", GOTO="end_mpath"
|
|
|
|
+TEST!="/etc/multipath.conf", GOTO="end_mpath"
|
|
|
|
|
|
|
|
ENV{DEVTYPE}!="partition", GOTO="test_dev"
|
2017-11-07 23:51:09 +00:00
|
|
|
IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH"
|
2017-06-02 05:34:02 +00:00
|
|
|
diff --git a/multipathd/multipathd.8 b/multipathd/multipathd.8
|
2022-11-16 20:11:59 +00:00
|
|
|
index bdf102eb..a16a0bd5 100644
|
2017-06-02 05:34:02 +00:00
|
|
|
--- a/multipathd/multipathd.8
|
|
|
|
+++ b/multipathd/multipathd.8
|
2022-11-16 20:11:59 +00:00
|
|
|
@@ -48,6 +48,8 @@ map regains its maximum performance and redundancy.
|
|
|
|
With the \fB-k\fR option, \fBmultipathd\fR acts as a client utility that
|
|
|
|
sends commands to a running instance of the multipathd daemon (see
|
|
|
|
\fBCOMMANDS\fR below).
|
2017-06-02 05:34:02 +00:00
|
|
|
+
|
2017-09-21 18:00:03 +00:00
|
|
|
+In this Linux distribution, multipathd does not run unless a /etc/multipath.conf file exists.
|
2017-06-02 05:34:02 +00:00
|
|
|
.
|
|
|
|
.
|
|
|
|
.\" ----------------------------------------------------------------------------
|
2017-05-25 22:12:56 +00:00
|
|
|
diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service
|
2022-03-28 20:47:01 +00:00
|
|
|
index aec62dbb..d76f94f9 100644
|
2017-05-25 22:12:56 +00:00
|
|
|
--- a/multipathd/multipathd.service
|
|
|
|
+++ b/multipathd/multipathd.service
|
2022-03-28 20:47:01 +00:00
|
|
|
@@ -6,6 +6,7 @@ Wants=systemd-udevd-kernel.socket
|
|
|
|
After=systemd-udevd-kernel.socket
|
|
|
|
After=multipathd.socket systemd-remount-fs.service
|
|
|
|
Before=initrd-cleanup.service
|
2017-05-25 22:12:56 +00:00
|
|
|
+ConditionPathExists=/etc/multipath.conf
|
|
|
|
DefaultDependencies=no
|
|
|
|
Conflicts=shutdown.target
|
2022-03-28 20:47:01 +00:00
|
|
|
Conflicts=initrd-cleanup.service
|
2021-10-07 03:13:34 +00:00
|
|
|
diff --git a/multipathd/multipathd.socket b/multipathd/multipathd.socket
|
|
|
|
index c777e5e3..3c20a2ff 100644
|
|
|
|
--- a/multipathd/multipathd.socket
|
|
|
|
+++ b/multipathd/multipathd.socket
|
|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
[Unit]
|
|
|
|
Description=multipathd control socket
|
|
|
|
DefaultDependencies=no
|
|
|
|
+ConditionPathExists=/etc/multipath.conf
|
|
|
|
ConditionKernelCommandLine=!nompath
|
|
|
|
ConditionKernelCommandLine=!multipath=off
|
|
|
|
ConditionVirtualization=!container
|