/*
* 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
*/
/*
* 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/topo_list.h>
typedef struct disk_lights {
const char *);
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.
*/
/*
* 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.
*/
};
"Disk Lights Agent",
"1.0",
&fmd_ops,
};
/*
* Fetch the Facility Node properties (name, type) from the FMRI
* for this node, or return -1 if we can't.
*/
static int
char **factype)
{
goto out;
goto out;
goto out;
goto out;
ret = 0;
out:
return (ret);
}
typedef struct dl_fault_walk_inner {
char *fwi_name;
static int
{
int err;
/*
* We're only interested in BAY children that are valid Facility Nodes.
*/
goto out;
}
goto out;
/*
* Attempt to set the LED mode appropriately. If this fails, give up
* and move on.
*/
out:
return (TOPO_WALK_NEXT);
}
static int
{
/*
* We are only looking for DISK nodes in the topology that have a parent
* BAY.
*/
return (TOPO_WALK_NEXT);
}
/*
* Check to see if the Resource this FMRI describes is Faulty:
*/
return (TOPO_WALK_NEXT);
/*
* Walk the children of this BAY and flush out our fault status if
* we find an appropriate indicator node.
*/
&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
{
int err;
topo_strerror(err));
goto out;
}
topo_strerror(err));
goto out;
}
out:
}
static void
{
/*
* If we're already on the short-poll coalesce timer, then return
* immediately.
*/
return;
/*
* Replace existing poll timer with coalesce timer:
*/
}
/*ARGSUSED*/
static void
{
/*
* Install the long-interval timer for the next poll.
*/
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
const char *class)
{
}
void
{
return;
/*
* Load Configuration:
*/
/*
* Schedule the initial enumeration:
*/
}
void
{
}