|
|
4ae388 |
---
|
|
|
4ae388 |
libmultipath/util.c | 22 ++++++++++++++++++++++
|
|
|
4ae388 |
libmultipath/util.h | 1 +
|
|
|
4ae388 |
multipath/main.c | 23 +----------------------
|
|
|
4ae388 |
multipathd/cli_handlers.c | 18 ++++++++++++++++++
|
|
|
4ae388 |
4 files changed, 42 insertions(+), 22 deletions(-)
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/util.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/util.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/util.c
|
|
|
4ae388 |
@@ -236,6 +236,28 @@ skip_proc:
|
|
|
4ae388 |
return 0;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
+/* This function returns a pointer inside of the supplied pathname string.
|
|
|
4ae388 |
+ * If is_path_device is true, it may also modify the supplied string */
|
|
|
4ae388 |
+char *convert_dev(char *name, int is_path_device)
|
|
|
4ae388 |
+{
|
|
|
4ae388 |
+ char *ptr;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (!name)
|
|
|
4ae388 |
+ return NULL;
|
|
|
4ae388 |
+ if (is_path_device) {
|
|
|
4ae388 |
+ ptr = strstr(name, "cciss/");
|
|
|
4ae388 |
+ if (ptr) {
|
|
|
4ae388 |
+ ptr += 5;
|
|
|
4ae388 |
+ *ptr = '!';
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ if (!strncmp(name, "/dev/", 5) && strlen(name) > 5)
|
|
|
4ae388 |
+ ptr = name + 5;
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ ptr = name;
|
|
|
4ae388 |
+ return ptr;
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
+
|
|
|
4ae388 |
dev_t parse_devt(const char *dev_t)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
int maj, min;
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/util.h
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/util.h
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/util.h
|
|
|
4ae388 |
@@ -10,6 +10,7 @@ size_t strlcat(char *dst, const char *sr
|
|
|
4ae388 |
void remove_trailing_chars(char *path, char c);
|
|
|
4ae388 |
int devt2devname (char *, int, char *);
|
|
|
4ae388 |
dev_t parse_devt(const char *dev_t);
|
|
|
4ae388 |
+char *convert_dev(char *dev, int is_path_device);
|
|
|
4ae388 |
|
|
|
4ae388 |
#define safe_sprintf(var, format, args...) \
|
|
|
4ae388 |
snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipath/main.c
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
@@ -254,16 +254,7 @@ configure (void)
|
|
|
4ae388 |
vecs.pathvec = pathvec;
|
|
|
4ae388 |
vecs.mpvec = curmp;
|
|
|
4ae388 |
|
|
|
4ae388 |
- /*
|
|
|
4ae388 |
- * dev is "/dev/" . "sysfs block dev"
|
|
|
4ae388 |
- */
|
|
|
4ae388 |
- if (conf->dev) {
|
|
|
4ae388 |
- if (!strncmp(conf->dev, "/dev/", 5) &&
|
|
|
4ae388 |
- strlen(conf->dev) > 5)
|
|
|
4ae388 |
- dev = conf->dev + 5;
|
|
|
4ae388 |
- else
|
|
|
4ae388 |
- dev = conf->dev;
|
|
|
4ae388 |
- }
|
|
|
4ae388 |
+ dev = convert_dev(conf->dev, (conf->dev_type == DEV_DEVNODE));
|
|
|
4ae388 |
|
|
|
4ae388 |
/*
|
|
|
4ae388 |
* if we have a blacklisted device parameter, exit early
|
|
|
4ae388 |
@@ -427,16 +418,6 @@ get_dev_type(char *dev) {
|
|
|
4ae388 |
return DEV_DEVMAP;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
-static void
|
|
|
4ae388 |
-convert_dev(char *dev)
|
|
|
4ae388 |
-{
|
|
|
4ae388 |
- char *ptr = strstr(dev, "cciss/");
|
|
|
4ae388 |
- if (ptr) {
|
|
|
4ae388 |
- ptr += 5;
|
|
|
4ae388 |
- *ptr = '!';
|
|
|
4ae388 |
- }
|
|
|
4ae388 |
-}
|
|
|
4ae388 |
-
|
|
|
4ae388 |
int
|
|
|
4ae388 |
main (int argc, char *argv[])
|
|
|
4ae388 |
{
|
|
|
4ae388 |
@@ -577,8 +558,6 @@ main (int argc, char *argv[])
|
|
|
4ae388 |
|
|
|
4ae388 |
strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);
|
|
|
4ae388 |
conf->dev_type = get_dev_type(conf->dev);
|
|
|
4ae388 |
- if (conf->dev_type == DEV_DEVNODE)
|
|
|
4ae388 |
- convert_dev(conf->dev);
|
|
|
4ae388 |
}
|
|
|
4ae388 |
conf->daemon = 0;
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
|
|
4ae388 |
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
|
|
4ae388 |
@@ -235,6 +235,7 @@ cli_list_map_topology (void * v, char **
|
|
|
4ae388 |
struct vectors * vecs = (struct vectors *)data;
|
|
|
4ae388 |
char * param = get_keyparam(v, MAP);
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 0);
|
|
|
4ae388 |
get_path_layout(vecs->pathvec, 0);
|
|
|
4ae388 |
mpp = find_mp_by_str(vecs->mpvec, param);
|
|
|
4ae388 |
|
|
|
4ae388 |
@@ -416,6 +417,7 @@ cli_add_path (void * v, char ** reply, i
|
|
|
4ae388 |
struct path *pp;
|
|
|
4ae388 |
int r;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 1);
|
|
|
4ae388 |
condlog(2, "%s: add path (operator)", param);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (filter_devnode(conf->blist_devnode, conf->elist_devnode,
|
|
|
4ae388 |
@@ -459,6 +461,7 @@ cli_del_path (void * v, char ** reply, i
|
|
|
4ae388 |
char * param = get_keyparam(v, PATH);
|
|
|
4ae388 |
struct path *pp;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 1);
|
|
|
4ae388 |
condlog(2, "%s: remove path (operator)", param);
|
|
|
4ae388 |
pp = find_path_by_dev(vecs->pathvec, param);
|
|
|
4ae388 |
if (!pp) {
|
|
|
4ae388 |
@@ -478,6 +481,7 @@ cli_add_map (void * v, char ** reply, in
|
|
|
4ae388 |
char *alias;
|
|
|
4ae388 |
int rc;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 0);
|
|
|
4ae388 |
condlog(2, "%s: add map (operator)", param);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (filter_wwid(conf->blist_wwid, conf->elist_wwid, param) > 0) {
|
|
|
4ae388 |
@@ -518,6 +522,7 @@ cli_del_map (void * v, char ** reply, in
|
|
|
4ae388 |
char *alias;
|
|
|
4ae388 |
int rc;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 0);
|
|
|
4ae388 |
condlog(2, "%s: remove map (operator)", param);
|
|
|
4ae388 |
minor = dm_get_minor(param);
|
|
|
4ae388 |
if (minor < 0) {
|
|
|
4ae388 |
@@ -549,6 +554,7 @@ cli_reload(void *v, char **reply, int *l
|
|
|
4ae388 |
struct multipath *mpp;
|
|
|
4ae388 |
int minor;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ mapname = convert_dev(mapname, 0);
|
|
|
4ae388 |
condlog(2, "%s: reload map (operator)", mapname);
|
|
|
4ae388 |
if (sscanf(mapname, "dm-%d", &minor) == 1)
|
|
|
4ae388 |
mpp = find_mp_by_minor(vecs->mpvec, minor);
|
|
|
4ae388 |
@@ -591,6 +597,7 @@ cli_resize(void *v, char **reply, int *l
|
|
|
4ae388 |
struct pathgroup *pgp;
|
|
|
4ae388 |
struct path *pp;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ mapname = convert_dev(mapname, 0);
|
|
|
4ae388 |
condlog(2, "%s: resize map (operator)", mapname);
|
|
|
4ae388 |
if (sscanf(mapname, "dm-%d", &minor) == 1)
|
|
|
4ae388 |
mpp = find_mp_by_minor(vecs->mpvec, minor);
|
|
|
4ae388 |
@@ -665,6 +672,7 @@ cli_restore_queueing(void *v, char **rep
|
|
|
4ae388 |
struct multipath *mpp;
|
|
|
4ae388 |
int minor;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ mapname = convert_dev(mapname, 0);
|
|
|
4ae388 |
condlog(2, "%s: restore map queueing (operator)", mapname);
|
|
|
4ae388 |
if (sscanf(mapname, "dm-%d", &minor) == 1)
|
|
|
4ae388 |
mpp = find_mp_by_minor(vecs->mpvec, minor);
|
|
|
4ae388 |
@@ -716,6 +724,7 @@ cli_disable_queueing(void *v, char **rep
|
|
|
4ae388 |
struct multipath *mpp;
|
|
|
4ae388 |
int minor;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ mapname = convert_dev(mapname, 0);
|
|
|
4ae388 |
condlog(2, "%s: disable map queueing (operator)", mapname);
|
|
|
4ae388 |
if (sscanf(mapname, "dm-%d", &minor) == 1)
|
|
|
4ae388 |
mpp = find_mp_by_minor(vecs->mpvec, minor);
|
|
|
4ae388 |
@@ -753,6 +762,7 @@ cli_switch_group(void * v, char ** reply
|
|
|
4ae388 |
char * mapname = get_keyparam(v, MAP);
|
|
|
4ae388 |
int groupnum = atoi(get_keyparam(v, GROUP));
|
|
|
4ae388 |
|
|
|
4ae388 |
+ mapname = convert_dev(mapname, 0);
|
|
|
4ae388 |
condlog(2, "%s: switch to path group #%i (operator)", mapname, groupnum);
|
|
|
4ae388 |
|
|
|
4ae388 |
return dm_switchgroup(mapname, groupnum);
|
|
|
4ae388 |
@@ -775,6 +785,7 @@ cli_suspend(void * v, char ** reply, int
|
|
|
4ae388 |
char * param = get_keyparam(v, MAP);
|
|
|
4ae388 |
int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param);
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 0);
|
|
|
4ae388 |
condlog(2, "%s: suspend (operator)", param);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!r) /* error */
|
|
|
4ae388 |
@@ -796,6 +807,7 @@ cli_resume(void * v, char ** reply, int
|
|
|
4ae388 |
char * param = get_keyparam(v, MAP);
|
|
|
4ae388 |
int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param);
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 0);
|
|
|
4ae388 |
condlog(2, "%s: resume (operator)", param);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!r) /* error */
|
|
|
4ae388 |
@@ -817,6 +829,7 @@ cli_reinstate(void * v, char ** reply, i
|
|
|
4ae388 |
char * param = get_keyparam(v, PATH);
|
|
|
4ae388 |
struct path * pp;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 1);
|
|
|
4ae388 |
pp = find_path_by_dev(vecs->pathvec, param);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!pp)
|
|
|
4ae388 |
@@ -837,6 +850,7 @@ cli_reassign (void * v, char ** reply, i
|
|
|
4ae388 |
{
|
|
|
4ae388 |
char * param = get_keyparam(v, MAP);
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 0);
|
|
|
4ae388 |
condlog(3, "%s: reset devices (operator)", param);
|
|
|
4ae388 |
|
|
|
4ae388 |
dm_reassign(param);
|
|
|
4ae388 |
@@ -851,6 +865,7 @@ cli_fail(void * v, char ** reply, int *
|
|
|
4ae388 |
struct path * pp;
|
|
|
4ae388 |
int r;
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 1);
|
|
|
4ae388 |
pp = find_path_by_dev(vecs->pathvec, param);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!pp)
|
|
|
4ae388 |
@@ -962,6 +977,7 @@ cli_getprstatus (void * v, char ** reply
|
|
|
4ae388 |
struct vectors * vecs = (struct vectors *)data;
|
|
|
4ae388 |
char * param = get_keyparam(v, MAP);
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 0);
|
|
|
4ae388 |
get_path_layout(vecs->pathvec, 0);
|
|
|
4ae388 |
mpp = find_mp_by_str(vecs->mpvec, param);
|
|
|
4ae388 |
|
|
|
4ae388 |
@@ -991,6 +1007,7 @@ cli_setprstatus(void * v, char ** reply,
|
|
|
4ae388 |
struct vectors * vecs = (struct vectors *)data;
|
|
|
4ae388 |
char * param = get_keyparam(v, MAP);
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 0);
|
|
|
4ae388 |
get_path_layout(vecs->pathvec, 0);
|
|
|
4ae388 |
mpp = find_mp_by_str(vecs->mpvec, param);
|
|
|
4ae388 |
|
|
|
4ae388 |
@@ -1013,6 +1030,7 @@ cli_unsetprstatus(void * v, char ** repl
|
|
|
4ae388 |
struct vectors * vecs = (struct vectors *)data;
|
|
|
4ae388 |
char * param = get_keyparam(v, MAP);
|
|
|
4ae388 |
|
|
|
4ae388 |
+ param = convert_dev(param, 0);
|
|
|
4ae388 |
get_path_layout(vecs->pathvec, 0);
|
|
|
4ae388 |
mpp = find_mp_by_str(vecs->mpvec, param);
|
|
|
4ae388 |
|