introduce --detail-platform to display platform raid capabilities

Metadata formats like imsm work in concert with platform firmware and
hardware, so provide a way for mdadm to display this info to the user.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2008-12-08 16:59:18 -07:00
parent 88c32bb1ec
commit 4cce406959
9 changed files with 89 additions and 3 deletions

View File

@ -530,3 +530,44 @@ out:
close(fd);
return rv;
}
int Detail_Platform(struct superswitch *ss, int scan, int verbose)
{
/* display platform capabilities for the given metadata format
* 'scan' in this context means iterate over all metadata types
*/
int i;
int err = 1;
if (ss && ss->detail_platform)
err = ss->detail_platform(verbose);
else if (ss) {
if (verbose)
fprintf(stderr, Name ": %s metadata is platform independent\n",
ss->name ? : "[no name]");
} else if (!scan) {
if (verbose)
fprintf(stderr, Name ": specify a metadata type or --scan\n");
}
if (!scan)
return err;
for (i = 0; superlist[i]; i++) {
struct superswitch *meta = superlist[i];
if (meta == ss)
continue;
if (verbose)
fprintf(stderr, Name ": checking metadata %s\n",
meta->name ? : "[no name]");
if (!meta->detail_platform) {
if (verbose)
fprintf(stderr, Name ": %s metadata is platform independent\n",
meta->name ? : "[no name]");
} else
err |= meta->detail_platform(verbose);
}
return err;
}

View File

@ -107,6 +107,7 @@ struct option long_options[] = {
{"query", 0, 0, 'Q'},
{"examine-bitmap", 0, 0, 'X'},
{"auto-detect", 0, 0, AutoDetect},
{"detail-platform", 0, 0, DetailPlatform},
/* synonyms */
{"monitor", 0, 0, 'F'},
@ -466,6 +467,7 @@ char Help_misc[] =
" --query -Q : Display general information about how a\n"
" device relates to the md driver\n"
" --detail -D : Display details of an array\n"
" --detail-platform : Display hardware/firmware details\n"
" --examine -E : Examine superblock on an array component\n"
" --examine-bitmap -X: Display contents of a bitmap file\n"
" --zero-superblock : erase the MD superblock from a device.\n"

35
mdadm.8
View File

@ -51,7 +51,7 @@ each device is a path to one common physical storage device.
is also not true RAID, and it only involves one device. It
provides a layer over a true device that can be used to inject faults.
B CONTAINER
.B CONTAINER
is different again. A
.B CONTAINER
is a collection of devices that are
@ -364,9 +364,13 @@ creating a DDF array a
.B CONTAINER
will be created, and normal arrays can be created in that container.
.IP imsm
Use the Intel Matrix Storage Manager metadata format. This creates a
Use the Intel(R) Matrix Storage Manager metadata format. This creates a
.B CONTAINER
which is managed in a similar manner to DDF.
which is managed in a similar manner to DDF, and is supported by an
option-rom on some platforms:
.IP
.B http://www.intel.com/design/chipsets/matrixstorage_sb.htm
.PP
.RE
.TP
@ -1008,6 +1012,11 @@ Information about what is discovered is presented.
.BR \-D ", " \-\-detail
Print detail of one or more md devices.
.TP
.BR \-\-detail\-platform
Print detail of the platform's raid capabilities (firmware / hardware
topology) for a given metadata format.
.TP
.BR \-Y ", " \-\-export
When used with
@ -1561,6 +1570,26 @@ The array has multiple failed devices such that it is unusable.
There was an error while trying to get information about the device.
.RE
.TP
.B \-\-detail\-platform
Print detail of the platform's raid capabilities (firmware / hardware
topology). If the metadata is specified with
.B \-e
or
.B \-\-metadata=
then the return status will be:
.RS
.TP
0
metadata successfully enumerated its platform components on this system
.TP
1
metadata is platform independent
.TP
2
metadata failed to find its platform components on this system
.RE
.TP
.B \-\-examine
The device should be a component of an md array.

View File

@ -217,6 +217,7 @@ int main(int argc, char *argv[])
case 'w':
case 'W':
case Waitclean:
case DetailPlatform:
case 'K': if (!mode) newmode = MISC; break;
}
if (mode && newmode == mode) {
@ -769,6 +770,7 @@ int main(int argc, char *argv[])
case O(MISC,'w'):
case O(MISC,'W'):
case O(MISC, Waitclean):
case O(MISC, DetailPlatform):
if (devmode && devmode != opt &&
(devmode == 'E' || (opt == 'E' && devmode != 'Q'))) {
fprintf(stderr, Name ": --examine/-E cannot be given with -%c\n",
@ -1211,6 +1213,8 @@ int main(int argc, char *argv[])
rv = Examine(devlist, scan?(verbose>1?0:verbose+1):brief,
export, scan,
SparcAdjust, ss, homehost);
} else if (devmode == DetailPlatform) {
rv = Detail_Platform(ss ? ss->ss : NULL, ss ? scan : 1, verbose);
} else {
if (devlist == NULL) {
if ((devmode=='D' || devmode == Waitclean) && scan) {

View File

@ -225,6 +225,7 @@ enum special_options {
Symlinks,
AutoDetect,
Waitclean,
DetailPlatform,
};
/* structures read from config file */
@ -441,6 +442,9 @@ extern struct superswitch {
void (*brief_detail_super)(struct supertype *st);
void (*export_detail_super)(struct supertype *st);
/* Optional: platform hardware / firmware details */
int (*detail_platform)(int verbose);
/* Used:
* to get uuid to storing in bitmap metadata
* and 'reshape' backup-data metadata
@ -584,6 +588,7 @@ extern struct superswitch {
int swapuuid; /* true if uuid is bigending rather than hostendian */
int external;
const char *name; /* canonical metadata name */
} super0, super1, super_ddf, *superlist[];
extern struct superswitch super_imsm;
@ -722,6 +727,7 @@ extern int Create(struct supertype *st, char *mddev,
char *bitmap_file, int bitmap_chunk, int write_behind, int delay, int autof);
extern int Detail(char *dev, int brief, int export, int test, char *homehost);
extern int Detail_Platform(struct superswitch *ss, int scan, int verbose);
extern int Query(char *dev);
extern int Examine(mddev_dev_t devlist, int brief, int export, int scan,
int SparcAdjust, struct supertype *forcest, char *homehost);

View File

@ -3426,4 +3426,5 @@ struct superswitch super_ddf = {
.prepare_update = ddf_prepare_update,
.activate_spare = ddf_activate_spare,
#endif
.name = "ddf",
};

View File

@ -3808,6 +3808,7 @@ struct superswitch super_imsm = {
.container_content = container_content_imsm,
.external = 1,
.name = "imsm",
#ifndef MDASSEMBLE
/* for mdmon */

View File

@ -1110,4 +1110,5 @@ struct superswitch super0 = {
.locate_bitmap = locate_bitmap0,
.write_bitmap = write_bitmap0,
.free_super = free_super0,
.name = "0.90",
};

View File

@ -1574,4 +1574,5 @@ struct superswitch super1 = {
#else
.swapuuid = 1,
#endif
.name = "1.0",
};