devname);
tmpdev->used = 2;
} else if (auto_assem && st == NULL &&
- !conf_test_metadata(tst->ss->name)) {
+ !conf_test_metadata(tst->ss->name,
+ tst->ss->match_home(tst, homehost) == 1)) {
if (report_missmatch)
fprintf(stderr, Name ": %s has metadata type %s for which "
"auto-assembly is disabled\n",
return 1;
}
- if (!match && !conf_test_metadata(st->ss->name)) {
- if (verbose >= 1)
- fprintf(stderr, Name
- ": %s has metadata type %s for which "
- "auto-assembly is disabled\n",
- devname, st->ss->name);
- 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
* on that. */
if (match)
trustworthy = LOCAL;
- else if ((homehost == NULL ||
- st->ss->match_home(st, homehost) != 1) &&
- st->ss->match_home(st, "any") != 1)
- trustworthy = FOREIGN;
+ else if (st->ss->match_home(st, homehost) == 1)
+ trustworthy = LOCAL;
+ else if (st->ss->match_home(st, "any") == 1)
+ trustworthy = LOCAL_ANY;
else
+ trustworthy = FOREIGN;
+
+
+ if (!match && !conf_test_metadata(st->ss->name,
+ (trustworthy == LOCAL))) {
+ if (verbose >= 1)
+ fprintf(stderr, Name
+ ": %s has metadata type %s for which "
+ "auto-assembly is disabled\n",
+ devname, st->ss->name);
+ return 1;
+ }
+ if (trustworthy == LOCAL_ANY)
trustworthy = LOCAL;
/* There are three possible sources for 'autof': command line,
return 0;
}
-int conf_test_metadata(const char *version)
+int conf_test_metadata(const char *version, int is_homehost)
{
/* Check if the given metadata version is allowed
* to be auto-assembled.
* The default is 'yes' but the 'auto' line might over-ride that.
- * Word in auto_options are processed in order with the first
+ * Words in auto_options are processed in order with the first
* match winning.
* word can be:
* +version - that version can be assembled
* -version - that version cannot be auto-assembled
* yes or +all - any other version can be assembled
* no or -all - no other version can be assembled.
+ * homehost - any array associated by 'homehost' to this
+ * host can be assembled.
+ *
+ * Thus:
+ * +ddf -0.90 homehost -all
+ * will auto-assemble any ddf array, no 0.90 array, and
+ * any other array (imsm, 1.x) if and only if it is identified
+ * as belonging to this host.
*/
char *w;
load_conffile();
return 1;
if (strcasecmp(w, "no") == 0)
return 0;
+ if (strcasecmp(w, "homehost") == 0) {
+ if (is_homehost)
+ return 1;
+ else
+ continue;
+ }
if (w[0] == '+')
rv = 1;
else if (w[0] == '-')
#DEVICE /dev/discs/*/*
#
#
+# The AUTO line can control which arrays get assembled by auto-assembly,
+# meaing either "mdadm -As" when there are no 'ARRAY' lines in this file,
+# or "mdadm --incremental" when the array found is not listed in this file.
+# By default, all arrays that are found are assembled.
+# If you want to ignore all DDF arrays (maybe they are managed by dmraid),
+# and only assemble 1.x arrays if which are marked for 'this' homehost,
+# but assemble all others, then use
+#AUTH -ddf hosthost -1.x +all
#
# ARRAY lines specify an array to assemble and a method of identification.
# Arrays can currently be identified by using a UUID, superblock minor number,
The
.B homehost
line gives a default value for the
-.B --homehost=
+.B \-\-homehost=
option to mdadm. There should normally be only one other word on the line.
It should either be a host name, or one of the special words
.B <system>
.B AUTO
A list of names of metadata format can be given, each preceded by a
plus or minus sign. Also the word
+.I homehost
+is allowed as is
+.I all
+preceded by plus or minus sign.
.I all
-preceded by plus or minus is allowed and is usually last.
+is usually last.
When
.I mdadm
is auto-assembling an array, either via
-.I --assemble
+.I \-\-assemble
or
-.I --incremental
+.I \-\-incremental
and it finds metadata of a given type, it checks that metadata type
against those listed in this line. The first match wins, where
.I all
auto assembly is disallowed. If no match is found, the auto assembly
is allowed.
+If the metadata indicates that the array was created for
+.I this
+host, and the word
+.I homehost
+appears before any other match, then the array is treated as a valid
+candidate for auto-assembly.
+
This can be used to disable all auto-assembly (so that only arrays
explicitly listed in mdadm.conf or on the command line are assembled),
or to disable assembly of certain metadata types which might be
-handled by other software.
+handled by other software. It can also be used to disable assembly of
+all foreign arrays - normally such arrays are assembled but given a
+non-deterministic name in
+.BR /dev/md/ .
The known metadata types are
.BR 0.90 ,
.br
HOMEHOST <system>
.br
-AUTO +1.x -all
+AUTO +1.x homehost -all
.SH SEE ALSO
.BR mdadm (8),
extern mddev_ident_t conf_get_ident(char *dev);
extern mddev_dev_t conf_get_devs(void);
extern int conf_test_dev(char *devname);
-extern int conf_test_metadata(const char *version);
+extern int conf_test_metadata(const char *version, int is_homehost);
extern struct createinfo *conf_get_create_info(void);
extern void set_conffile(char *file);
extern char *conf_get_mailaddr(void);
char *chosen);
/* values for 'trustworthy' */
#define LOCAL 1
+#define LOCAL_ANY 10
#define FOREIGN 2
#define METADATA 3
extern int open_mddev(char *dev, int report_errors);
* the hostname
*/
struct ddf_super *ddf = st->sb;
- int len = strlen(homehost);
+ int len;
+
+ if (!homehost)
+ return 0;
+ len = strlen(homehost);
return (memcmp(ddf->controller.guid, T10, 8) == 0 &&
len < sizeof(ddf->controller.vendor_data) &&