a1478bc1bc
(git commit id: 63704387009443bdb37d9deaaafa9ab121d45bfb) Add 0001-RH-fix-async-tur.patch Add 0002-RH-dont_start_with_no_config.patch Add 0003-RH-multipath.rules.patch Add 0004-RH-update-init-script.patch Add 0005-RH-cciss_id.patch Add 0006-RH-Make-build-system-RH-Fedora-friendly.patch Add 0007-RH-multipathd-blacklist-all-by-default.patch Add 0008-RH-add-mpathconf.patch Add 0009-RH-add-find-multipaths.patch Add 0010-RH-check-if-multipath-owns-path.patch Add 0011-RH-add-hp_tur-checker.patch
120 lines
3.9 KiB
Diff
120 lines
3.9 KiB
Diff
---
|
|
libmultipath/finder.c | 2 +-
|
|
libmultipath/finder.h | 1 +
|
|
multipath/main.c | 35 +++++++++++++++++++++++++++++------
|
|
3 files changed, 31 insertions(+), 7 deletions(-)
|
|
|
|
Index: multipath-tools-111219/libmultipath/finder.c
|
|
===================================================================
|
|
--- multipath-tools-111219.orig/libmultipath/finder.c
|
|
+++ multipath-tools-111219/libmultipath/finder.c
|
|
@@ -78,7 +78,7 @@ write_out_wwid(int fd, char *wwid) {
|
|
return 1;
|
|
}
|
|
|
|
-static int
|
|
+int
|
|
check_wwids_file(char *wwid, int write_wwid)
|
|
{
|
|
int scan_fd, fd, can_write, found, ret;
|
|
Index: multipath-tools-111219/libmultipath/finder.h
|
|
===================================================================
|
|
--- multipath-tools-111219.orig/libmultipath/finder.h
|
|
+++ multipath-tools-111219/libmultipath/finder.h
|
|
@@ -14,5 +14,6 @@
|
|
|
|
int should_multipath(struct path *pp, vector pathvec);
|
|
int remember_wwid(char *wwid);
|
|
+int check_wwids_file(char *wwid, int write_wwid);
|
|
|
|
#endif /* _FINDER_H */
|
|
Index: multipath-tools-111219/multipath/main.c
|
|
===================================================================
|
|
--- multipath-tools-111219.orig/multipath/main.c
|
|
+++ multipath-tools-111219/multipath/main.c
|
|
@@ -83,7 +83,7 @@ usage (char * progname)
|
|
{
|
|
fprintf (stderr, VERSION_STRING);
|
|
fprintf (stderr, "Usage:\n");
|
|
- fprintf (stderr, " %s [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
|
+ fprintf (stderr, " %s [-c] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
|
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
|
|
fprintf (stderr, " %s -F [-v lvl]\n", progname);
|
|
fprintf (stderr, " %s -t\n", progname);
|
|
@@ -96,6 +96,7 @@ usage (char * progname)
|
|
" -ll show multipath topology (maximum info)\n" \
|
|
" -f flush a multipath device map\n" \
|
|
" -F flush all multipath device maps\n" \
|
|
+ " -c check if a device should be a path in a multipath device\n" \
|
|
" -q allow queue_if_no_path when multipathd is not running\n"\
|
|
" -d dry run, do not create or update devmaps\n" \
|
|
" -t dump internal hardware table\n" \
|
|
@@ -261,9 +262,13 @@ configure (void)
|
|
* if we have a blacklisted device parameter, exit early
|
|
*/
|
|
if (dev &&
|
|
- (filter_devnode(conf->blist_devnode, conf->elist_devnode, dev) > 0))
|
|
- goto out;
|
|
-
|
|
+ (filter_devnode(conf->blist_devnode,
|
|
+ conf->elist_devnode, dev) > 0)) {
|
|
+ if (conf->dry_run == 2)
|
|
+ printf("%s is not a valid multipath device path\n",
|
|
+ conf->dev);
|
|
+ goto out;
|
|
+ }
|
|
/*
|
|
* scope limiting must be translated into a wwid
|
|
* failing the translation is fatal (by policy)
|
|
@@ -279,6 +284,15 @@ configure (void)
|
|
if (filter_wwid(conf->blist_wwid, conf->elist_wwid,
|
|
refwwid) > 0)
|
|
goto out;
|
|
+ if (conf->dry_run == 2) {
|
|
+ if (check_wwids_file(refwwid, 0) == 0){
|
|
+ printf("%s is a valid multipath device path\n", conf->dev);
|
|
+ r = 0;
|
|
+ }
|
|
+ else
|
|
+ printf("%s is not a valid multipath device path\n", conf->dev);
|
|
+ goto out;
|
|
+ }
|
|
}
|
|
|
|
/*
|
|
@@ -418,7 +432,7 @@ main (int argc, char *argv[])
|
|
condlog(0, "multipath tools need sysfs mounted");
|
|
exit(1);
|
|
}
|
|
- while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:Brtq")) != EOF ) {
|
|
+ while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) {
|
|
switch(arg) {
|
|
case 1: printf("optarg : %s\n",optarg);
|
|
break;
|
|
@@ -440,8 +454,12 @@ main (int argc, char *argv[])
|
|
case 'q':
|
|
conf->allow_queueing = 1;
|
|
break;
|
|
+ case 'c':
|
|
+ conf->dry_run = 2;
|
|
+ break;
|
|
case 'd':
|
|
- conf->dry_run = 1;
|
|
+ if (!conf->dry_run)
|
|
+ conf->dry_run = 1;
|
|
break;
|
|
case 'f':
|
|
conf->remove = FLUSH_ONE;
|
|
@@ -523,6 +541,11 @@ main (int argc, char *argv[])
|
|
}
|
|
dm_init();
|
|
|
|
+ if (conf->dry_run == 2 &&
|
|
+ (!conf->dev || conf->dev_type == DEV_DEVMAP)) {
|
|
+ condlog(0, "the -c option requires a path to check");
|
|
+ goto out;
|
|
+ }
|
|
if (conf->remove == FLUSH_ONE) {
|
|
if (conf->dev_type == DEV_DEVMAP)
|
|
r = dm_flush_map(conf->dev);
|