multipathd: Fixing add map functionality
PATCH 1/2 multipathd: Fixing add map functionality
Add map feature of multipathd tools fails as the device is also been completely removed along with removing the map in the remove map code.
So when add map is called we are creating the device again in cli_add_map() using the coloasce_paths code.
Signed-off-by Tejaswini Poluri <[email protected]>
--- multipathd/cli_handlers.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
multipathd/cli_handlers.c +11 -5
@@ -535,7 +535,7 @@ cli_add_map (void * v, char ** reply, int * len, void * data)char * param =get_keyparam (v,MAP );int major, minor;char dev_path[PATH_SIZE ]; -char *alias; +char *alias, *refwwid;int rc; param =convert_dev (param,0 );
@@ -545,27 +545,33 @@ cli_add_map (void * v, char ** reply, int * len, void * data) *reply =strdup ("blacklisted\n" ); *len =strlen (*reply) +1 ;condlog (2 ,"%s: map blacklisted" , param); -return 0 ; +return 1 ; } +mapname: minor =dm_get_minor (param);if (minor <0 ) {condlog (2 ,"%s: not a device mapper table" , param); -return 0 ; } major =dm_get_major (param);if (major <0 ) {condlog (2 ,"%s: not a device mapper table" , param); -return 0 ; }sprintf (dev_path,"dm-%d" , minor); alias =dm_mapname (major, minor);if (!alias) {condlog (2 ,"%s: mapname not found for %d:%d" , param, major, minor); -return 0 ; + rc =get_refwwid (param,DEV_DEVMAP , vecs->pathvec, &refwwid); +if (refwwid) { +if (coalesce_paths (vecs,NULL , refwwid,0 )) +condlog (2 ,"%s: coalesce_paths failed" , param); +dm_lib_release (); + } + goto mapname; } rc =ev_add_map (dev_path, alias, vecs);FREE (alias); +FREE (refwwid);return rc; }
Signature · 1 line
1.9.1
PATCH 2/2 multipathd: Disabled code that is not being used.
This part of the code is moved to cli_add_map and disabled here as it is not used by any function call here.
Signed-off-by Tejaswini Poluri <[email protected]>
--- multipathd/main.c | 2 ++ 1 file changed, 2 insertions(+)
multipathd/main.c +2 -0
@@ -329,6 +329,7 @@ ev_add_map (char * dev, char * alias, struct vectors * vecs)return 1 ; } } +#if 0 /*Disabled as the code is not used by any function*/ r =get_refwwid (dev,DEV_DEVMAP , vecs->pathvec, &refwwid);if (refwwid) {
@@ -344,6 +345,7 @@ ev_add_map (char * dev, char * alias, struct vectors * vecs)condlog (0 ,"%s: uev_add_map %s failed" , alias, dev);FREE (refwwid); +#endif return r; }
Signature · 1 line
1.9.1