5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Disk Monitor
29 */
30 #include <sys/types.h>
31 #include <sys/stat.h>
32 #include <fcntl.h>
33 #include <time.h>
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <strings.h>
37 #include <stdarg.h>
38 #include <errno.h>
39 #include <signal.h>
40 #include <unistd.h>
41 #include <pthread.h>
42 #include <libnvpair.h>
43 #include <fm/fmd_api.h>
44 #include <fm/fmd_fmri.h>
141 }
142
143 static void
144 dm_fault_execute_actions(fmd_hdl_t *hdl, diskmon_t *diskp, nvlist_t *nvl)
145 {
146 const char *action_prop = NULL;
147 const char *action_string;
148
149 /*
150 * The predictive failure action is the activation of the fault
151 * indicator.
152 */
153 if (fmd_nvl_class_match(hdl, nvl,
154 DISK_ERROR_CLASS "." FM_FAULT_DISK_OVERTEMP))
155 action_prop = DISK_PROP_OTEMPACTION;
156
157 if (fmd_nvl_class_match(hdl, nvl,
158 DISK_ERROR_CLASS "." FM_FAULT_DISK_TESTFAIL))
159 action_prop = DISK_PROP_STFAILACTION;
160
161 dm_fault_indicator_set(diskp, INDICATOR_ON);
162
163 if (action_prop != NULL &&
164 (action_string = dm_prop_lookup(diskp->props, action_prop))
165 != NULL) {
166
167 if (dm_platform_indicator_execute(action_string) != 0) {
168 log_warn("Fault action `%s' did not successfully "
169 "complete.\n", action_string);
170 }
171 }
172 }
173
174 static void
175 diskmon_agent_repair(fmd_hdl_t *hdl, nvlist_t *nvl, int repair)
176 {
177 char *uuid = NULL;
178 nvlist_t **nva;
179 uint_t nvc;
180 diskmon_t *diskp;
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 /*
29 * Disk Monitor
30 */
31 #include <sys/types.h>
32 #include <sys/stat.h>
33 #include <fcntl.h>
34 #include <time.h>
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <strings.h>
38 #include <stdarg.h>
39 #include <errno.h>
40 #include <signal.h>
41 #include <unistd.h>
42 #include <pthread.h>
43 #include <libnvpair.h>
44 #include <fm/fmd_api.h>
45 #include <fm/fmd_fmri.h>
142 }
143
144 static void
145 dm_fault_execute_actions(fmd_hdl_t *hdl, diskmon_t *diskp, nvlist_t *nvl)
146 {
147 const char *action_prop = NULL;
148 const char *action_string;
149
150 /*
151 * The predictive failure action is the activation of the fault
152 * indicator.
153 */
154 if (fmd_nvl_class_match(hdl, nvl,
155 DISK_ERROR_CLASS "." FM_FAULT_DISK_OVERTEMP))
156 action_prop = DISK_PROP_OTEMPACTION;
157
158 if (fmd_nvl_class_match(hdl, nvl,
159 DISK_ERROR_CLASS "." FM_FAULT_DISK_TESTFAIL))
160 action_prop = DISK_PROP_STFAILACTION;
161
162 if (fmd_nvl_class_match(hdl, nvl,
163 DISK_ERROR_CLASS "." FM_FAULT_SSM_WEAROUT))
164 action_prop = DISK_PROP_SSMWEAROUTACTION;
165
166 dm_fault_indicator_set(diskp, INDICATOR_ON);
167
168 if (action_prop != NULL &&
169 (action_string = dm_prop_lookup(diskp->props, action_prop))
170 != NULL) {
171
172 if (dm_platform_indicator_execute(action_string) != 0) {
173 log_warn("Fault action `%s' did not successfully "
174 "complete.\n", action_string);
175 }
176 }
177 }
178
179 static void
180 diskmon_agent_repair(fmd_hdl_t *hdl, nvlist_t *nvl, int repair)
181 {
182 char *uuid = NULL;
183 nvlist_t **nva;
184 uint_t nvc;
185 diskmon_t *diskp;
|