[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dm-devel
Subject:    [dm-devel] [PATCH 1/2] multipathd: Fixing add map functionality
From:       Tejaswini Poluri <tpoluri () mvista ! com>
Date:       2015-07-20 9:41:31
Message-ID: 1437384572-23106-1-git-send-email-tpoluri () mvista ! com
[Download RAW message or body]

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 <tpoluri@mvista.com>
---
 multipathd/cli_handlers.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index dc96c45..032a789 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -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;
 }
 
-- 
1.9.1

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic