summaryrefslogtreecommitdiffstats
path: root/Incremental.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-05-11 15:17:05 +1000
committerNeilBrown <neilb@suse.de>2009-05-11 15:17:05 +1000
commit112cace627b02a7bc918e857cce03b2cc5fc3d52 (patch)
tree0cb29269fa3c3f625e6666ccf9ad26cb94ef7dc6 /Incremental.c
parent745f72f61ab363dbc1c19fd00cc29edc42571f62 (diff)
downloadmdadm-112cace627b02a7bc918e857cce03b2cc5fc3d52.tar.gz
mdadm-112cace627b02a7bc918e857cce03b2cc5fc3d52.tar.xz
mdadm-112cace627b02a7bc918e857cce03b2cc5fc3d52.zip
config: support "ARRAY <ignore> ..." lines in mdadm.conf
Sometimes we want to ensure particular arrays are never assembled automatically. This might include an array made of devices that are shared between hosts. To support this, allow ARRAY lines in mdadm.conf to use the word "ignore" rather than a device name. Arrays which match such lines are never automatically assembled (though they can still be assembled by explicitly giving identification information on the mdadm command line. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Incremental.c')
-rw-r--r--Incremental.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/Incremental.c b/Incremental.c
index c13ea43..5849d39 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -211,6 +211,15 @@ int Incremental(char *devname, int verbose, int runstop,
match = array_list;
}
+ if (match && match->devname
+ && strcasecmp(match->devname, "<ignore>") == 0) {
+ if (verbose >= 0)
+ fprintf(stderr, Name ": array containing %s is explicitly"
+ " ignored by mdadm.conf\n",
+ devname);
+ return 1;
+ }
+
/* 3a/ if not, check for homehost match. If no match, continue
* but don't trust the 'name' in the array. Thus a 'random' minor
* number will be assigned, and the device name will be based
@@ -746,7 +755,7 @@ int Incremental_container(struct supertype *st, char *devname, int verbose,
strcpy(chosen_name, mp->path);
} else {
- /* Check in mdadm.conf for devices == devname and
+ /* Check in mdadm.conf for container == devname and
* member == ra->text_version after second slash.
*/
char *sub = strchr(ra->text_version+1, '/');
@@ -784,6 +793,15 @@ int Incremental_container(struct supertype *st, char *devname, int verbose,
break;
}
+ if (match && match->devname &&
+ strcasecmp(match->devname, "<ignore>") == 0) {
+ if (verbose > 0)
+ fprintf(stderr, Name ": array %s/%s is "
+ "explicitly ignored by mdadm.conf\n",
+ match->container, match->member);
+ return 2;
+ }
+
mdfd = create_mddev(match ? match->devname : NULL,
ra->name,
autof,