diff options
author | Alex Wilson <alex@uq.edu.au> | 2020-01-09 04:19:24 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@fingolfin.org> | 2020-03-04 02:46:53 +0000 |
commit | da40b2648878aa9434c7199422846fe5a7032714 (patch) | |
tree | 3994ce8bafa2ee04fcc03b095d286135854d15c2 | |
parent | 12eb87fbfbcd9e0abde89898daa0a87c695807e4 (diff) | |
download | illumos-joyent-da40b2648878aa9434c7199422846fe5a7032714.tar.gz |
12203 FMA fault ASRUs missing FMRI annotations
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Reviewed by: Paul Winder <paul@winders.demon.co.uk>
Reviewed by: Rob Johnston <rob.johnston@joyent.com>
Approved by: Garrett D'Amore <garrett@damore.org>
-rw-r--r-- | usr/src/cmd/fm/modules/common/eversholt/eval.c | 6 | ||||
-rw-r--r-- | usr/src/cmd/fm/modules/common/eversholt/fme.c | 34 | ||||
-rw-r--r-- | usr/src/cmd/fm/modules/common/eversholt/platform.c | 28 | ||||
-rw-r--r-- | usr/src/cmd/fm/modules/common/eversholt/platform.h | 7 |
4 files changed, 45 insertions, 30 deletions
diff --git a/usr/src/cmd/fm/modules/common/eversholt/eval.c b/usr/src/cmd/fm/modules/common/eversholt/eval.c index a3c47f91dc..78ce797d28 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/eval.c +++ b/usr/src/cmd/fm/modules/common/eversholt/eval.c @@ -32,6 +32,7 @@ #include <stdlib.h> #include <ctype.h> #include <string.h> +#include <fm/libtopo.h> #include "alloc.h" #include "out.h" #include "stable.h" @@ -507,7 +508,7 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *events[], valuep->v = 1; return (1); } else if (funcname == L_has_fault) { - nvlist_t *asru = NULL, *fru = NULL, *rsrc = NULL; + nvlist_t *rsrc = NULL; nodep = eval_getname(funcnp, ex, events, np->u.expr.left, globals, croot, arrowp, try, &duped); @@ -519,7 +520,8 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *events[], } path = ipath2str(NULL, ipath(nodep)); - platform_units_translate(0, croot, &asru, &fru, &rsrc, path); + platform_unit_translate(0, croot, TOPO_PROP_RESOURCE, + &rsrc, path); outfl(O_ALTFP|O_VERB2|O_NONL, np->file, np->line, "has_fault("); ptree_name_iter(O_ALTFP|O_VERB2|O_NONL, nodep); out(O_ALTFP|O_VERB2|O_NONL, "(%s), \"%s\") ", path, diff --git a/usr/src/cmd/fm/modules/common/eversholt/fme.c b/usr/src/cmd/fm/modules/common/eversholt/fme.c index e153385551..0f7edab994 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/fme.c +++ b/usr/src/cmd/fm/modules/common/eversholt/fme.c @@ -38,6 +38,7 @@ #include <libnvpair.h> #include <sys/fm/protocol.h> #include <fm/fmd_api.h> +#include <fm/libtopo.h> #include "alloc.h" #include "out.h" #include "stats.h" @@ -340,7 +341,7 @@ newfme(const char *e0class, const struct ipath *e0ipp, fmd_hdl_t *hdl, ipathlastcomp(e0ipp); pathstr = ipath2str(NULL, e0ipp); cfgdata = config_snapshot(); - platform_units_translate(0, cfgdata->cooked, NULL, NULL, + platform_unit_translate(0, cfgdata->cooked, TOPO_PROP_RESOURCE, &detector, pathstr); FREE(pathstr); structconfig_free(cfgdata->cooked); @@ -392,7 +393,7 @@ newfme(const char *e0class, const struct ipath *e0ipp, fmd_hdl_t *hdl, nvlist_free(detector); pathstr = ipath2str(NULL, e0ipp); cfgdata = config_snapshot(); - platform_units_translate(0, cfgdata->cooked, NULL, NULL, + platform_unit_translate(0, cfgdata->cooked, TOPO_PROP_RESOURCE, &detector, pathstr); FREE(pathstr); platform_save_config(hdl, fmcase); @@ -2181,7 +2182,8 @@ void get_resources(struct event *sp, struct rsl *rsrcs, struct config *croot) { struct node *asrudef, *frudef; - nvlist_t *asru, *fru; + const struct ipath *asrupath, *frupath; + nvlist_t *asru = NULL, *fru = NULL; nvlist_t *rsrc = NULL; char *pathstr; @@ -2193,19 +2195,29 @@ get_resources(struct event *sp, struct rsl *rsrcs, struct config *croot) frudef = eventprop_lookup(sp, L_FRU); /* - * Create FMRIs based on those definitions + * Create ipaths based on those definitions */ - asru = node2fmri(asrudef); - fru = node2fmri(frudef); - pathstr = ipath2str(NULL, sp->ipp); + asrupath = ipath(asrudef); + frupath = ipath(frudef); /* * Allow for platform translations of the FMRIs */ - platform_units_translate(is_defect(sp->t), croot, &asru, &fru, &rsrc, - pathstr); + pathstr = ipath2str(NULL, sp->ipp); + platform_unit_translate(is_defect(sp->t), croot, TOPO_PROP_RESOURCE, + &rsrc, pathstr); + FREE(pathstr); + pathstr = ipath2str(NULL, asrupath); + platform_unit_translate(is_defect(sp->t), croot, TOPO_PROP_ASRU, + &asru, pathstr); FREE(pathstr); + + pathstr = ipath2str(NULL, frupath); + platform_unit_translate(is_defect(sp->t), croot, TOPO_PROP_FRU, + &fru, pathstr); + FREE(pathstr); + rsrcs->suspect = sp; rsrcs->asru = asru; rsrcs->fru = fru; @@ -3115,8 +3127,8 @@ fme_undiagnosable(struct fme *f) fmd_case_add_ereport(f->hdl, f->fmcase, ep->ffep); pathstr = ipath2str(NULL, ipath(platform_getpath(ep->nvp))); - platform_units_translate(0, f->config, NULL, NULL, &detector, - pathstr); + platform_unit_translate(0, f->config, TOPO_PROP_RESOURCE, + &detector, pathstr); FREE(pathstr); /* add defect */ diff --git a/usr/src/cmd/fm/modules/common/eversholt/platform.c b/usr/src/cmd/fm/modules/common/eversholt/platform.c index 1fe49bd9b4..a3972400e4 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/platform.c +++ b/usr/src/cmd/fm/modules/common/eversholt/platform.c @@ -767,7 +767,7 @@ platform_config_snapshot(void) } static const char * -cfgstrprop_lookup(struct config *croot, char *path, char *pname) +cfgstrprop_lookup(struct config *croot, char *path, const char *pname) { struct config *cresource; const char *fmristr; @@ -790,43 +790,45 @@ cfgstrprop_lookup(struct config *croot, char *path, char *pname) } /* - * Get resource FMRI from libtopo + * Get FMRI for a particular unit from libtopo. The unit is specified by the + * "path" argument (a stringified ipath). "prop" argument should be one + * of the constants TOPO_PROP_RESOURCE, TOPO_PROP_ASRU, TOPO_PROP_FRU, etc. */ /*ARGSUSED*/ void -platform_units_translate(int isdefect, struct config *croot, - nvlist_t **dfltasru, nvlist_t **dfltfru, nvlist_t **dfltrsrc, char *path) +platform_unit_translate(int isdefect, struct config *croot, const char *prop, + nvlist_t **fmrip, char *path) { const char *fmristr; char *serial; - nvlist_t *rsrc; + nvlist_t *fmri; int err; - fmristr = cfgstrprop_lookup(croot, path, TOPO_PROP_RESOURCE); + fmristr = cfgstrprop_lookup(croot, path, prop); if (fmristr == NULL) { - out(O_ALTFP, "Cannot rewrite resource for %s.", path); + out(O_ALTFP, "Cannot rewrite unit FMRI for %s.", path); return; } - if (topo_fmri_str2nvl(Eft_topo_hdl, fmristr, &rsrc, &err) < 0) { + if (topo_fmri_str2nvl(Eft_topo_hdl, fmristr, &fmri, &err) < 0) { out(O_ALTFP, "Can not convert config info: %s", topo_strerror(err)); - out(O_ALTFP, "Cannot rewrite resource for %s.", path); + out(O_ALTFP, "Cannot rewrite unit FMRI for %s.", path); return; } /* - * If we don't have a serial number in the resource then check if it + * If we don't have a serial number in the unit then check if it * is available as a separate property and if so then add it. */ - if (nvlist_lookup_string(rsrc, FM_FMRI_HC_SERIAL_ID, &serial) != 0) { + if (nvlist_lookup_string(fmri, FM_FMRI_HC_SERIAL_ID, &serial) != 0) { serial = (char *)cfgstrprop_lookup(croot, path, FM_FMRI_HC_SERIAL_ID); if (serial != NULL) - (void) nvlist_add_string(rsrc, FM_FMRI_HC_SERIAL_ID, + (void) nvlist_add_string(fmri, FM_FMRI_HC_SERIAL_ID, serial); } - *dfltrsrc = rsrc; + *fmrip = fmri; } /* diff --git a/usr/src/cmd/fm/modules/common/eversholt/platform.h b/usr/src/cmd/fm/modules/common/eversholt/platform.h index 30cab516ed..23e1f6f41e 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/platform.h +++ b/usr/src/cmd/fm/modules/common/eversholt/platform.h @@ -28,8 +28,6 @@ #ifndef _EFT_PLATFORM_H #define _EFT_PLATFORM_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <libnvpair.h> #ifdef __cplusplus @@ -38,6 +36,7 @@ extern "C" { #include <config.h> #include <fm/fmd_api.h> +#include <fm/libtopo.h> nvlist_t *Action_nvl; /* nvl for problem with action=... prop on it */ @@ -45,8 +44,8 @@ void platform_init(void); void platform_fini(void); void platform_run_poller(const char *poller); void platform_set_payloadnvp(nvlist_t *nvlp); -void platform_units_translate(int, struct config *, nvlist_t **, nvlist_t **, - nvlist_t **, char *); +void platform_unit_translate(int, struct config *, const char *, nvlist_t **, + char *); struct cfgdata *platform_config_snapshot(void); void platform_restore_config(fmd_hdl_t *hdl, fmd_case_t *fmcase); |