summaryrefslogtreecommitdiffstats
path: root/Incremental.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-05-11 15:47:10 +1000
committerNeilBrown <neilb@suse.de>2009-05-11 15:47:10 +1000
commit7cdc0872342e8834f224132867ea88ee04e050bf (patch)
treed372fa52b023528c2069607753bce302700c636e /Incremental.c
parent5c4c9ab16d7db67c660570c354e9e75fb6e20ecc (diff)
downloadmdadm-7cdc0872342e8834f224132867ea88ee04e050bf.tar.gz
mdadm-7cdc0872342e8834f224132867ea88ee04e050bf.tar.xz
mdadm-7cdc0872342e8834f224132867ea88ee04e050bf.zip
Be more consistent about keeping the host: prefix on array names.
If an array name contains a "hostname:" prefix, then --assemble will tend to leave it there, while --incremental will strip it off (when chosing a device name during auto-assembly). Make this more consistent: strip the name off if we decide that the name will be treated as 'local'. Leave it on if it will be treated as 'foreign'. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Incremental.c')
-rw-r--r--Incremental.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Incremental.c b/Incremental.c
index c5ec634..8e711d9 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -260,12 +260,8 @@ int Incremental(char *devname, int verbose, int runstop,
return Incremental_container(st, devname, verbose, runstop,
autof, trustworthy);
}
- name_to_use = strchr(info.name, ':');
- if (name_to_use)
- name_to_use++;
- else
- name_to_use = info.name;
+ name_to_use = info.name;
if (name_to_use[0] == 0 &&
info.array.level == LEVEL_CONTAINER &&
trustworthy == LOCAL) {
@@ -277,6 +273,12 @@ int Incremental(char *devname, int verbose, int runstop,
conf_name_is_free(name_to_use))
trustworthy = LOCAL;
+ /* strip "hostname:" prefix from name if we have decided
+ * to treat it as LOCAL
+ */
+ if (trustworthy == LOCAL && strchr(name_to_use, ':') != NULL)
+ name_to_use = strchr(name_to_use, ':')+1;
+
/* 4/ Check if array exists.
*/
map_lock(&map);