|
|
50e627 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
50e627 |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
50e627 |
Date: Fri, 16 Jul 2021 12:39:17 -0500
|
|
|
50e627 |
Subject: [PATCH] multipath: print warning if multipathd is not running.
|
|
|
50e627 |
|
|
|
50e627 |
If multipath notices that multipath devices exist or were created, and
|
|
|
50e627 |
multipathd is not running, it now prints a warning message, so users are
|
|
|
50e627 |
notified of the issue.
|
|
|
50e627 |
|
|
|
50e627 |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
50e627 |
---
|
|
|
50e627 |
libmultipath/configure.c | 13 +++++++++++--
|
|
|
50e627 |
libmultipath/configure.h | 1 +
|
|
|
50e627 |
multipath/main.c | 5 +++++
|
|
|
50e627 |
3 files changed, 17 insertions(+), 2 deletions(-)
|
|
|
50e627 |
|
|
|
50e627 |
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
|
|
|
50e627 |
index f24d9283..9c8d3e34 100644
|
|
|
50e627 |
--- a/libmultipath/configure.c
|
|
|
50e627 |
+++ b/libmultipath/configure.c
|
|
|
50e627 |
@@ -1043,7 +1043,8 @@ deadmap (struct multipath * mpp)
|
|
|
50e627 |
return 1; /* dead */
|
|
|
50e627 |
}
|
|
|
50e627 |
|
|
|
50e627 |
-int check_daemon(void)
|
|
|
50e627 |
+extern int
|
|
|
50e627 |
+check_daemon(void)
|
|
|
50e627 |
{
|
|
|
50e627 |
int fd;
|
|
|
50e627 |
char *reply;
|
|
|
50e627 |
@@ -1097,6 +1098,8 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
|
|
|
50e627 |
struct config *conf;
|
|
|
50e627 |
int allow_queueing;
|
|
|
50e627 |
uint64_t *size_mismatch_seen;
|
|
|
50e627 |
+ bool map_processed = false;
|
|
|
50e627 |
+ bool no_daemon = false;
|
|
|
50e627 |
|
|
|
50e627 |
/* ignore refwwid if it's empty */
|
|
|
50e627 |
if (refwwid && !strlen(refwwid))
|
|
|
50e627 |
@@ -1239,7 +1242,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
|
|
|
50e627 |
conf = get_multipath_config();
|
|
|
50e627 |
allow_queueing = conf->allow_queueing;
|
|
|
50e627 |
put_multipath_config(conf);
|
|
|
50e627 |
- if (!is_daemon && !allow_queueing && !check_daemon()) {
|
|
|
50e627 |
+ if (!is_daemon && !allow_queueing &&
|
|
|
50e627 |
+ (no_daemon || !check_daemon())) {
|
|
|
50e627 |
+ no_daemon = true;
|
|
|
50e627 |
if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF &&
|
|
|
50e627 |
mpp->no_path_retry != NO_PATH_RETRY_FAIL)
|
|
|
50e627 |
condlog(3, "%s: multipathd not running, unset "
|
|
|
50e627 |
@@ -1267,6 +1272,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
|
|
|
50e627 |
else
|
|
|
50e627 |
remove_map(mpp, vecs, 0);
|
|
|
50e627 |
}
|
|
|
50e627 |
+ map_processed = true;
|
|
|
50e627 |
}
|
|
|
50e627 |
/*
|
|
|
50e627 |
* Flush maps with only dead paths (ie not in sysfs)
|
|
|
50e627 |
@@ -1292,6 +1298,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
|
|
|
50e627 |
condlog(2, "%s: remove (dead)", alias);
|
|
|
50e627 |
}
|
|
|
50e627 |
}
|
|
|
50e627 |
+ if (map_processed && !is_daemon && (no_daemon || !check_daemon()))
|
|
|
50e627 |
+ condlog(2, "multipath devices exist, but multipathd service is not running");
|
|
|
50e627 |
+
|
|
|
50e627 |
ret = CP_OK;
|
|
|
50e627 |
out:
|
|
|
50e627 |
free(size_mismatch_seen);
|
|
|
50e627 |
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
|
|
|
50e627 |
index 81090dd4..8a266d31 100644
|
|
|
50e627 |
--- a/libmultipath/configure.h
|
|
|
50e627 |
+++ b/libmultipath/configure.h
|
|
|
50e627 |
@@ -59,3 +59,4 @@ struct udev_device *get_udev_device(const char *dev, enum devtypes dev_type);
|
|
|
50e627 |
void trigger_paths_udev_change(struct multipath *mpp, bool is_mpath);
|
|
|
50e627 |
void trigger_partitions_udev_change(struct udev_device *dev, const char *action,
|
|
|
50e627 |
int len);
|
|
|
50e627 |
+int check_daemon(void);
|
|
|
50e627 |
diff --git a/multipath/main.c b/multipath/main.c
|
|
|
50e627 |
index 607cada2..14d045c9 100644
|
|
|
50e627 |
--- a/multipath/main.c
|
|
|
50e627 |
+++ b/multipath/main.c
|
|
|
50e627 |
@@ -254,6 +254,7 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
|
|
|
50e627 |
int i;
|
|
|
50e627 |
struct multipath * mpp;
|
|
|
50e627 |
char params[PARAMS_SIZE], status[PARAMS_SIZE];
|
|
|
50e627 |
+ bool maps_present = false;
|
|
|
50e627 |
|
|
|
50e627 |
if (dm_get_maps(curmp))
|
|
|
50e627 |
return 1;
|
|
|
50e627 |
@@ -302,6 +303,8 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
|
|
|
50e627 |
|
|
|
50e627 |
if (cmd == CMD_CREATE)
|
|
|
50e627 |
reinstate_paths(mpp);
|
|
|
50e627 |
+
|
|
|
50e627 |
+ maps_present = true;
|
|
|
50e627 |
}
|
|
|
50e627 |
|
|
|
50e627 |
if (cmd == CMD_LIST_SHORT || cmd == CMD_LIST_LONG) {
|
|
|
50e627 |
@@ -311,6 +314,8 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
|
|
|
50e627 |
put_multipath_config(conf);
|
|
|
50e627 |
}
|
|
|
50e627 |
|
|
|
50e627 |
+ if (maps_present && !check_daemon())
|
|
|
50e627 |
+ condlog(2, "multipath devices exist, but multipathd service is not running");
|
|
|
50e627 |
return 0;
|
|
|
50e627 |
}
|
|
|
50e627 |
|