@@ -892,7 +892,7 @@ int dm_find_map_by_wwid(const char *wwid, char *name, struct dm_info *dmi)
if (safe_sprintf(tmp, UUID_PREFIX "%s", wwid))
return DMP_ERR;
- return libmp_mapinfo(DM_MAP_BY_UUID,
+ return libmp_mapinfo(DM_MAP_BY_UUID | MAPINFO_MPATH_ONLY,
(mapid_t) { .str = tmp },
(mapinfo_t) { .name = name, .dmi = dmi });
}
@@ -725,7 +725,13 @@ cli_add_map (void * v, struct strbuf *reply, void * data)
condlog(2, "%s: unknown map.", param);
return -ENODEV;
}
- if (dm_find_map_by_wwid(refwwid, alias, &dmi) != DMP_OK) {
+ rc = dm_find_map_by_wwid(refwwid, alias, &dmi);
+ if (rc == DMP_NO_MATCH) {
+ condlog(2, "%s: wwid %s already in use by non-multipath device %s",
+ param, refwwid, alias);
+ return 1;
+ }
+ if (rc != DMP_OK) {
condlog(3, "%s: map not present. creating", param);
if (coalesce_paths(vecs, NULL, refwwid, FORCE_RELOAD_NONE,
CMD_NONE) != CP_OK) {