Create: warn when a metadata format's platform components are missing

If the metadata handler can not find its platform support components
then there is no way for it to verify that the raid configuration will
be supported by the option-rom.  Provide a generic method for metadata
handlers to warn the user that the array they are about to create may
not work as intended with a given platform.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2009-01-20 01:36:51 -07:00
parent a20d2ba5f3
commit 5615172f1d
4 changed files with 18 additions and 4 deletions

View File

@ -404,6 +404,14 @@ int Create(struct supertype *st, char *mddev,
warn = 1;
}
if (st->ss->detail_platform && st->ss->detail_platform(0, 1) != 0) {
if (runstop != 1 || verbose >= 0)
fprintf(stderr, Name ": %s unable to enumerate platform support\n"
" array may not be compatible with hardware/firmware\n",
st->ss->name);
warn = 1;
}
if (warn) {
if (runstop!= 1) {
if (!ask("Continue creating array? ")) {

View File

@ -540,7 +540,7 @@ int Detail_Platform(struct superswitch *ss, int scan, int verbose)
int err = 1;
if (ss && ss->detail_platform)
err = ss->detail_platform(verbose);
err = ss->detail_platform(verbose, 0);
else if (ss) {
if (verbose)
fprintf(stderr, Name ": %s metadata is platform independent\n",
@ -566,7 +566,7 @@ int Detail_Platform(struct superswitch *ss, int scan, int verbose)
fprintf(stderr, Name ": %s metadata is platform independent\n",
meta->name ? : "[no name]");
} else
err |= meta->detail_platform(verbose);
err |= meta->detail_platform(verbose, 0);
}
return err;

View File

@ -443,7 +443,7 @@ extern struct superswitch {
void (*export_detail_super)(struct supertype *st);
/* Optional: platform hardware / firmware details */
int (*detail_platform)(int verbose);
int (*detail_platform)(int verbose, int enumerate_only);
/* Used:
* to get uuid to storing in bitmap metadata

View File

@ -916,7 +916,7 @@ static int imsm_enumerate_ports(const char *hba_path, int port_count, int host_b
return err;
}
static int detail_platform_imsm(int verbose)
static int detail_platform_imsm(int verbose, int enumerate_only)
{
/* There are two components to imsm platform support, the ahci SATA
* controller and the option-rom. To find the SATA controller we
@ -937,6 +937,12 @@ static int detail_platform_imsm(int verbose)
int host_base = 0;
int port_count = 0;
if (enumerate_only) {
if (check_env("IMSM_NO_PLATFORM") || find_imsm_orom())
return 0;
return 2;
}
list = find_driver_devices("pci", "ahci");
for (hba = list; hba; hba = hba->next)
if (devpath_to_vendor(hba->path) == 0x8086)