annotate usr/src/cmd/fm/modules/common/sw-diag-response/subsidiary/smf/smf_response.c @ 12979:ab9ae749152f

PSARC/2009/617 Software Events Notification Parameters CLI PSARC/2009/618 snmp-notify: SNMP Notification Daemon for Software Events PSARC/2009/619 smtp-notify: Email Notification Daemon for Software Events PSARC/2010/225 fmd for non-global Solaris zones PSARC/2010/226 Solaris Instance UUID PSARC/2010/227 nvlist_nvflag(3NVPAIR) PSARC/2010/228 libfmevent additions PSARC/2010/257 sysevent_evc_setpropnvl and sysevent_evc_getpropnvl PSARC/2010/265 FMRI and FMA Event Stabilty, 'ireport' category 1 event class, and the 'sw' FMRI scheme PSARC/2010/278 FMA/SMF integration: instance state transitions PSARC/2010/279 Modelling panics within FMA PSARC/2010/290 logadm.conf upgrade 6392476 fmdump needs to pretty-print 6393375 userland ereport/ireport event generation interfaces 6445732 Add email notification agent for FMA and software events 6804168 RFE: Allow an efficient means to monitor SMF services status changes 6866661 scf_values_destroy(3SCF) will segfault if is passed NULL 6884709 Add snmp notification agent for FMA and software events 6884712 Add private interface to tap into libfmd_msg macro expansion capabilities 6897919 fmd to run in a non-global zone 6897937 fmd use of non-private doors is not safe 6900081 add a UUID to Solaris kernel image for use in crashdump identification 6914884 model panic events as a defect diagnosis in FMA 6944862 fmd_case_open_uuid, fmd_case_uuisresolved, fmd_nvl_create_defect 6944866 log legacy sysevents in fmd 6944867 enumerate svc scheme in topo 6944868 software-diagnosis and software-response fmd modules 6944870 model SMF maintenance state as a defect diagnosis in FMA 6944876 savecore runs in foreground for systems with zfs root and dedicated dump 6965796 Implement notification parameters for SMF state transitions and FMA events 6968287 SUN-FM-MIB.mib needs to be updated to reflect Oracle information 6972331 logadm.conf upgrade PSARC/2010/290
author Gavin Maltby <gavin.maltby@oracle.com>
date Fri, 30 Jul 2010 17:04:17 +1000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12979
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
1 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
2 * CDDL HEADER START
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
3 *
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
4 * The contents of this file are subject to the terms of the
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
5 * Common Development and Distribution License (the "License").
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
6 * You may not use this file except in compliance with the License.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
7 *
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
9 * or http://www.opensolaris.org/os/licensing.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
10 * See the License for the specific language governing permissions
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
11 * and limitations under the License.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
12 *
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
13 * When distributing Covered Code, include this CDDL HEADER in each
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
15 * If applicable, add the following below this CDDL HEADER, with the
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
16 * fields enclosed by brackets "[]" replaced with your own identifying
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
17 * information: Portions Copyright [yyyy] [name of copyright owner]
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
18 *
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
19 * CDDL HEADER END
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
20 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
21
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
22 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
23 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
24 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
25
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
26 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
27 * SMF software-response subsidiary
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
28 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
29
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
30 #include <strings.h>
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
31 #include <fm/libtopo.h>
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
32 #include <libscf.h>
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
33 #include <sys/fm/protocol.h>
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
34 #include <fm/fmd_fmri.h>
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
35
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
36 #include "../../common/sw.h"
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
37 #include "smf.h"
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
38
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
39 static struct {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
40 fmd_stat_t swrp_smf_repairs;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
41 fmd_stat_t swrp_smf_clears;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
42 fmd_stat_t swrp_smf_closed;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
43 fmd_stat_t swrp_smf_wrongclass;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
44 fmd_stat_t swrp_smf_badlist;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
45 fmd_stat_t swrp_smf_badresource;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
46 fmd_stat_t swrp_smf_badclrevent;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
47 fmd_stat_t swrp_smf_noloop;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
48 fmd_stat_t swrp_smf_suppressed;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
49 fmd_stat_t swrp_smf_cachefull;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
50 } swrp_smf_stats = {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
51 { "swrp_smf_repairs", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
52 "repair events received for propogation to SMF" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
53 { "swrp_smf_clears", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
54 "notifications from SMF of exiting maint state" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
55 { "swrp_smf_closed", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
56 "cases closed" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
57 { "swrp_smf_wrongclass", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
58 "unexpected event class received" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
59 { "swrp_smf_badlist", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
60 "list event with invalid structure" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
61 { "swrp_smf_badresource", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
62 "list.repaired with smf fault but bad svc fmri" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
63 { "swrp_smf_badclrevent", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
64 "maint clear event from SMF malformed" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
65 { "swrp_smf_noloop", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
66 "avoidance of smf->fmd->smf repairs propogations" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
67 { "swrp_smf_suppressed", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
68 "not propogated to smf because no longer in maint" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
69 { "swrp_smf_cachefull", FMD_TYPE_UINT64,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
70 "uuid cache full" },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
71 };
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
72
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
73 #define BUMPSTAT(stat) swrp_smf_stats.stat.fmds_value.ui64++
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
74
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
75 #define CACHE_NENT_INC 16
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
76 #define CACHE_NENT_MAX 128
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
77
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
78 struct smf_uuid_cache_ent {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
79 char uuid[37];
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
80 char fmristr[90];
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
81 uint8_t mark;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
82 };
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
83
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
84 #define CACHE_VERSION 1
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
85
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
86 struct smf_uuid_cache {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
87 uint32_t version; /* Version */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
88 uint32_t nentries; /* Real size of array below */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
89 struct smf_uuid_cache_ent entry[1]; /* Cache entries */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
90 };
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
91
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
92 static struct smf_uuid_cache *uuid_cache;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
93
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
94 #define UUID_CACHE_BUFNAME "uuid_cache"
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
95
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
96 static void
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
97 uuid_cache_grow(fmd_hdl_t *hdl)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
98 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
99 struct smf_uuid_cache *newcache;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
100 size_t newsz;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
101 uint32_t n;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
102
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
103 n = (uuid_cache == NULL ? 0 : uuid_cache->nentries) + CACHE_NENT_INC;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
104 newsz = sizeof (struct smf_uuid_cache) + (n - 1) *
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
105 sizeof (struct smf_uuid_cache_ent);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
106
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
107 newcache = fmd_hdl_zalloc(hdl, newsz, FMD_SLEEP);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
108 newcache->version = CACHE_VERSION;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
109 newcache->nentries = n;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
110
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
111 if (uuid_cache != NULL) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
112 uint32_t oldn = uuid_cache->nentries;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
113 size_t oldsz = sizeof (struct smf_uuid_cache) +
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
114 (oldn - 1) * sizeof (struct smf_uuid_cache_ent);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
115
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
116 bcopy(&uuid_cache->entry[0], &newcache->entry[0], oldsz);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
117 fmd_hdl_free(hdl, uuid_cache, oldsz);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
118 fmd_buf_destroy(hdl, NULL, UUID_CACHE_BUFNAME);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
119 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
120
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
121 uuid_cache = newcache;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
122 fmd_buf_create(hdl, NULL, UUID_CACHE_BUFNAME, newsz);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
123 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
124
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
125 static void
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
126 uuid_cache_persist(fmd_hdl_t *hdl)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
127 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
128 size_t sz = sizeof (struct smf_uuid_cache) +
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
129 (uuid_cache->nentries - 1) * sizeof (struct smf_uuid_cache_ent);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
130
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
131 fmd_buf_write(hdl, NULL, UUID_CACHE_BUFNAME, uuid_cache, sz);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
132 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
133
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
134 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
135 * Garbage-collect the uuid cache. Any cases that are already resolved
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
136 * we do not need an entry for. If a case is not resolved but the
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
137 * service involved in that case is no longer in maintenance state
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
138 * then we've lost sync somehow, so repair the asru (which will
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
139 * also resolve the case).
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
140 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
141 static void
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
142 uuid_cache_gc(fmd_hdl_t *hdl)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
143 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
144 struct smf_uuid_cache_ent *entp;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
145 topo_hdl_t *thp = NULL;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
146 nvlist_t *svcfmri;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
147 char *svcname;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
148 int err, i;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
149
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
150 for (i = 0; i < uuid_cache->nentries; i++) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
151 entp = &uuid_cache->entry[i];
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
152
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
153 if (entp->uuid[0] == '\0')
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
154 continue;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
155
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
156 if (fmd_case_uuisresolved(hdl, entp->uuid)) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
157 bzero(entp->uuid, sizeof (entp->uuid));
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
158 bzero(entp->fmristr, sizeof (entp->fmristr));
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
159 entp->mark = 0;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
160 } else {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
161 if (thp == NULL)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
162 thp = fmd_hdl_topo_hold(hdl, TOPO_VERSION);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
163
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
164 if (topo_fmri_str2nvl(thp, entp->fmristr, &svcfmri,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
165 &err) != 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
166 fmd_hdl_error(hdl, "str2nvl failed for %s\n",
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
167 entp->fmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
168 continue;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
169 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
170
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
171 if (fmd_nvl_fmri_service_state(hdl, svcfmri) !=
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
172 FMD_SERVICE_STATE_UNUSABLE) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
173 svcname = sw_smf_svcfmri2shortstr(hdl, svcfmri);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
174 (void) fmd_repair_asru(hdl, entp->fmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
175 fmd_hdl_strfree(hdl, svcname);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
176 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
177
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
178 nvlist_free(svcfmri);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
179 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
180 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
181
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
182 if (thp)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
183 fmd_hdl_topo_rele(hdl, thp);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
184
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
185 uuid_cache_persist(hdl);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
186 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
187
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
188 static void
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
189 uuid_cache_restore(fmd_hdl_t *hdl)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
190 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
191 size_t sz = fmd_buf_size(hdl, NULL, UUID_CACHE_BUFNAME);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
192
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
193 if (sz == 0)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
194 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
195
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
196 uuid_cache = fmd_hdl_alloc(hdl, sz, FMD_SLEEP);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
197 fmd_buf_read(hdl, NULL, UUID_CACHE_BUFNAME, uuid_cache, sz);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
198
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
199 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
200 * Garbage collect now, not just for tidiness but also to help
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
201 * fmd and smf state stay in sync at module startup.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
202 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
203 uuid_cache_gc(hdl);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
204 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
205
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
206 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
207 * Add the UUID of an SMF maintenance defect case to our cache and
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
208 * record the associated full svc FMRI string for the case.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
209 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
210 static void
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
211 swrp_smf_cache_add(fmd_hdl_t *hdl, char *uuid, char *fmristr)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
212 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
213 struct smf_uuid_cache_ent *entp = NULL;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
214 int gced = 0;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
215 int i;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
216
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
217 if (uuid_cache == NULL)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
218 uuid_cache_grow(hdl);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
219
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
220 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
221 * If we somehow already have an entry for this uuid then
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
222 * return leaving it undisturbed.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
223 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
224 for (i = 0; i < uuid_cache->nentries; i++) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
225 if (strcmp(uuid, uuid_cache->entry[i].uuid) == 0)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
226 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
227 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
228
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
229 scan:
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
230 for (i = 0; i < uuid_cache->nentries; i++) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
231 if (uuid_cache->entry[i].uuid[0] == '\0') {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
232 entp = &uuid_cache->entry[i];
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
233 break;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
234 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
235 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
236
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
237 if (entp == NULL) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
238 uint32_t oldn = uuid_cache->nentries;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
239
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
240 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
241 * Before growing the cache we try again after first
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
242 * garbage-collecting the existing cache for any cases
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
243 * that are confirmed as resolved.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
244 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
245 if (!gced) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
246 uuid_cache_gc(hdl);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
247 gced = 1;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
248 goto scan;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
249 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
250
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
251 if (oldn < CACHE_NENT_MAX) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
252 uuid_cache_grow(hdl);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
253 entp = &uuid_cache->entry[oldn];
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
254 } else {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
255 BUMPSTAT(swrp_smf_cachefull);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
256 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
257 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
258 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
259
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
260 (void) strncpy(entp->uuid, uuid, sizeof (entp->uuid));
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
261 (void) strncpy(entp->fmristr, fmristr, sizeof (entp->fmristr));
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
262 uuid_cache_persist(hdl);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
263 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
264
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
265 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
266 * Mark cache entry/entries as resolved - if they match in either uuid
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
267 * (if not NULL) or fmristr (if not NULL) mark as resolved. Return 1 iff
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
268 * an entry that matched on uuid was already marked, otherwise (entry
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
269 * matched on either, matched on uuid but not marked, not found).
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
270 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
271 static int
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
272 swrp_smf_cache_mark(fmd_hdl_t *hdl, char *uuid, char *fmristr)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
273 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
274 int dirty = 0;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
275 int rv = 0;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
276 int i;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
277
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
278 if (uuid_cache == NULL)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
279 return (0);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
280
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
281 for (i = 0; i < uuid_cache->nentries; i++) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
282 struct smf_uuid_cache_ent *entp = &uuid_cache->entry[i];
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
283
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
284 if (entp->uuid[0] == '\0')
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
285 continue;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
286
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
287 if (uuid && strcmp(uuid, entp->uuid) == 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
288 if (entp->mark)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
289 rv = 1;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
290 entp->mark = 1;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
291 dirty++;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
292 } else if (fmristr && strcmp(fmristr, entp->fmristr) == 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
293 entp->mark = 1;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
294 dirty++;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
295 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
296 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
297
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
298 if (dirty)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
299 uuid_cache_persist(hdl);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
300
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
301 return (rv);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
302 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
303
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
304 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
305 * We will receive list events for cases we are not interested in. Test
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
306 * that this list has exactly one suspect and that it matches the maintenance
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
307 * defect. Return the defect to the caller in the second argument,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
308 * and the defect resource element in the third arg.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
309 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
310 static int
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
311 suspect_is_maint_defect(fmd_hdl_t *hdl, nvlist_t *nvl,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
312 nvlist_t **defectnvl, nvlist_t **rsrcnvl)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
313 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
314 nvlist_t **faults;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
315 uint_t nfaults;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
316
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
317 if (nvlist_lookup_nvlist_array(nvl, FM_SUSPECT_FAULT_LIST,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
318 &faults, &nfaults) != 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
319 BUMPSTAT(swrp_smf_badlist);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
320 return (0);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
321 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
322
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
323 if (nfaults != 1 ||
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
324 !fmd_nvl_class_match(hdl, faults[0], SW_SMF_MAINT_DEFECT))
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
325 return (0);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
326
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
327 if (nvlist_lookup_nvlist(faults[0], FM_FAULT_RESOURCE, rsrcnvl) != 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
328 BUMPSTAT(swrp_smf_badlist);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
329 return (0);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
330 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
331
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
332 *defectnvl = faults[0];
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
333
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
334 return (1);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
335 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
336
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
337 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
338 * Received newly-diagnosed list.suspect events that are for the
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
339 * maintenane defect we diagnose. Close the case (the resource was already
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
340 * isolated by SMF) after cachng the case UUID.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
341 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
342 /*ARGSUSED*/
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
343 static void
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
344 swrp_smf_cacheuuid(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
345 const char *class, void *arg)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
346 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
347 nvlist_t *defect, *rsrc;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
348 char *fmristr, *uuid;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
349
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
350 if (nvlist_lookup_string(nvl, FM_SUSPECT_UUID, &uuid) != 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
351 BUMPSTAT(swrp_smf_badlist);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
352 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
353 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
354
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
355 if (!suspect_is_maint_defect(hdl, nvl, &defect, &rsrc))
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
356 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
357
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
358 if ((fmristr = sw_smf_svcfmri2str(hdl, rsrc)) == NULL) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
359 BUMPSTAT(swrp_smf_badlist);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
360 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
361 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
362
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
363 swrp_smf_cache_add(hdl, uuid, fmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
364 fmd_hdl_strfree(hdl, fmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
365
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
366 if (!fmd_case_uuclosed(hdl, uuid)) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
367 fmd_case_uuclose(hdl, uuid);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
368 BUMPSTAT(swrp_smf_closed);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
369 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
370 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
371
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
372 /*ARGSUSED*/
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
373 static void
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
374 swrp_smf2fmd(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
375 const char *class, void *arg)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
376 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
377 nvlist_t *attr, *fmri;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
378 char *fromstate;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
379 char *fmristr;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
380
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
381 if (!fmd_nvl_class_match(hdl, nvl, TRANCLASS("*"))) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
382 BUMPSTAT(swrp_smf_wrongclass);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
383 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
384 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
385
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
386 if (nvlist_lookup_nvlist(nvl, FM_IREPORT_ATTRIBUTES, &attr) != 0 ||
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
387 nvlist_lookup_string(attr, "from-state", &fromstate) != 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
388 BUMPSTAT(swrp_smf_badclrevent);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
389 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
390 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
391
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
392 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
393 * Filter those not describing a transition out of maintenance.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
394 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
395 if (strcmp(fromstate, "maintenance") != 0)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
396 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
397
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
398 if (nvlist_lookup_nvlist(attr, "svc", &fmri) != 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
399 BUMPSTAT(swrp_smf_badclrevent);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
400 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
401 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
402
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
403 if ((fmristr = sw_smf_svcfmri2str(hdl, fmri)) == NULL) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
404 BUMPSTAT(swrp_smf_badclrevent);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
405 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
406 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
407
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
408 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
409 * Mark any UUID for a case against this service as resolved
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
410 * in our cache. When we fmd_repair_asru below fmd will emit
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
411 * a list.repaired as a result, and our handling of that event
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
412 * must not propogate the repair towards SMF (since the repair
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
413 * was initiated via SMF itself and not via fmadm).
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
414 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
415 (void) swrp_smf_cache_mark(hdl, NULL, fmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
416
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
417 (void) fmd_repair_asru(hdl, fmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
418 fmd_hdl_strfree(hdl, fmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
419 BUMPSTAT(swrp_smf_clears);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
420 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
421
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
422 /*ARGSUSED*/
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
423 static void
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
424 swrp_fmd2smf(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
425 const char *class, void *arg)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
426 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
427 char *fmristr, *shrtfmristr;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
428 nvlist_t *defect, *rsrc;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
429 char *uuid;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
430 int already;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
431
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
432 if (strcmp(class, FM_LIST_REPAIRED_CLASS) != 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
433 BUMPSTAT(swrp_smf_wrongclass);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
434 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
435 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
436
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
437 if (nvlist_lookup_string(nvl, FM_SUSPECT_UUID, &uuid) != 0) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
438 BUMPSTAT(swrp_smf_badlist);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
439 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
440 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
441
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
442 if (!suspect_is_maint_defect(hdl, nvl, &defect, &rsrc))
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
443 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
444
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
445 if ((fmristr = sw_smf_svcfmri2str(hdl, rsrc)) == NULL) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
446 BUMPSTAT(swrp_smf_badresource);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
447 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
448 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
449
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
450 already = swrp_smf_cache_mark(hdl, uuid, fmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
451 fmd_hdl_strfree(hdl, fmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
452
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
453 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
454 * If the cache already had a marked entry for this UUID then
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
455 * this is a list.repaired arising from a SMF-initiated maintenance
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
456 * clear (propogated with fmd_repair_asru above which then results
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
457 * in a list.repaired) and so we should not propogate the repair
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
458 * back towards SMF. But do still force the case to RESOLVED state in
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
459 * case fmd is unable to confirm the service no longer in maintenance
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
460 * state (it may have failed again) so that a new case can be opened.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
461 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
462 fmd_case_uuresolved(hdl, uuid);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
463 if (already) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
464 BUMPSTAT(swrp_smf_noloop);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
465 return;
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
466 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
467
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
468 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
469 * Only propogate to SMF if we can see that service still
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
470 * in maintenance state. We're not synchronized with SMF
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
471 * and this state could change at any time, but if we can
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
472 * see it's not in maintenance state then things are obviously
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
473 * moving (e.g., external svcadm active) so we don't poke
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
474 * at SMF otherwise we confuse things or duplicate operations.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
475 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
476
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
477 if (fmd_nvl_fmri_service_state(hdl, rsrc) ==
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
478 FMD_SERVICE_STATE_UNUSABLE) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
479 shrtfmristr = sw_smf_svcfmri2shortstr(hdl, rsrc);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
480
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
481 if (shrtfmristr != NULL) {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
482 (void) smf_restore_instance(shrtfmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
483 fmd_hdl_strfree(hdl, shrtfmristr);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
484 BUMPSTAT(swrp_smf_repairs);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
485 } else {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
486 BUMPSTAT(swrp_smf_badresource);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
487 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
488 } else {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
489 BUMPSTAT(swrp_smf_suppressed);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
490 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
491 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
492
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
493 const struct sw_disp swrp_smf_disp[] = {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
494 { TRANCLASS("*"), swrp_smf2fmd, NULL },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
495 { FM_LIST_SUSPECT_CLASS, swrp_smf_cacheuuid, NULL },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
496 { FM_LIST_REPAIRED_CLASS, swrp_fmd2smf, NULL },
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
497 { NULL, NULL, NULL }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
498 };
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
499
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
500 /*ARGSUSED*/
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
501 int
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
502 swrp_smf_init(fmd_hdl_t *hdl, id_t id, const struct sw_disp **dpp, int *nelemp)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
503 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
504 (void) fmd_stat_create(hdl, FMD_STAT_NOALLOC, sizeof (swrp_smf_stats) /
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
505 sizeof (fmd_stat_t), (fmd_stat_t *)&swrp_smf_stats);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
506
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
507 uuid_cache_restore(hdl);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
508
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
509 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
510 * We need to subscribe to all SMF transition class events because
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
511 * we need to look inside the payload to see which events indicate
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
512 * a transition out of maintenance state.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
513 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
514 fmd_hdl_subscribe(hdl, TRANCLASS("*"));
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
515
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
516 /*
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
517 * Subscribe to the defect class diagnosed for maintenance events.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
518 * The module will then receive list.suspect events including
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
519 * these defects, and in our dispatch table above we list routing
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
520 * for list.suspect.
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
521 */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
522 fmd_hdl_subscribe(hdl, SW_SMF_MAINT_DEFECT);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
523
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
524 *dpp = &swrp_smf_disp[0];
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
525 *nelemp = sizeof (swrp_smf_disp) / sizeof (swrp_smf_disp[0]);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
526 return (SW_SUB_INIT_SUCCESS);
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
527 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
528
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
529 /*ARGSUSED*/
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
530 void
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
531 swrp_smf_fini(fmd_hdl_t *hdl)
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
532 {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
533 }
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
534
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
535 const struct sw_subinfo smf_response_info = {
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
536 "smf repair", /* swsub_name */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
537 SW_CASE_NONE, /* swsub_casetype */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
538 swrp_smf_init, /* swsub_init */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
539 swrp_smf_fini, /* swsub_fini */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
540 NULL, /* swsub_timeout */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
541 NULL, /* swsub_case_close */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
542 NULL, /* swsub_case_vrfy */
ab9ae749152f PSARC/2009/617 Software Events Notification Parameters CLI
Gavin Maltby <gavin.maltby@oracle.com>
parents:
diff changeset
543 };