RFC: Project geom-events
lev at FreeBSD.org
Tue Oct 4 18:05:20 UTC 2011
I've just committed (a branch with) the project, I worked on for
last month (and imagined for last two years).
It is GEOM Events subsystem.
What is it?
We now have pretty impressive set of GEOM modules, which covers many
areas: infrastructure support (like geom_part), encryption (like
geom_eli) and, what is interesting me most, RAID transformations like
geom_stripe, geom_mirror and geom_raid.
One thing is missed from software RAIDs is spare drives and state
monitoring (yes, I know, that geom_raid supports spare drivers for
metadata formats which supports them, but it not universal solution).
My long-standing dream was to write special daemon for this, but,
when I got some time for this project, and started to design, I
understood, that we have such daemon: devd(8).
So, here it is. GEOM Events.
Project consists of several parts (all are ready and commited to
(1) Simple kernel API, which wraps up devctl_notify() call to unify
different GEOM events. Now 4 events are specified:
(a) DISCONNECT -- when GEOM loses (orphans or throw away due to
errors) underlying provider.
(b) DESTROY -- when GEOM destorys it provider.
(c) SYNCSTART -- when GEOM starts to synchronizing volume
(synchronizing new mirror component or recalculate RAID3/RAID5
(d) SYNCSTOP -- wwen GEOM finishes synchronization.
Each event has arguments like class of GEOM, geom itself, provider
in question and some others. For details, please, see geom-events(8)
man page :)
(2) Simple change in devd(8) config to process events from GEOM
system and forward them to geom-events(8) scirpt.
(3) geom-events(8) script which processes these events. It is
fully-configurable and could perform these actions in reaction
(a) Replace failed providers with spare ones in case of
(b) Log events to syslog(8) with logger(1)
(c) Notify administrator (typically -- root) with mail(1).
(4) geom-events needs one small helper binary program: ggetmode(8).
ggetmode(8) takes one argument -- provider name -- and prints
its access mode, like r1w1e1 or r0w0e0. geom-events(8) script
determines is spare provider avail or not, comparing it access
mode with "r0w0e0" string.
(5) Changes in all geom classes to post these events.
I've covered all "actual" base classes with some exceptions:
(a) geom_mbr and other old-stlye partition classes is untouched, as
they are obsolete now.
(b) geom_vinum is not covered. It is too complex for me, sorry :(
(c) geom_raid is covered, but changes are not trivial ones. It
needs review from Alexander Motin. Commit message describes
what and why was changed.
I've wrote extensive documentation for all new components --
especially for geom-events(8) script, which is main source of
information about this project now.
I've tested all classes in virtual machine, with spare drives and
all stuff. Everything work perfectly.
**I really appreciate your comments, and I want to see this project
committed to CURRENT and MFCed to 9-STABLE in (near) future.**
Project sources are in "projects/geom-events" SVN branch. All but
last commits are organized by component, so you could review only
changes in your part of tree.
This branch contains fix from kern/160562, to make raid3 spare
Patch against CURRENT is attached.
// Black Lion AKA Lev Serebryakov <lev at FreeBSD.org>
More information about the freebsd-geom