device-mapper-multipath/0005-RH-don-t-start-without-a-config-file.patch
Benjamin Marzinski a4bb435b33 device-mapper-multipath-0.7.1-1.gitf21166a
- Update Source to the latest upstream commit
- Add 0001-libmultipath-add-comment-about-resuming.patch
  * posted upstream
- Add 0002-multipath-attempt-at-common-multipath.rules.patch
  * under discussion upstream
- Add 0003-RH-fixup-udev-rules-for-redhat.patch
  * Redhat uses different udev rules that some other distros, so multipath
    has run at a different time. Not all upstream distros link /sbin and
    /usr/sbin either.
- Add 0004-RH-Remove-the-property-blacklist-exception-builtin.patch
  * Allow multipath to be used on devices without multiple paths. NAK'ed
    upstream, but requested by Red Hat
- Add 0005-RH-don-t-start-without-a-config-file.patch
  * Don't start multipath unless a config file exists. NAK'ed upstream,
    but requested by Red Hat
- Add 0006-RH-use-rpm-optflags-if-present.patch
  * Make the build system fedora friendly
- Add 0007-RH-add-mpathconf.patch
  * Add tool to help configure multipath with Red Hat defaults.
- Add 0008-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
  * Make multipath able to claim devices based on the kernel command line
    NAK'ed upstream but requested by Red Hat
- Add 0009-RH-trigger-change-uevent-on-new-device-creation.patch
  * under discussion upstream
2017-05-25 17:12:56 -05:00

95 lines
3.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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>
---
libmultipath/config.c | 17 +++++++++++++++++
libmultipath/config.h | 1 +
multipath/multipath.rules | 1 +
multipathd/multipathd.service | 1 +
4 files changed, 20 insertions(+)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index bb6619b..aae69b8 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -25,6 +25,7 @@
#include "prio.h"
#include "devmapper.h"
#include "mpath_cmd.h"
+#include "version.h"
static int
hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
@@ -667,6 +668,22 @@ load_config (char * file)
factorize_hwtable(conf->hwtable, builtin_hwtable_size);
}
+ } else {
+ condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
+ condlog(0, "A default multipath.conf file is located at");
+ condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE));
+ if (conf->blist_devnode == NULL) {
+ conf->blist_devnode = vector_alloc();
+ if (!conf->blist_devnode) {
+ condlog(0, "cannot allocate blacklist\n");
+ goto out;
+ }
+ }
+ if (store_ble(conf->blist_devnode, strdup(".*"),
+ ORIGIN_NO_CONFIG)) {
+ 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
index ffc69b5..614331c 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -7,6 +7,7 @@
#define ORIGIN_DEFAULT 0
#define ORIGIN_CONFIG 1
+#define ORIGIN_NO_CONFIG 2
/*
* In kernel, fast_io_fail == 0 means immediate failure on rport delete.
diff --git a/multipath/multipath.rules b/multipath/multipath.rules
index 4d78b98..5753766 100644
--- a/multipath/multipath.rules
+++ b/multipath/multipath.rules
@@ -6,6 +6,7 @@ IMPORT{cmdline}="nompath"
ENV{nompath}=="?*", GOTO="end_mpath"
IMPORT{cmdline}="multipath"
ENV{multipath}=="off", GOTO="end_mpath"
+TEST!="/etc/multipath.conf", GOTO="end_mpath"
KERNEL=="dm-*", GOTO="check_kpartx"
ENV{DEVTYPE}!="partition", GOTO="test_dev"
diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service
index fd66cf6..fafd088 100644
--- a/multipathd/multipathd.service
+++ b/multipathd/multipathd.service
@@ -4,6 +4,7 @@ Wants=systemd-udev-trigger.service systemd-udev-settle.service
Before=iscsi.service iscsid.service lvm2-lvmetad.service lvm2-activation-early.service
Before=local-fs-pre.target blk-availability.service
After=multipathd.socket systemd-udev-trigger.service systemd-udev-settle.service
+ConditionPathExists=/etc/multipath.conf
DefaultDependencies=no
Conflicts=shutdown.target
ConditionKernelCommandLine=!nompath
--
2.7.4