]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Create: warn when a metadata format's platform components are missing
authorDan Williams <dan.j.williams@intel.com>
Tue, 20 Jan 2009 08:36:51 +0000 (01:36 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 20 Jan 2009 08:36:51 +0000 (01:36 -0700)
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>
Create.c
Detail.c
mdadm.h
super-intel.c

index a7275d3d564b88367c861adba283868994067625..f63afa833cf02592e4593e6b6ce9b97dd2b2f107 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -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? ")) {
index 0d6bcf5ee7909ce1d1fb31e165076b7553c3c19c..9be9cfd808b0def053fbfb576c6fae2262e180df 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -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;
diff --git a/mdadm.h b/mdadm.h
index 3ee279071bc7979434091b1845c1de297e0823ff..7c8c2f127534e3230a65c39666d89f245c502549 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -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
index 9f8cea6321e98255308c411d5ffddb741623b420..0a7c34a258c9aa7231adeefebdd6c8a7a6caaa56 100644 (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)