* [Patch] multipath-tools: Check if multipathd is running or not and print a warning
@ 2016-07-28 11:48 Milan P. Gandhi
2016-07-28 14:35 ` Hannes Reinecke
0 siblings, 1 reply; 3+ messages in thread
From: Milan P. Gandhi @ 2016-07-28 11:48 UTC (permalink / raw)
To: dm-devel
Hello,
With this patch dm-multipath commands e.g. multipath -v2,
multipath -ll etc. now checks if there are multipath
device maps created, and multipathd service is running
or not? If the multipath devices are created, but multipathd
service is not running then there will be a warning
message displayed to inform the user that IO failover/
failback may not work as expected without multipathd
process running.
I have tested this patch with Fedora 23, and latest
upstream multipath-tools
Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
---
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 707e6be..de79ed6 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -715,7 +715,8 @@ deadmap (struct multipath * mpp)
return 1; /* dead */
}
-int check_daemon(void)
+extern int
+check_daemon(void)
{
int fd;
char *reply;
@@ -752,6 +753,7 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
{
int r = 1;
int k, i;
+ int map_processed = 0;
int is_daemon = (cmd == CMD_NONE) ? 1 : 0;
char params[PARAMS_SIZE];
struct multipath * mpp;
@@ -916,6 +918,13 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
else
remove_map(mpp, vecs, 0);
}
+
+ /* By now at least one multipath device map is processed,
+ * so set map_processed = 1
+ */
+ if (!map_processed)
+ map_processed = 1;
+
}
/*
* Flush maps with only dead paths (ie not in sysfs)
@@ -941,6 +950,17 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
condlog(2, "%s: remove (dead)", alias);
}
}
+
+ /* If there is at least one multipath device map processed then
+ * check if 'multipathd' service is running or not?
+ */
+ if (map_processed) {
+ if (!is_daemon && !check_daemon()){
+ condlog(0, "'multipathd' service is currently not "
+ "running, IO failover/failback will not work");
+ }
+ }
+
return 0;
}
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index 442c956..ff76927 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -28,6 +28,7 @@ enum actions {
int setup_map (struct multipath * mpp, char * params, int params_size );
int domap (struct multipath * mpp, char * params, int is_daemon);
int reinstate_paths (struct multipath *mpp);
+int check_daemon(void);
int coalesce_paths (struct vectors *vecs, vector curmp, char * refwwid, int force_reload, enum mpath_cmds cmd);
int get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
vector pathvec, char **wwid);
diff --git a/multipath/main.c b/multipath/main.c
index 6ccece7..177986e 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -202,6 +202,7 @@ static int
get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
{
int i;
+ int maps_present = 0;
struct multipath * mpp;
char params[PARAMS_SIZE], status[PARAMS_SIZE];
@@ -253,7 +254,24 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
if (cmd == CMD_CREATE)
reinstate_paths(mpp);
+
+ /* At this place we have found at least one multipath
+ * device map, so set maps_present = 1
+ */
+ if (!maps_present)
+ maps_present = 1;
+ }
+
+ /* If there is at least one multipath device map present then
+ * check if 'multipathd' service is running or not?
+ */
+ if (maps_present && !check_daemon()) {
+ condlog(0, "multipath device maps are present, but "
+ "'multipathd' service is not running");
+ condlog(0, "IO failover/failback will not work without "
+ "'multipathd' service running");
}
+
return 0;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Patch] multipath-tools: Check if multipathd is running or not and print a warning
2016-07-28 11:48 [Patch] multipath-tools: Check if multipathd is running or not and print a warning Milan P. Gandhi
@ 2016-07-28 14:35 ` Hannes Reinecke
2016-07-29 16:02 ` Benjamin Marzinski
0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2016-07-28 14:35 UTC (permalink / raw)
To: mgandhi, dm-devel
On 07/28/2016 01:48 PM, Milan P. Gandhi wrote:
> Hello,
>
> With this patch dm-multipath commands e.g. multipath -v2,
> multipath -ll etc. now checks if there are multipath
> device maps created, and multipathd service is running
> or not? If the multipath devices are created, but multipathd
> service is not running then there will be a warning
> message displayed to inform the user that IO failover/
> failback may not work as expected without multipathd
> process running.
>
> I have tested this patch with Fedora 23, and latest
> upstream multipath-tools
>
> Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
> ---
No, this won't work.
You cannot guarantee that by the time 'multipath' is called the daemon
was already able to create any maps (the daemon might still be
processing events, without it being able to start creating maps).
So the best we can do is to check if the daemon is running
and continue from there.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] multipath-tools: Check if multipathd is running or not and print a warning
2016-07-28 14:35 ` Hannes Reinecke
@ 2016-07-29 16:02 ` Benjamin Marzinski
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Marzinski @ 2016-07-29 16:02 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: dm-devel, mgandhi
On Thu, Jul 28, 2016 at 04:35:21PM +0200, Hannes Reinecke wrote:
> On 07/28/2016 01:48 PM, Milan P. Gandhi wrote:
> > Hello,
> >
> > With this patch dm-multipath commands e.g. multipath -v2,
> > multipath -ll etc. now checks if there are multipath
> > device maps created, and multipathd service is running
> > or not? If the multipath devices are created, but multipathd
> > service is not running then there will be a warning
> > message displayed to inform the user that IO failover/
> > failback may not work as expected without multipathd
> > process running.
> >
> > I have tested this patch with Fedora 23, and latest
> > upstream multipath-tools
> >
> > Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
> > ---
> No, this won't work.
>
> You cannot guarantee that by the time 'multipath' is called the daemon
> was already able to create any maps (the daemon might still be
> processing events, without it being able to start creating maps).
>
> So the best we can do is to check if the daemon is running
> and continue from there.
I'm a little confused here. All that this is assuming is that
multipathd has user event listener thread started. This happens before
it has even run the initial configure to pick up already existing
devices. The other way of checking if the multipathd daemon is running
would be to look at the pidfile, right? Are you really worried that
people will often be creating devices with the multipath command in the
window between when multipathd locks the pidfile, and when it can
receive user commands? Otherwise, I don't see your how your suggestion
would make a difference. Perhaps, I'm misunderstanding you.
It seems like, in most cases, multipathd should have been started during
bootup, long before the multipath command would ever get called to
create a device, and these checks are only happening when multipath is
actually creating a device, so the calls to see if a device is a valid
path device (-c or -u) won't trigger this warning. Or am I missing
something here?
-Ben
>
> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke Teamlead Storage & Networking
> hare@suse.de +49 911 74053 688
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
> HRB 21284 (AG Nürnberg)
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-29 16:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-28 11:48 [Patch] multipath-tools: Check if multipathd is running or not and print a warning Milan P. Gandhi
2016-07-28 14:35 ` Hannes Reinecke
2016-07-29 16:02 ` Benjamin Marzinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).