Print this page
8074 need to add FMA event for SSD wearout

@@ -19,14 +19,13 @@
  * CDDL HEADER END
  */
 /*
  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 /*
  * Disk error transport module
  *
  * This transport module is responsible for translating between disk errors
  * and FMA ereports.  It is a read-only transport module, and checks for the

@@ -33,10 +32,11 @@
  * following failures:
  *
  *      - overtemp
  *      - predictive failure
  *      - self-test failure
+ *      - solid state media wearout
  *
  * These failures are detected via the TOPO_METH_DISK_STATUS method, which
  * leverages libdiskstatus to do the actual analysis.  This transport module is
  * in charge of the following tasks:
  *

@@ -111,11 +111,10 @@
         nvlist_t *result;
         nvlist_t *fmri, *faults;
         char *protocol;
         int err;
         disk_monitor_t *dmp = arg;
-        uint64_t ena;
         nvpair_t *elem;
         boolean_t fault;
         nvlist_t *details;
         char *fmristr;
         nvlist_t *in = NULL;

@@ -150,14 +149,12 @@
                 return (TOPO_WALK_NEXT);
         }
 
         nvlist_free(in);
 
-        ena = fmd_event_ena_create(dmp->dm_hdl);
-
         /*
-         * Add any faults.
+         * Check for faults and post ereport(s) if needed
          */
         if (nvlist_lookup_nvlist(result, "faults", &faults) == 0 &&
             nvlist_lookup_string(result, "protocol", &protocol) == 0) {
                 elem = NULL;
                 while ((elem = nvlist_next_nvpair(faults, elem)) != NULL) {

@@ -168,12 +165,19 @@
                         if (!fault ||
                             nvlist_lookup_nvlist(result, nvpair_name(elem),
                             &details) != 0)
                                 continue;
 
+                        if (strcmp(nvpair_name(elem),
+                            FM_EREPORT_SCSI_SSMWEAROUT) == 0 &&
+                            fmd_prop_get_int32(dmp->dm_hdl,
+                            "ignore-ssm-wearout") == FMD_B_TRUE)
+                                continue;
+
                         dt_post_ereport(dmp->dm_hdl, dmp->dm_xprt, protocol,
-                            nvpair_name(elem), ena, fmri, details);
+                            nvpair_name(elem),
+                            fmd_event_ena_create(dmp->dm_hdl), fmri, details);
                 }
         }
 
         nvlist_free(result);
         nvlist_free(fmri);

@@ -246,10 +250,11 @@
 
 static const fmd_prop_t fmd_props[] = {
         { "interval", FMD_TYPE_TIME, "1h" },
         { "min-interval", FMD_TYPE_TIME, "1min" },
         { "simulate", FMD_TYPE_STRING, "" },
+        { "ignore-ssm-wearout", FMD_TYPE_BOOL, "false"},
         { NULL, 0, NULL }
 };
 
 static const fmd_hdl_ops_t fmd_ops = {
         NULL,                   /* fmdo_recv */

@@ -260,11 +265,11 @@
         NULL,                   /* fmdo_send */
         dt_topo_change,         /* fmdo_topo_change */
 };
 
 static const fmd_hdl_info_t fmd_info = {
-        "Disk Transport Agent", "1.0", &fmd_ops, fmd_props
+        "Disk Transport Agent", "1.1", &fmd_ops, fmd_props
 };
 
 void
 _fmd_init(fmd_hdl_t *hdl)
 {