From: Dan Williams Date: Wed, 25 Feb 2009 01:45:57 +0000 (-0700) Subject: Incremental: honor --no-degraded to delay assembly X-Git-Tag: mdadm-3.0-devel3~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdb482f99b9ad2ef8cd1724902fdfeedaa8796a1;p=thirdparty%2Fmdadm.git Incremental: honor --no-degraded to delay assembly Currently Incremental_container is being called after adding each disk. In the imsm case where spares are not tracked in the raid_disks field we can use --no-degraded to block premature assembly. Signed-off-by: Dan Williams --- diff --git a/Incremental.c b/Incremental.c index 0a0dc037..e293999e 100644 --- a/Incremental.c +++ b/Incremental.c @@ -398,6 +398,8 @@ int Incremental(char *devname, int verbose, int runstop, ": container %s now has %d devices\n", chosen_name, info.array.working_disks); wait_for(chosen_name); + if (runstop < 0) + return 0; /* don't try to assemble */ return Incremental(chosen_name, verbose, runstop, NULL, homehost, autof); } @@ -405,7 +407,8 @@ int Incremental(char *devname, int verbose, int runstop, active_disks = count_active(st, mdfd, &avail, &info); if (enough(info.array.level, info.array.raid_disks, info.array.layout, info.array.state & 1, - avail, active_disks) == 0) { + avail, active_disks) == 0 || + (runstop < 0 && active_disks < info.array.raid_disks)) { free(avail); if (verbose >= 0) fprintf(stderr, Name diff --git a/mdadm.8 b/mdadm.8 index b474bc1c..1b9071f8 100644 --- a/mdadm.8 +++ b/mdadm.8 @@ -1116,6 +1116,11 @@ uses to help track which arrays are currently being assembled. Run any array assembled as soon as a minimal number of devices are available, rather than waiting until all expected devices are present. +.TP +.B \-\-no\-degraded +This allows the hot-plug system to prevent arrays from running when it knows +that more disks may arrive later in the discovery process. + .TP .BR \-\-scan ", " \-s Only meaningful with diff --git a/mdadm.c b/mdadm.c index 1f9b707c..72e7926f 100644 --- a/mdadm.c +++ b/mdadm.c @@ -644,6 +644,7 @@ int main(int argc, char *argv[]) " 'summaries', 'homehost', 'byteorder', 'devicesize'.\n"); exit(outf == stdout ? 0 : 2); + case O(INCREMENTAL,NoDegraded): case O(ASSEMBLE,NoDegraded): /* --no-degraded */ runstop = -1; /* --stop isn't allowed for --assemble, * so we overload slightly */