LVM2 ./WHATS_NEW daemons/dmeventd/plugins/raid ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow at sourceware.org 2011-12-06 19:30:17
Modified files:
. : WHATS_NEW
daemons/dmeventd/plugins/raid: dmeventd_raid.c
doc : example.conf.in lvm2-raid.txt
lvm_fault_handling.txt
lib/config : defaults.h
tools : lvconvert.c
Log message:
Add policy based automated repair of RAID logical volumes
The RAID plug-in for dmeventd now calls 'lvconvert --repair' to address failures of devices in a RAID logical volume. The action taken can be either to "warn" or "allocate" a new device from any spares that may be available in the volume group. The action is designated by setting 'raid_fault_policy' in lvm.conf - the default being "warn".
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2203&r2=1.2204
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/raid/dmeventd_raid.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/lvm2-raid.txt.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/lvm_fault_handling.txt.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.89&r2=1.90
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.175&r2=1.176
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.89 - ================================== + Add policy based automated repair of RAID logical volumes Don't allow two images to be split and tracked from a RAID LV at one time Don't allow size change of RAID LV that is tracking changes for a split image Don't allow size change of RAID sub-LVs independently
daemons/dmeventd/plugins/raid/dmeventd_raid.c +36 -1
@@ -24,6 +24,41 @@/* FIXME Replace most syslogs with log_error() style messages and add complete context. */ /* FIXME Reformat to 80 char lines. */ +/* +* run_repair is a close copy to +* plugins/mirror/dmeventd_mirror.c:_remove_failed_devices() +*/ +static int run_repair (const char *device) +{ +int r; +#define CMD_SIZE 256/* FIXME Use system restriction */ +char cmd_str[CMD_SIZE ]; +char *vg =NULL , *lv =NULL , *layer =NULL ; + +if (strlen (device) >200 )/* FIXME Use real restriction */ +return -1 ; + +if (!dm_split_lvm_name (dmeventd_lvm2_pool (), device, &vg, &lv, &layer)) { +syslog (LOG_ERR ,"Unable to determine VG name from %s." , + device); +return -1 ; + } + +/* FIXME Is any sanity-checking required on %s? */ +if (CMD_SIZE <=snprintf (cmd_str,CMD_SIZE ,"lvconvert --config devices{ignore_suspended_devices=1} --repair --use-policies %s/%s" , vg, lv)) { +/* this error should be caught above, but doesn't hurt to check again */ +syslog (LOG_ERR ,"Unable to form LVM command: Device name too long." ); +return -1 ; + } + + r =dmeventd_lvm2_run (cmd_str); + +if (r !=ECMD_PROCESSED ) +syslog (LOG_INFO ,"Repair of RAID LV %s/%s failed." , vg, lv); + +return (r ==ECMD_PROCESSED ) ?0 :-1 ; +} +static int _process_raid_event (char *params,const char *device) {int i, n, failure =0 ;
@@ -71,7 +106,7 @@break ; }if (failure) -return 0 ;/* Don't bother parsing rest of status */ +return run_repair (device); } p =strstr (resync_ratio,"/" );
doc/example.conf.in +24 -2
@@ -522,9 +522,31 @@ # "auto" - Use default value chosen by kernel. readahead = "auto" + # 'raid_fault_policy' defines how a device failure in a RAID logical + # volume is handled. This includes logical volumes that have the following + # segment types: raid1, raid4, raid5*, and raid6*. + # + # In the event of a failure, the following policies will determine what + # actions are performed during the automated response to failures (when + # dmeventd is monitoring the RAID logical volume) and when 'lvconvert' is + # called manually with the options '--repair' and '--use-policies'. + # + # "warn" - Use the system log to warn the user that a device in the RAID + # logical volume has failed. It is left to the user to run + # 'lvconvert --repair' manually to remove or replace the failed + # device. As long as the number of failed devices does not + # exceed the redundancy of the logical volume (1 device for + # raid4/5, 2 for raid6, etc) the logical volume will remain + # usable. + # + # "allocate" - Attempt to use any extra physical volumes in the volume + # group as spares and replace faulty devices. + # + raid_fault_policy = "warn" + # 'mirror_image_fault_policy' and 'mirror_log_fault_policy' define - # how a device failure affecting a mirror is handled. - # A mirror is composed of mirror images (copies) and a log. + # how a device failure affecting a mirror (of "mirror" segment type) is + # handled. A mirror is composed of mirror images (copies) and a log. # A disk log ensures that a mirror does not need to be re-synced # (all copies made the same) every time a machine reboots or crashes. #
doc/lvm2-raid.txt +70 -1
80 lines not on this page · raw message
doc/lvm_fault_handling.txt +41 -60
128 lines not on this page · raw message
lib/config/defaults.h +1 -0
@@ -55,6 +55,7 @@#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"#define DEFAULT_MIRROR_IMAGE_FAULT_POLICY "remove"#define DEFAULT_MIRROR_MAX_IMAGES 8/* limited by kernel DM_KCOPYD_MAX_REGIONS */ +#define DEFAULT_RAID_FAULT_POLICY "warn"#define DEFAULT_DMEVENTD_RAID_LIB "libdevmapper-event-lvm2raid.so"#define DEFAULT_DMEVENTD_MIRROR_LIB "libdevmapper-event-lvm2mirror.so"#define DEFAULT_DMEVENTD_SNAPSHOT_LIB "libdevmapper-event-lvm2snapshot.so"
tools/lvconvert.c +54 -0
69 lines not on this page · raw message