diff options
author | Joshua M. Clulow <jmc@joyent.com> | 2013-08-08 15:44:15 -0700 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2013-09-28 15:43:17 -0700 |
commit | 1410cb930a3e26032c59c6835837a28c47366b3c (patch) | |
tree | 3a741c2c6298d1fd821b79a682de88e1b3a53c88 /usr/src | |
parent | 6ed0a5cff079e25f4aa15cef67c6dd48ee60b018 (diff) | |
download | illumos-joyent-1410cb930a3e26032c59c6835837a28c47366b3c.tar.gz |
4016 disk-monitor should activate fault/fail indicators
4017 fmtopo -P flag does not appear to set properties
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Approved by: Albert Lee <trisk@nexenta.com>
Diffstat (limited to 'usr/src')
16 files changed, 867 insertions, 35 deletions
diff --git a/usr/src/cmd/fm/fmtopo/common/fmtopo.c b/usr/src/cmd/fm/fmtopo/common/fmtopo.c index b2e26c596f..0de419e2b1 100644 --- a/usr/src/cmd/fm/fmtopo/common/fmtopo.c +++ b/usr/src/cmd/fm/fmtopo/common/fmtopo.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -597,30 +598,29 @@ set_prop(topo_hdl_t *thp, tnode_t *node, nvlist_t *fmri, struct prop_args *pp) { int ret, err = 0; topo_type_t type; - nvlist_t *nvl, *f = NULL; + nvlist_t *nvl = NULL; char *end; if (pp->prop == NULL || pp->type == NULL || pp->value == NULL) - return; + goto out; if ((type = str2type(pp->type)) == TOPO_TYPE_INVALID) { (void) fprintf(stderr, "%s: invalid property type %s for %s\n", g_pname, pp->type, pp->prop); - return; + goto out; } if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0) { (void) fprintf(stderr, "%s: nvlist allocation failed for " "%s=%s:%s\n", g_pname, pp->prop, pp->type, pp->value); - return; + goto out; } ret = nvlist_add_string(nvl, TOPO_PROP_VAL_NAME, pp->prop); ret |= nvlist_add_uint32(nvl, TOPO_PROP_VAL_TYPE, type); if (ret != 0) { (void) fprintf(stderr, "%s: invalid property type %s for %s\n", g_pname, pp->type, pp->prop); - nvlist_free(nvl); - return; + goto out; } errno = 0; @@ -681,13 +681,17 @@ set_prop(topo_hdl_t *thp, tnode_t *node, nvlist_t *fmri, struct prop_args *pp) } case TOPO_TYPE_FMRI: { - if ((ret = topo_fmri_str2nvl(thp, pp->value, &f, &err)) - < 0) + nvlist_t *val = NULL; + + if ((ret = topo_fmri_str2nvl(thp, pp->value, &val, + &err)) < 0) break; if ((ret = nvlist_add_nvlist(nvl, TOPO_PROP_VAL_VAL, - f)) != 0) + val)) != 0) err = ETOPO_PROP_NVL; + + nvlist_free(val); break; } default: @@ -697,60 +701,54 @@ set_prop(topo_hdl_t *thp, tnode_t *node, nvlist_t *fmri, struct prop_args *pp) if (ret != 0) { (void) fprintf(stderr, "%s: unable to set property value for " "%s: %s\n", g_pname, pp->prop, topo_strerror(err)); - nvlist_free(nvl); - return; + goto out; } if (node != NULL) { - if (topo_prop_setprop(node, pp->group, nvl, TOPO_PROP_MUTABLE, - f, &ret) < 0) { + if ((ret = topo_prop_setprop(node, pp->group, nvl, + TOPO_PROP_MUTABLE, nvl, &err)) < 0) { (void) fprintf(stderr, "%s: unable to set property " "value for " "%s=%s:%s: %s\n", g_pname, pp->prop, - pp->type, pp->value, topo_strerror(ret)); - nvlist_free(nvl); - nvlist_free(f); - return; + pp->type, pp->value, topo_strerror(err)); + goto out; } } else { - if (topo_fmri_setprop(thp, fmri, pp->group, nvl, - TOPO_PROP_MUTABLE, f, &ret) < 0) { + if ((ret = topo_fmri_setprop(thp, fmri, pp->group, nvl, + TOPO_PROP_MUTABLE, nvl, &err)) < 0) { (void) fprintf(stderr, "%s: unable to set property " "value for " "%s=%s:%s: %s\n", g_pname, pp->prop, - pp->type, pp->value, topo_strerror(ret)); - nvlist_free(nvl); - nvlist_free(f); - return; + pp->type, pp->value, topo_strerror(err)); + goto out; } } nvlist_free(nvl); + nvl = NULL; /* * Now, get the property back for printing */ if (node != NULL) { - if (topo_prop_getprop(node, pp->group, pp->prop, f, &nvl, - &err) < 0) { + if ((ret = topo_prop_getprop(node, pp->group, pp->prop, NULL, + &nvl, &err)) < 0) { (void) fprintf(stderr, "%s: failed to get %s.%s: %s\n", g_pname, pp->group, pp->prop, topo_strerror(err)); - nvlist_free(f); - return; + goto out; } } else { - if (topo_fmri_getprop(thp, fmri, pp->group, pp->prop, - f, &nvl, &err) < 0) { + if ((ret = topo_fmri_getprop(thp, fmri, pp->group, pp->prop, + NULL, &nvl, &err)) < 0) { (void) fprintf(stderr, "%s: failed to get %s.%s: %s\n", g_pname, pp->group, pp->prop, topo_strerror(err)); - nvlist_free(f); - return; + goto out; } } print_pgroup(thp, node, pp->group, NULL, NULL, 0); print_prop_nameval(thp, node, nvl); - nvlist_free(nvl); - nvlist_free(f); +out: + nvlist_free(nvl); } static void diff --git a/usr/src/cmd/fm/modules/common/Makefile b/usr/src/cmd/fm/modules/common/Makefile index 27c00d9b08..2d92330f4f 100644 --- a/usr/src/cmd/fm/modules/common/Makefile +++ b/usr/src/cmd/fm/modules/common/Makefile @@ -23,6 +23,7 @@ # SUBDIRS = cpumem-retire \ + disk-lights \ disk-monitor \ disk-transport \ eversholt \ diff --git a/usr/src/cmd/fm/modules/common/disk-lights/Makefile b/usr/src/cmd/fm/modules/common/disk-lights/Makefile new file mode 100644 index 0000000000..bae6e76362 --- /dev/null +++ b/usr/src/cmd/fm/modules/common/disk-lights/Makefile @@ -0,0 +1,24 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013, Joyent, Inc. All rights reserved. +# + +MODULE = disk-lights +CLASS = common +SRCS = disk_lights.c + +include ../../Makefile.plugin + +LINTFLAGS += -L$(ROOT)/usr/lib/fm +LDLIBS += -ltopo +LDFLAGS += -L$(ROOT)/usr/lib/fm -R/usr/lib/fm diff --git a/usr/src/cmd/fm/modules/common/disk-lights/disk-lights.conf b/usr/src/cmd/fm/modules/common/disk-lights/disk-lights.conf new file mode 100644 index 0000000000..c0701dde08 --- /dev/null +++ b/usr/src/cmd/fm/modules/common/disk-lights/disk-lights.conf @@ -0,0 +1,17 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013, Joyent, Inc. All rights reserved. +# + +subscribe fault.io.disk.* +subscribe fault.io.scsi.* diff --git a/usr/src/cmd/fm/modules/common/disk-lights/disk_lights.c b/usr/src/cmd/fm/modules/common/disk-lights/disk_lights.c new file mode 100644 index 0000000000..636b5a96ce --- /dev/null +++ b/usr/src/cmd/fm/modules/common/disk-lights/disk_lights.c @@ -0,0 +1,328 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ + +/* + * Disk Lights Agent (FMA) + * + * This Fault Management Daemon (fmd) module periodically scans the topology + * tree, enumerates all disks with associated fault indicators, and then + * synchronises the fault status of resources in the FMA Resource Cache with + * the indicators. In short: it turns the fault light on for befallen disks. + * + * Presently, we recognise associated fault indicators for disks by looking + * for the following structure in the topology tree: + * + * /bay=N + * | + * +---- /disk=0 <---------------- our Disk + * | + * +---- /bay=N?indicator=fail <---- the Fault Light + * \---- /bay=N?indicator=ident + * + * That is: a DISK node will have a parent BAY; that BAY will itself have + * child Facility nodes, one of which will be called "fail". If any of the + * above does not hold, we simply do nothing for this disk. + */ + +#include <string.h> +#include <strings.h> +#include <libnvpair.h> +#include <fm/libtopo.h> +#include <fm/topo_list.h> +#include <fm/topo_hc.h> +#include <fm/fmd_api.h> +#include <sys/fm/protocol.h> + + +typedef struct disk_lights { + fmd_hdl_t *dl_fmd; + uint64_t dl_poll_interval; + uint64_t dl_coalesce_interval; + id_t dl_timer; + boolean_t dl_triggered; +} disk_lights_t; + +static void disklights_topo(fmd_hdl_t *, topo_hdl_t *); +static void disklights_recv(fmd_hdl_t *, fmd_event_t *, nvlist_t *, + const char *); +static void disklights_timeout(fmd_hdl_t *, id_t, void *); + +static const fmd_hdl_ops_t fmd_ops = { + disklights_recv, /* fmdo_recv */ + disklights_timeout, /* fmdo_timeout */ + NULL, /* fmdo_close */ + NULL, /* fmdo_stats */ + NULL, /* fmdo_gc */ + NULL, /* fmdo_send */ + disklights_topo, /* fmdo_topo */ +}; + +/* + * POLL_INTERVAL is the period after which we perform an unsolicited poll + * to ensure we remain in sync with reality. + */ +#define DL_PROP_POLL_INTERVAL "poll-interval" + +/* + * COALESCE_INTERVAL is how long we wait after we are trigged by either a + * topology change or a relevant list.* event, in order to allow a series + * of events to coalesce. + */ +#define DL_PROP_COALESCE_INTERVAL "coalesce-interval" + +static const fmd_prop_t fmd_props[] = { + { DL_PROP_POLL_INTERVAL, FMD_TYPE_TIME, "5min" }, + { DL_PROP_COALESCE_INTERVAL, FMD_TYPE_TIME, "3s" }, + { NULL, 0, NULL } +}; + +static const fmd_hdl_info_t fmd_info = { + "Disk Lights Agent", + "1.0", + &fmd_ops, + fmd_props +}; + +/* + * Fetch the Facility Node properties (name, type) from the FMRI + * for this node, or return -1 if we can't. + */ +static int +get_facility_props(topo_hdl_t *hdl, tnode_t *node, char **facname, + char **factype) +{ + int e, ret = -1; + nvlist_t *fmri = NULL, *fnvl; + char *nn = NULL, *tt = NULL; + + if (topo_node_resource(node, &fmri, &e) != 0) + goto out; + + if (nvlist_lookup_nvlist(fmri, FM_FMRI_FACILITY, &fnvl) != 0) + goto out; + + if (nvlist_lookup_string(fnvl, FM_FMRI_FACILITY_NAME, &nn) != 0) + goto out; + + if (nvlist_lookup_string(fnvl, FM_FMRI_FACILITY_TYPE, &tt) != 0) + goto out; + + *facname = topo_hdl_strdup(hdl, nn); + *factype = topo_hdl_strdup(hdl, tt); + ret = 0; + +out: + nvlist_free(fmri); + return (ret); +} + +typedef struct dl_fault_walk_inner { + char *fwi_name; + uint32_t fwi_mode; +} dl_fault_walk_inner_t; + +static int +dl_fault_walk_inner(topo_hdl_t *thp, tnode_t *node, void *arg) +{ + dl_fault_walk_inner_t *fwi = arg; + char *facname = NULL, *factype = NULL; + int err; + + /* + * We're only interested in BAY children that are valid Facility Nodes. + */ + if (topo_node_flags(node) != TOPO_NODE_FACILITY || + get_facility_props(thp, node, &facname, &factype) != 0) { + goto out; + } + + if (strcmp(fwi->fwi_name, facname) != 0) + goto out; + + /* + * Attempt to set the LED mode appropriately. If this fails, give up + * and move on. + */ + (void) topo_prop_set_uint32(node, TOPO_PGROUP_FACILITY, TOPO_LED_MODE, + TOPO_PROP_MUTABLE, fwi->fwi_mode, &err); + +out: + topo_hdl_strfree(thp, facname); + topo_hdl_strfree(thp, factype); + return (TOPO_WALK_NEXT); +} + +static int +dl_fault_walk_outer(topo_hdl_t *thp, tnode_t *node, void *arg) +{ + disk_lights_t *dl = arg; + dl_fault_walk_inner_t fwi; + tnode_t *pnode; + int err, has_fault; + nvlist_t *fmri = NULL; + + bzero(&fwi, sizeof (fwi)); + + /* + * We are only looking for DISK nodes in the topology that have a parent + * BAY. + */ + if (strcmp(DISK, topo_node_name(node)) != 0 || + (pnode = topo_node_parent(node)) == NULL || + strcmp(BAY, topo_node_name(pnode)) != 0) { + return (TOPO_WALK_NEXT); + } + + /* + * Check to see if the Resource this FMRI describes is Faulty: + */ + if (topo_node_resource(node, &fmri, &err) != 0) + return (TOPO_WALK_NEXT); + has_fault = fmd_nvl_fmri_has_fault(dl->dl_fmd, fmri, + FMD_HAS_FAULT_RESOURCE, NULL); + nvlist_free(fmri); + + /* + * Walk the children of this BAY and flush out our fault status if + * we find an appropriate indicator node. + */ + fwi.fwi_name = "fail"; + fwi.fwi_mode = has_fault ? TOPO_LED_STATE_ON : TOPO_LED_STATE_OFF; + (void) topo_node_child_walk(thp, pnode, dl_fault_walk_inner, &fwi, + &err); + + return (TOPO_WALK_NEXT); +} + +/* + * Walk all of the topology nodes looking for DISKs that match the structure + * described in the overview. Once we find them, check their fault status + * and update their fault indiciator accordingly. + */ +static void +dl_examine_topo(disk_lights_t *dl) +{ + int err; + topo_hdl_t *thp = NULL; + topo_walk_t *twp = NULL; + + thp = fmd_hdl_topo_hold(dl->dl_fmd, TOPO_VERSION); + if ((twp = topo_walk_init(thp, FM_FMRI_SCHEME_HC, dl_fault_walk_outer, + dl, &err)) == NULL) { + fmd_hdl_error(dl->dl_fmd, "failed to get topology: %s\n", + topo_strerror(err)); + goto out; + } + + if (topo_walk_step(twp, TOPO_WALK_CHILD) == TOPO_WALK_ERR) { + fmd_hdl_error(dl->dl_fmd, "failed to walk topology: %s\n", + topo_strerror(err)); + goto out; + } + +out: + if (twp != NULL) + topo_walk_fini(twp); + if (thp != NULL) + fmd_hdl_topo_rele(dl->dl_fmd, thp); +} + +static void +dl_trigger_enum(disk_lights_t *dl) +{ + /* + * If we're already on the short-poll coalesce timer, then return + * immediately. + */ + if (dl->dl_triggered == B_TRUE) + return; + dl->dl_triggered = B_TRUE; + + /* + * Replace existing poll timer with coalesce timer: + */ + if (dl->dl_timer != 0) + fmd_timer_remove(dl->dl_fmd, dl->dl_timer); + dl->dl_timer = fmd_timer_install(dl->dl_fmd, NULL, NULL, + dl->dl_coalesce_interval); +} + +/*ARGSUSED*/ +static void +disklights_timeout(fmd_hdl_t *hdl, id_t id, void *data) +{ + disk_lights_t *dl = fmd_hdl_getspecific(hdl); + + dl->dl_triggered = B_FALSE; + + dl_examine_topo(dl); + + /* + * Install the long-interval timer for the next poll. + */ + dl->dl_timer = fmd_timer_install(hdl, NULL, NULL, dl->dl_poll_interval); +} + +/*ARGSUSED*/ +static void +disklights_topo(fmd_hdl_t *hdl, topo_hdl_t *thp) +{ + disk_lights_t *dl = fmd_hdl_getspecific(hdl); + + dl_trigger_enum(dl); +} + +/*ARGSUSED*/ +static void +disklights_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, + const char *class) +{ + disk_lights_t *dl = fmd_hdl_getspecific(hdl); + + dl_trigger_enum(dl); +} + +void +_fmd_init(fmd_hdl_t *hdl) +{ + disk_lights_t *dl; + + if (fmd_hdl_register(hdl, FMD_API_VERSION, &fmd_info) != 0) + return; + + dl = fmd_hdl_zalloc(hdl, sizeof (*dl), FMD_SLEEP); + fmd_hdl_setspecific(hdl, dl); + + /* + * Load Configuration: + */ + dl->dl_fmd = hdl; + dl->dl_poll_interval = fmd_prop_get_int64(hdl, DL_PROP_POLL_INTERVAL); + dl->dl_coalesce_interval = fmd_prop_get_int64(hdl, + DL_PROP_COALESCE_INTERVAL); + + /* + * Schedule the initial enumeration: + */ + dl_trigger_enum(dl); +} + +void +_fmd_fini(fmd_hdl_t *hdl) +{ + disk_lights_t *dl = fmd_hdl_getspecific(hdl); + + fmd_hdl_free(hdl, dl, sizeof (*dl)); +} diff --git a/usr/src/lib/fm/topo/libtopo/common/libtopo.h b/usr/src/lib/fm/topo/libtopo/common/libtopo.h index 9b7102f882..3ea35cdddd 100644 --- a/usr/src/lib/fm/topo/libtopo/common/libtopo.h +++ b/usr/src/lib/fm/topo/libtopo/common/libtopo.h @@ -137,6 +137,8 @@ extern boolean_t topo_method_supported(tnode_t *, const char *, topo_version_t); extern int topo_node_facility(topo_hdl_t *, tnode_t *, const char *, uint32_t, topo_faclist_t *, int *); +extern int topo_node_child_walk(topo_hdl_t *, tnode_t *, topo_walk_cb_t, + void *, int *); /* * Node flags: denotes type of node diff --git a/usr/src/lib/fm/topo/libtopo/common/mapfile-vers b/usr/src/lib/fm/topo/libtopo/common/mapfile-vers index 1cde0dee1f..b81f4fd7c6 100644 --- a/usr/src/lib/fm/topo/libtopo/common/mapfile-vers +++ b/usr/src/lib/fm/topo/libtopo/common/mapfile-vers @@ -126,6 +126,7 @@ SYMBOL_VERSION SUNWprivate { topo_node_asru; topo_node_asru_set; topo_node_bind; + topo_node_child_walk; topo_node_facility; topo_node_facbind; topo_node_flags; diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_node.c b/usr/src/lib/fm/topo/libtopo/common/topo_node.c index 553bc851f0..00b828c49c 100644 --- a/usr/src/lib/fm/topo/libtopo/common/topo_node.c +++ b/usr/src/lib/fm/topo/libtopo/common/topo_node.c @@ -837,3 +837,55 @@ topo_node_walk_init(topo_hdl_t *thp, topo_mod_t *mod, tnode_t *node, return (wp); } + +/* + * Walk the direct children of the given node. + */ +int +topo_node_child_walk(topo_hdl_t *thp, tnode_t *pnode, topo_walk_cb_t cb_f, + void *arg, int *errp) +{ + int ret = TOPO_WALK_TERMINATE; + tnode_t *cnode; + + topo_node_hold(pnode); + + /* + * First Child: + */ + topo_node_lock(pnode); + cnode = topo_child_first(pnode); + topo_node_unlock(pnode); + + if (cnode == NULL) { + *errp = ETOPO_WALK_EMPTY; + ret = TOPO_WALK_ERR; + goto out; + } + + while (cnode != NULL) { + int iret; + + /* + * Call the walker callback: + */ + topo_node_hold(cnode); + iret = cb_f(thp, cnode, arg); + topo_node_rele(cnode); + if (iret != TOPO_WALK_NEXT) { + ret = iret; + break; + } + + /* + * Next child: + */ + topo_node_lock(pnode); + cnode = topo_child_next(pnode, cnode); + topo_node_unlock(pnode); + } + +out: + topo_node_rele(pnode); + return (ret); +} diff --git a/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xml b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xml new file mode 100644 index 0000000000..8aaba3306a --- /dev/null +++ b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xml @@ -0,0 +1,246 @@ +<?xml version="1.0"?> +<!DOCTYPE topology SYSTEM "/usr/share/lib/xml/dtd/topology.dtd.1"> +<topology name='disk' scheme='hc'> + <range name='bay' min='0' max='15'> + <facility name='fail' type='indicator' provider='fac_prov_mptsas' > + <propgroup name='facility' version='1' name-stability='Private' + data-stability='Private' > + <propval name='type' type='uint32' value='0' /> + <propmethod name='mptsas_led_mode' version='0' propname='mode' + proptype='uint32' mutable='1'> + </propmethod> + </propgroup> + </facility> + <facility name='ident' type='indicator' provider='fac_prov_mptsas' > + <propgroup name='facility' version='1' name-stability='Private' + data-stability='Private' > + <propval name='type' type='uint32' value='1' /> + <propmethod name='mptsas_led_mode' version='0' propname='mode' + proptype='uint32' mutable='1'> + </propmethod> + </propgroup> + </facility> + <facility name='ok2rm' type='indicator' provider='fac_prov_mptsas' > + <propgroup name='facility' version='1' name-stability='Private' + data-stability='Private' > + <propval name='type' type='uint32' value='2' /> + <propmethod name='mptsas_led_mode' version='0' propname='mode' + proptype='uint32' mutable='1'> + </propmethod> + </propgroup> + </facility> + <node instance='0'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 0' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='0' /> + </propgroup> + </node> + <node instance='1'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 1' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='1' /> + </propgroup> + </node> + <node instance='2'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 2' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='2' /> + </propgroup> + </node> + <node instance='3'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 3' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='3' /> + </propgroup> + </node> + <node instance='4'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 4' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='4' /> + </propgroup> + </node> + <node instance='5'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 5' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='5' /> + </propgroup> + </node> + <node instance='6'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 6' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='6' /> + </propgroup> + </node> + <node instance='7'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 7' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='7' /> + </propgroup> + </node> + <node instance='8'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 8' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='0' /> + </propgroup> + </node> + <node instance='9'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 9' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='1' /> + </propgroup> + </node> + <node instance='10'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 10' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='2' /> + </propgroup> + </node> + <node instance='11'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 11' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='3' /> + </propgroup> + </node> + <node instance='12'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 12' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='4' /> + </propgroup> + </node> + <node instance='13'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 13' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='5' /> + </propgroup> + </node> + <node instance='14'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 14' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='6' /> + </propgroup> + </node> + <node instance='15'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='Front Disk 15' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl' /> + <propval name='enclosure' type='uint32' value='1' /> + <propval name='slot' type='uint32' value='7' /> + </propgroup> + </node> + <dependents grouping='children'> + <range name='disk' min='0' max='0'> + <enum-method name='disk' version='1' /> + </range> + </dependents> + </range> +</topology> diff --git a/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xmlgenksh b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xmlgenksh new file mode 100644 index 0000000000..000742db71 --- /dev/null +++ b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xmlgenksh @@ -0,0 +1,95 @@ +#!/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2013, Joyent, Inc. All rights reserved. +# + +function do_node +{ + cat <<EOF + <node instance='${1}'> + <propgroup name='protocol' version='1' name-stability='Private' + data-stability='Private'> + <propval name='label' type='string' value='${2}' /> + </propgroup> + <propgroup name='binding' version='1' name-stability='Private' + data-stability='Private'> + <propval name='driver' type='string' value='mpt_sas' /> + <propval name='devctl' type='string' value='${3}' /> + <propval name='enclosure' type='uint32' value='${4}' /> + <propval name='slot' type='uint32' value='${5}' /> + </propgroup> + </node> +EOF +} + + +cat <<EOF +<topology name='disk' scheme='hc'> + <range name='bay' min='0' max='15'> + <facility name='fail' type='indicator' provider='fac_prov_mptsas' > + <propgroup name='facility' version='1' name-stability='Private' + data-stability='Private' > + <propval name='type' type='uint32' value='0' /> + <propmethod name='mptsas_led_mode' version='0' propname='mode' + proptype='uint32' mutable='1'> + </propmethod> + </propgroup> + </facility> + <facility name='ident' type='indicator' provider='fac_prov_mptsas' > + <propgroup name='facility' version='1' name-stability='Private' + data-stability='Private' > + <propval name='type' type='uint32' value='1' /> + <propmethod name='mptsas_led_mode' version='0' propname='mode' + proptype='uint32' mutable='1'> + </propmethod> + </propgroup> + </facility> + <facility name='ok2rm' type='indicator' provider='fac_prov_mptsas' > + <propgroup name='facility' version='1' name-stability='Private' + data-stability='Private' > + <propval name='type' type='uint32' value='2' /> + <propmethod name='mptsas_led_mode' version='0' propname='mode' + proptype='uint32' mutable='1'> + </propmethod> + </propgroup> + </facility> +EOF + +enclosure=1 +bay=0 +slot=0 +devctl='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl' +while (( slot <= 7 )); do + do_node $bay "Front Disk $bay" "$devctl" $enclosure $slot + (( bay = bay + 1 )) + (( slot = slot + 1 )) +done + +slot=0 +devctl='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl' +while (( slot <= 7 )); do + do_node $bay "Front Disk $bay" "$devctl" $enclosure $slot + (( bay = bay + 1 )) + (( slot = slot + 1 )) +done + +cat <<EOF + <dependents grouping='children'> + <range name='disk' min='0' max='0'> + <enum-method name='disk' version='1' /> + </range> + </dependents> + </range> +</topology> +EOF diff --git a/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Makefile b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Makefile new file mode 100644 index 0000000000..072ea71be7 --- /dev/null +++ b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Makefile @@ -0,0 +1,41 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# Copyright (c) 2013, Joyent, Inc. All rights reserved. +# + +# NOTE: The name of the xml file we are building is 'platform' +# specific, but its build is structured as 'arch' specific since +# 'uname -i' on all x86 platforms returns i86pc. + +ARCH = i86pc +CLASS = arch +DTDFILE = topology.dtd.1 +TOPOFILE = Joyent-Compute-Platform-1101-disk-hc-topology.xml +SRCDIR = ../Joyent,Joyent-Compute-Platform-1101 + +PLATFORM = Joyent-Compute-Platform-1101 +TOPOBASE = ../i86pc/i86pc-hc-topology.xml + +include ../Makefile.map diff --git a/usr/src/lib/fm/topo/maps/Makefile b/usr/src/lib/fm/topo/maps/Makefile index de6d9f5e0f..a01b016ebe 100644 --- a/usr/src/lib/fm/topo/maps/Makefile +++ b/usr/src/lib/fm/topo/maps/Makefile @@ -48,7 +48,8 @@ i386_SUBDIRS = i86pc \ SUNW,Netra-X4200-M2 \ SUNW,Sun-Fire-X4500 \ SUNW,Sun-Fire-X4540 \ - SUNW,Sun-Fire-X4600-M2 + SUNW,Sun-Fire-X4600-M2 \ + Joyent,Joyent-Compute-Platform-1101 SUBDIRS = $($(MACH)_SUBDIRS) diff --git a/usr/src/lib/fm/topo/maps/Makefile.map b/usr/src/lib/fm/topo/maps/Makefile.map index adfff59002..8c1c33cca2 100644 --- a/usr/src/lib/fm/topo/maps/Makefile.map +++ b/usr/src/lib/fm/topo/maps/Makefile.map @@ -22,11 +22,12 @@ # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# Copyright (c) 2013, Joyent, Inc. All rights reserved. # .KEEP_STATE: .SUFFIXES: -.SUFFIXES: .xml .xmlgen $(SUFFIXES) +.SUFFIXES: .xml .xmlgen .xmlgenksh $(SUFFIXES) MODCLASS = maps @@ -53,6 +54,11 @@ install:= FILEMODE = 0444 $(RM) $@ $(CAT) ../common/xmlgen-header.xml > $@ $(PERL) $< >> $@ + +.xmlgenksh.xml: + $(RM) $@ + $(CAT) ../common/xmlgen-header-new.xml > $@ + $(KSH93) $< >> $@ %.xml: ../common/%.xml $(RM) $@ diff --git a/usr/src/lib/fm/topo/maps/common/xmlgen-header-new.xml b/usr/src/lib/fm/topo/maps/common/xmlgen-header-new.xml new file mode 100644 index 0000000000..14cf1ff1e8 --- /dev/null +++ b/usr/src/lib/fm/topo/maps/common/xmlgen-header-new.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<!DOCTYPE topology SYSTEM "/usr/share/lib/xml/dtd/topology.dtd.1"> diff --git a/usr/src/lib/fm/topo/maps/i86pc/i86pc-legacy-hc-topology.xml b/usr/src/lib/fm/topo/maps/i86pc/i86pc-legacy-hc-topology.xml index 54021a7a5f..fda43bca6c 100644 --- a/usr/src/lib/fm/topo/maps/i86pc/i86pc-legacy-hc-topology.xml +++ b/usr/src/lib/fm/topo/maps/i86pc/i86pc-legacy-hc-topology.xml @@ -2,6 +2,7 @@ <!DOCTYPE topology SYSTEM "/usr/share/lib/xml/dtd/topology.dtd.1"> <!-- Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2013, Joyent, Inc. All rights reserved. CDDL HEADER START @@ -151,6 +152,18 @@ Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. </range> </set> + <set type='product' setlist='Joyent-Compute-Platform-1101|Joyent-Compute-Platform-1102'> + <range name='psu' min='0' max='1'> + <enum-method name='ipmi' version='1' /> + </range> + <range name='fan' min='0' max='100'> + <enum-method name='ipmi' version='1' /> + </range> + <range name='bay' min='0' max='15'> + <propmap name='Joyent-Compute-Platform-1101-disk' /> + </range> + </set> + <set type='product' setlist='default'> <range name='psu' min='0' max='100'> <enum-method name='ipmi' version='1' /> diff --git a/usr/src/pkg/manifests/service-fault-management.mf b/usr/src/pkg/manifests/service-fault-management.mf index c30ff1be3d..27506c47f6 100644 --- a/usr/src/pkg/manifests/service-fault-management.mf +++ b/usr/src/pkg/manifests/service-fault-management.mf @@ -424,6 +424,8 @@ file path=usr/lib/fm/fmd/ipmitopo mode=0555 # file path=usr/lib/fm/fmd/plugins/cpumem-retire.conf file path=usr/lib/fm/fmd/plugins/cpumem-retire.so mode=0555 +file path=usr/lib/fm/fmd/plugins/disk-lights.conf +file path=usr/lib/fm/fmd/plugins/disk-lights.so mode=0555 file path=usr/lib/fm/fmd/plugins/disk-monitor.conf file path=usr/lib/fm/fmd/plugins/disk-monitor.so mode=0555 file path=usr/lib/fm/fmd/plugins/disk-transport.conf @@ -726,6 +728,9 @@ $(i386_ONLY)file path=usr/platform/i86pc/lib/fm/eft/gcpu.eft mode=0444 $(i386_ONLY)file path=usr/platform/i86pc/lib/fm/eft/gcpu_amd.eft mode=0444 $(i386_ONLY)file path=usr/platform/i86pc/lib/fm/eft/intel.eft mode=0444 $(i386_ONLY)file \ + path=usr/platform/i86pc/lib/fm/topo/maps/Joyent-Compute-Platform-1101-disk-hc-topology.xml \ + mode=0444 +$(i386_ONLY)file \ path=usr/platform/i86pc/lib/fm/topo/maps/Netra-X4200-M2-disk-hc-topology.xml \ mode=0444 $(i386_ONLY)file \ |