multipath: add detect_prio option to autodetect prioitizer
Benjamin Marzinski
maintainerPATCH 1/1 multipath: add detect_prio option to autodetect prioitizer
This patch adds a new multipath.conf option, detect_prio. If set to yes, multipathd will try to determine the correct prioritizer for the device. If it finds one, that will be used instead of its configured prioritizer. If none is found, the configured prioritizer will be used. It can currently only detect ALUA devices.
Signed-off-by Benjamin Marzinski <[email protected]>
--- libmultipath/Makefile | 2 - libmultipath/config.c | 3 + libmultipath/config.h | 2 + libmultipath/defaults.h | 1 libmultipath/dict.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++ libmultipath/discovery.c | 1 libmultipath/propsel.c | 41 ++++++++++++++++++++++++++ libmultipath/propsel.h | 1 libmultipath/structs.h | 7 ++++ 9 files changed, 131 insertions(+), 1 deletion(-)
libmultipath/config.c +3 -0
@@ -330,6 +330,7 @@ merge_hwe (struct hwentry * dst, structmerge_num (dev_loss);merge_num (user_friendly_names);merge_num (retain_hwhandler); +merge_num (detect_prio);return 0 ; }
@@ -390,6 +391,7 @@ store_hwe (vector hwtable, struct hwentr hwe->dev_loss = dhwe->dev_loss; hwe->user_friendly_names = dhwe->user_friendly_names; hwe->retain_hwhandler = dhwe->retain_hwhandler; + hwe->detect_prio = dhwe->detect_prio;if (dhwe->bl_product && !(hwe->bl_product =set_param_str (dhwe->bl_product))) goto out;
@@ -530,6 +532,7 @@ load_config (char * file) conf->max_checkint =MAX_CHECKINT (conf->checkint); conf->fast_io_fail =5 ; conf->retain_hwhandler =DEFAULT_RETAIN_HWHANDLER ; + conf->detect_prio =DEFAULT_DETECT_PRIO ;/* * preload default hwtable
libmultipath/config.h +2 -0
@@ -46,6 +46,7 @@ struct hwentry {unsigned int dev_loss;int user_friendly_names;int retain_hwhandler; +int detect_prio;char * bl_product; };
@@ -109,6 +110,7 @@ struct config {uint32_t cookie;int reassign_maps;int retain_hwhandler; +int detect_prio;unsigned int version[3 ];char * dev;
libmultipath/defaults.h +1 -0
@@ -16,6 +16,7 @@#define DEFAULT_VERBOSITY 2#define DEFAULT_REASSIGN_MAPS 1#define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_OFF +#define DEFAULT_DETECT_PRIO DETECT_PRIO_OFF#define DEFAULT_CHECKINT 5#define MAX_CHECKINT (a) (a << 2)
libmultipath/dict.c +74 -0
110 lines not on this page · raw message
libmultipath/structs.h +7 -0
@@ -105,6 +105,12 @@ enum retain_hwhandler_states { RETAIN_HWHANDLER_ON, }; +enum detect_prio_states { +DETECT_PRIO_UNDEF , +DETECT_PRIO_OFF , +DETECT_PRIO_ON , +}; +struct scsi_idlun {int dev_id;int host_unique_id;
@@ -162,6 +168,7 @@ struct path {int failcount;int priority;int pgindex; +int detect_prio;char * uid_attribute;struct prio * prio;struct checker checker;
libmultipath/propsel.c +41 -0
61 lines not on this page · raw message
libmultipath/Makefile +1 -1
@@ -15,7 +15,7 @@ OBJS = memory.o parser.o vector.o devmap pgpolicies.o debug.o regex.o defaults.o uevent.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 + lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h)
libmultipath/discovery.c +1 -0
@@ -778,6 +778,7 @@ get_prio (struct path * pp)return 0 ;if (!pp->prio) { +select_detect_prio (pp);select_prio (pp);if (!pp->prio) {condlog (3 ,"%s: no prio selected" , pp->dev);
libmultipath/propsel.h +1 -0
@@ -19,3 +19,4 @@ int select_fast_io_fail(struct multipathint select_dev_loss (struct multipath *mp);int select_reservation_key (struct multipath *mp);int select_retain_hwhandler (struct multipath * mp); +int select_detect_prio (struct path * pp);