diff options
author | NeilBrown <neilb@suse.de> | 2009-05-11 15:46:46 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-05-11 15:46:46 +1000 |
commit | 0ac91628b93b31636979b637c1ac7258064dea4e (patch) | |
tree | 88971a9e037c1519a8db205e8d6d1338ddfe8131 /mdadm.c | |
parent | 603f24a05f48063a7239e323e2aeab497cb0feb6 (diff) | |
download | mdadm-0ac91628b93b31636979b637c1ac7258064dea4e.tar.gz mdadm-0ac91628b93b31636979b637c1ac7258064dea4e.tar.xz mdadm-0ac91628b93b31636979b637c1ac7258064dea4e.zip |
Allow homehost to be largely ignored when assembling arrays.
If mdadm.conf contains
HOMEHOST <ignore>
or commandline contains
--homehost=<ignore>
then the check that array metadata mentions the given homehost is
replace by a check that the name recorded in the metadata is not
already used by some other array mentioned in mdadm.conf.
This allows more arrays to use their native name rather than having
an _NN suffix added.
This should only be used during boot time if all arrays required for
normal boot are listed in mdadm.conf.
If auto-assembly is used to find all array during boot, then the
HOMEHOST feature should be used to ensure there is no room for
confusion in choosing array names, and so it should not be set
to <ignore>.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r-- | mdadm.c | 34 |
1 files changed, 25 insertions, 9 deletions
@@ -91,6 +91,7 @@ int main(int argc, char *argv[]) char *homehost = NULL; char sys_hostname[256]; + int require_homehost = 1; char *mailaddr = NULL; char *program = NULL; int delay = 0; @@ -166,7 +167,10 @@ int main(int argc, char *argv[]) continue; case HomeHost: - homehost = optarg; + if (strcasecmp(optarg, "<ignore>") == 0) + require_homehost = 0; + else + homehost = optarg; continue; case ':': @@ -1009,7 +1013,7 @@ int main(int argc, char *argv[]) } if (homehost == NULL) - homehost = conf_get_homehost(); + homehost = conf_get_homehost(&require_homehost); if (homehost == NULL || strcmp(homehost, "<system>")==0) { if (gethostname(sys_hostname, sizeof(sys_hostname)) == 0) { sys_hostname[sizeof(sys_hostname)-1] = 0; @@ -1049,12 +1053,16 @@ int main(int argc, char *argv[]) array_ident->autof = autof; rv |= Assemble(ss, devlist->devname, array_ident, NULL, backup_file, - readonly, runstop, update, homehost, verbose-quiet, force); + readonly, runstop, update, + homehost, require_homehost, + verbose-quiet, force); } } else if (!scan) rv = Assemble(ss, devlist->devname, &ident, devlist->next, backup_file, - readonly, runstop, update, homehost, verbose-quiet, force); + readonly, runstop, update, + homehost, require_homehost, + verbose-quiet, force); else if (devs_found>0) { if (update && devs_found > 1) { fprintf(stderr, Name ": can only update a single array at a time\n"); @@ -1076,7 +1084,9 @@ int main(int argc, char *argv[]) array_ident->autof = autof; rv |= Assemble(ss, dv->devname, array_ident, NULL, backup_file, - readonly, runstop, update, homehost, verbose-quiet, force); + readonly, runstop, update, + homehost, require_homehost, + verbose-quiet, force); } } else { mddev_ident_t array_list = conf_get_ident(NULL); @@ -1104,7 +1114,9 @@ int main(int argc, char *argv[]) rv |= Assemble(ss, array_list->devname, array_list, NULL, NULL, - readonly, runstop, NULL, homehost, verbose-quiet, force); + readonly, runstop, NULL, + homehost, require_homehost, + verbose-quiet, force); cnt++; } if (homehost && cnt == 0) { @@ -1122,7 +1134,9 @@ int main(int argc, char *argv[]) rv2 = Assemble(ss, NULL, &ident, devlist, NULL, - readonly, runstop, NULL, homehost, verbose-quiet, force); + readonly, runstop, NULL, + homehost, require_homehost, + verbose-quiet, force); if (rv2==0) { cnt++; acnt++; @@ -1143,7 +1157,9 @@ int main(int argc, char *argv[]) rv2 = Assemble(ss, NULL, &ident, NULL, NULL, - readonly, runstop, "homehost", homehost, verbose-quiet, force); + readonly, runstop, "homehost", + homehost, require_homehost, + verbose-quiet, force); if (rv2==0) { cnt++; acnt++; @@ -1410,7 +1426,7 @@ int main(int argc, char *argv[]) break; } rv = Incremental(devlist->devname, verbose-quiet, runstop, - ss, homehost, autof); + ss, homehost, require_homehost, autof); break; case AUTODETECT: autodetect(); |