multipath-tools: support for coalescing heterogenous paths
PATCH 1/1 multipath-tools: support for coalescing heterogenous paths
This patch supports coalescing heterogenous paths by using udev rules files. This is useful in the scenario of migrating data for heterogenous arrays without interrupting uplayer transaction. The udev rules file, which is located in the /etc/udev/rules.d/ directory, is automatically generated by multipath with new options -m and -n.
For example:
multipath -m dm-0 -n 1000036006016028
The geneated udev rules is as follows:
KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="1000036006016028", ENV{ID_SERIAL}="36006016- 028f03600588db521dc7ce71"
KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_WWN}=="1000036006016028", ENV{ID_WWN}="36006016028f036- 00588db521dc7ce71"
KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_UUID}=="1000036006016028", ENV{ID_UUID}="36006016028f03- 600588db521dc7ce71"
--- libmultipath/Makefile | 3 +- libmultipath/config.h | 1 + libmultipath/udevrule.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++++ libmultipath/udevrule.h | 13 ++++ multipath/main.c | 29 +++++++- multipath/multipath.8 | 12 +++ 6 files changed, 247 insertions(+), 2 deletions(-) create mode 100644 libmultipath/udevrule.c create mode 100644 libmultipath/udevrule.h
libmultipath/Makefile +2 -1
@@ -42,7 +42,8 @@ OBJS = memory.o parser.o vector.o devmapper.o callout.o \ pgpolicies.o debug.o defaults.o uevent.o time-util.o \ switchgroup.o uxsock.o print.o alias.o log_pthread.o \ log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \ - lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o + lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o \ + udevrule.o all: $(LIBS)
libmultipath/config.h +1 -0
@@ -34,6 +34,7 @@ enum mpath_cmds {CMD_REMOVE_WWID ,CMD_RESET_WWIDS ,CMD_ADD_WWID , + CMD_GEN_UDEVRULE, }; enum force_reload_types {
libmultipath/udevrule.c new file +191 -0
191 lines not on this page · raw message
libmultipath/udevrule.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef _UDEVRULE_H +#define _UDEVRULE_H + +#define UDEV_RULES_FILE "/etc/udev/rules.d/99-multipath-udev.rules" + +#define UDEV_RULE_FILE_HEADHER \ +"# This file was automatically generated by the multipath program\n" \ +"# You can modify it,as long as you keep each rule on a single\n" \ +"# line,and change only the single line by deleting it .\n" + +int gen_udevrules (char *md,char *wwid); + +#endif /* _UDEVRULE_H */
multipath/main.c +28 -1
@@ -58,6 +58,7 @@#include "wwids.h" #include "uxsock.h" #include "mpath_cmd.h" +#include "udevrule.h" int logsink;struct udev *udev;
@@ -107,6 +108,7 @@ usage (char * progname)fprintf (stderr," %s -F [-v lvl] [-R num]\n" , progname);fprintf (stderr," %s -t\n" , progname);fprintf (stderr," %s -h\n" , progname); +fprintf (stderr," %s -m dm -n wwid\n" , progname);fprintf (stderr,"\n" "Where:\n"
@@ -138,6 +140,9 @@ usage (char * progname)" . 2 default verbosity\n" " . 3 print debug information\n" " -R num number of times to retry removes of in-use devices\n" +" -m dm specify the multipath device to be coalesced with\n" +" -n wwid the wwid of the device to be coalesced with the multipath device\n" +" . It is the same as unique identifier the path given the uid_attribute\n" " dev action limited to:\n" " . multipath named 'dev' (ex: mpath0) or\n" " . multipath whose wwid is 'dev' (ex: 60051..)\n"
@@ -514,6 +519,8 @@ main (int argc, char *argv[])char *dev =NULL ;struct config *conf;int retries =-1 ; +char *mpathname =NULL ; +char *wwid =NULL ; udev =udev_new (); logsink =0 ;
@@ -522,7 +529,8 @@ main (int argc, char *argv[])exit (1 ); multipath_conf = conf; conf->retrigger_tries =0 ; -while ((arg =getopt (argc, argv,":adchl::FfM:v:p:b:BrR:itquwW" )) !=EOF ) { +while ((arg =getopt (argc, argv, +":adchl::FfM:v:p:b:BrR:itquwWm:n:" )) !=EOF ) {switch (arg) {case 1 :printf ("optarg : %s\n" ,optarg);break ;
@@ -605,6 +613,14 @@ main (int argc, char *argv[])case 'R' : retries =atoi (optarg);break ; +case 'm' : + cmd =CMD_GEN_UDEVRULE ; + mpathname =strdup (optarg); +break ; +case 'n' : + wwid =strdup (optarg); +break ; +case ':' :fprintf (stderr,"Missing option argument\n" );usage (argv[0 ]);
@@ -680,6 +696,13 @@ main (int argc, char *argv[])condlog (0 ,"the -c option requires a path to check" ); goto out; } + +if (cmd ==CMD_GEN_UDEVRULE ) { +if (gen_udevrules (mpathname, wwid)) +condlog (0 ,"cannot generate udev rule file" ); + goto out; + } +if (cmd ==CMD_VALID_PATH && dev_type ==DEV_UEVENT ) {int fd;
@@ -758,6 +781,10 @@ out_free_config:udev_unref (udev);if (dev)FREE (dev); +if (mpathname) +free (mpathname); +if (wwid) +free (wwid);#ifdef _DEBUG_dbg_free_final (NULL );#endif
multipath/multipath.8 +12 -0
@@ -30,6 +30,10 @@ multipath \- Device mapper target autoconfig. .IR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|] .RB [\| \-R\ \c .IR retries \|] +.RB [\| \-m\ \c +.IR dm \ \|\c +.RB \| \-n\ \c +.IR wwid \|] .RB [\| device \|] . .
@@ -162,6 +166,14 @@ Number of times to retry flushing multipath devices that are in-use. The default is \fI0\fR. . .TP +.BI \-m " dm" +Specify the multipath device to be coalesced with. +. +.TP +.BI \-n " wwid" +The wwid of the device to be coalesced into the multipath device +. +.TP .BI device Update only the devmap specified by .IR device ,
Signature · 1 line
2.11.1
Hi, guys,
Any comments about this patch?
IMO, this feature of coalescing heterogenous paths without interrupting uplayer transaction is worthy to integrate into multipath-tools. Please consider about it.
I am glad to see if there is anything which can be improve for this patch.
Thanks
Guan Junxiong
Quoted 34 lines · Guan Junxiong
This patch supports coalescing heterogenous paths by using udev rules files. This is useful in the scenario of migrating data for heterogenous arrays without interrupting uplayer transaction. The udev rules file, which is located in the
/etc/udev/rules.d/directory, is automatically generated by multipath with new options -m and -n.For example:
multipath -m dm-0 -n 1000036006016028The geneated udev rules is as follows:
KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="1000036006016028", ENV{ID_SERIAL}="36006016-028f03600588db521dc7ce71"KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_WWN}=="1000036006016028", ENV{ID_WWN}="36006016028f036-
00588db521dc7ce71"KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_UUID}=="1000036006016028", ENV{ID_UUID}="36006016028f03-
600588db521dc7ce71"Signed-off-by Junxiong Guan <[email protected]>--- libmultipath/Makefile | 3 +- libmultipath/config.h | 1 + libmultipath/udevrule.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++++ libmultipath/udevrule.h | 13 ++++ multipath/main.c | 29 +++++++- multipath/multipath.8 | 12 +++ 6 files changed, 247 insertions(+), 2 deletions(-) create mode 100644 libmultipath/udevrule.c create mode 100644 libmultipath/udevrule.h
Hi Martin,
If time allows, please consider this feature of coalescing heterogenous paths by udev rules as suggested by you in the original patch.
Any comment is welcome.
Thanks.
Best Wishes
Guan Junxiong
Quoted 8 lines · Guan Junxiong
Hi, guys,
Any comments about this patch?
IMO, this feature of coalescing heterogenous paths without interrupting uplayer transaction is worthy to integrate into multipath-tools. Please consider about it.
Quoted 41 lines
I am glad to see if there is anything which can be improve for this patch.
Thanks
Guan JunxiongQuoted 34 lines · Guan Junxiong
This patch supports coalescing heterogenous paths by using udev rules files. This is useful in the scenario of migrating data for heterogenous arrays without interrupting uplayer transaction. The udev rules file, which is located in the
/etc/udev/rules.d/directory, is automatically generated by multipath with new options -m and -n.For example:
multipath -m dm-0 -n 1000036006016028The geneated udev rules is as follows:
KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="1000036006016028", ENV{ID_SERIAL}="36006016-028f03600588db521dc7ce71"KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_WWN}=="1000036006016028", ENV{ID_WWN}="36006016028f036-
00588db521dc7ce71"KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_UUID}=="1000036006016028", ENV{ID_UUID}="36006016028f03-
600588db521dc7ce71"Signed-off-by Junxiong Guan <[email protected]>--- libmultipath/Makefile | 3 +- libmultipath/config.h | 1 + libmultipath/udevrule.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++++ libmultipath/udevrule.h | 13 ++++ multipath/main.c | 29 +++++++- multipath/multipath.8 | 12 +++ 6 files changed, 247 insertions(+), 2 deletions(-) create mode 100644 libmultipath/udevrule.c create mode 100644 libmultipath/udevrule.h
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 5 lines · Guan Junxiong
Quoted 4 lines · Guan Junxiong
Hi, guys,
Any comments about this patch?
Quoted 8 lines
Quoted 8 lines
IMO, this feature of coalescing heterogenous paths without interrupting
uplayer transaction is worthy to integrate into multipath-tools. Please
consider about it.I am glad to see if there is anything which can be improve for this patch.
I admit I haven't looked into the details this time. But I spoke with Hannes about it, and we agreed that this is not something we would like to see in upstream multipath-tools. multipath is taking efforts to make sure that we do *not* coalesce any devices that aren't actually paths to the same disk. Your patch is trying to do the opposite.
AFAICS this is a special feature provided by certain storage arrays from Huawei. It doesn't work at all without the storage array being properly configured to take appropriate action to keep the "heterogeneous paths" in sync. We think support for this belongs into Huawei software for the time being. If this feature becomes standardized in the future, and if the OS has some reliable, standardized means to detect this feature in the array, it might be a different issue. But even then, we'd need to use extreme caution not to corrupt our users' data.
This is Hannes' and my opinion, others feel free to speak up if you disagree.
Martin
Quoted 46 lines
Quoted 41 lines
Thanks
Guan JunxiongQuoted 35 lines · Guan Junxiong
This patch supports coalescing heterogenous paths by using udev rules files. This is useful in the scenario of migrating data for heterogenous arrays without interrupting uplayer transaction. The udev rules file, which is located in the
/etc/udev/rules.d/directory, is automatically generated by multipath with new options -m and -n.For example:
multipath -m dm-0 -n 1000036006016028The geneated udev rules is as follows:
KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="1000036006016028", ENV{ID_SERIAL}="36006016-028f03600588db521dc7ce71"KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_WWN}=="1000036006016028", ENV{ID_WWN}="36006016028f036-
00588db521dc7ce71"KERNEL=="sd*[!0-9]|nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_UUID}=="1000036006016028", ENV{ID_UUID}="36006016028f03-
600588db521dc7ce71"Signed-off-by Junxiong Guan <[email protected]>--- libmultipath/Makefile | 3 +- libmultipath/config.h | 1 + libmultipath/udevrule.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++++ libmultipath/udevrule.h | 13 ++++ multipath/main.c | 29 +++++++- multipath/multipath.8 | 12 +++ 6 files changed, 247 insertions(+), 2 deletions(-) create mode 100644 libmultipath/udevrule.c create mode 100644 libmultipath/udevrule.h--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel