summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-26 04:16:07 +0000
committerNeil Brown <neilb@suse.de>2006-05-26 04:16:07 +0000
commit589395d69664377f7cce99f6b73e33e3ec417b52 (patch)
tree45ef84cb7ffde4d3932f3111d796e918c64dfc5a /mdadm.c
parentb3b33eb5cdf7190e1de195bc7429ea815f117f64 (diff)
downloadmdadm-589395d69664377f7cce99f6b73e33e3ec417b52.tar.gz
mdadm-589395d69664377f7cce99f6b73e33e3ec417b52.tar.xz
mdadm-589395d69664377f7cce99f6b73e33e3ec417b52.zip
Support --auto-update-homehost
This can be used to bootstrape homehost tagging. If no arrays are found that are tagged, we look for any array and tag it. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/mdadm.c b/mdadm.c
index ff656e4..fc50d76 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -100,6 +100,7 @@ int main(int argc, char *argv[])
int re_add = 0;
char *shortopt = short_options;
int dosyslog = 0;
+ int auto_update_home = 0;
int copies;
int print_help = 0;
@@ -315,6 +316,9 @@ int main(int argc, char *argv[])
}
continue;
+ case O(ASSEMBLE,AutoHomeHost):
+ auto_update_home = 1;
+ continue;
case O(CREATE,'e'):
case O(ASSEMBLE,'e'):
case O(MISC,'e'): /* set metadata (superblock) information */
@@ -1037,10 +1041,33 @@ int main(int argc, char *argv[])
cnt++;
acnt++;
}
+ if (rv2 == 1)
+ /* found something so even though assembly failed we
+ * want to avoid auto-updates
+ */
+ auto_update_home = 0;
} while (rv2!=2);
/* Incase there are stacked devices, we need to go around again */
devlist = conf_get_devs(configfile);
} while (acnt);
+ if (cnt == 0 && auto_update_home && homehost) {
+ /* Nothing found, maybe we need to bootstrap homehost info */
+ do {
+ acnt = 0;
+ do {
+ rv2 = Assemble(ss, NULL, -1,
+ &ident, configfile,
+ devlist, NULL,
+ readonly, runstop, "homehost", homehost, verbose-quiet, force);
+ if (rv2==0) {
+ cnt++;
+ acnt++;
+ }
+ } while (rv2!=2);
+ /* Incase there are stacked devices, we need to go around again */
+ devlist = conf_get_devs(configfile);
+ } while (acnt);
+ }
if (cnt == 0 && rv == 0) {
fprintf(stderr, Name ": No arrays found in config file or automatically\n");
rv = 1;