LVM2 ./WHATS_NEW lib/format_text/flags.c lib/m ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow at sourceware.org 2011-11-30 02:02:12
Modified files:
. : WHATS_NEW
lib/format_text: flags.c
lib/metadata : metadata-exported.h raid_manip.c
lib/raid : raid.c
libdm/ioctl : libdm-iface.c
man : lvconvert.8.in
tools : args.h commands.h lvconvert.c
Log message:
Support the ability to replace specific devices in a RAID array.
RAID is not like traditional LVM mirroring. LVM mirroring required failed devices to be removed or the logical volume would simply hang. RAID arrays can keep on running with failed devices. In fact, for RAID types other than RAID1, removing a device would mean substituting an error target or converting to a lower level RAID (e.g. RAID6 -> RAID5, or RAID4/5 to RAID0). Therefore, rather than removing a failed device unconditionally and potentially allocating a replacement, RAID allows the user to "replace" a device with a new one. This approach is a 1-step solution vs the current 2-step solution.
example> lvconvert --replace <dev_to_remove> vg/lv [possible_replacement_PVs]
'--replace' can be specified more than once.
example> lvconvert --replace /dev/sdb1 --replace /dev/sdc1 vg/lv
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2198&r2=1.2199
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/flags.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.222&r2=1.223
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/raid_manip.c.diff?cvsroot=lvm2&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/raid/raid.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.129&r2=1.130
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.in.diff?cvsroot=lvm2&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/args.h.diff?cvsroot=lvm2&r1=1.85&r2=1.86
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.166&r2=1.167
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.174&r2=1.175
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.89 - ================================== + Support the ability to replace specific devices in a RAID array via lvconvert. Add activation/use_linear_target enabled by default. Use gcc warning options only with .c to .o compilation. Move y/n prompts to stderr and repeat if response has both 'n' and 'y'.
lib/format_text/flags.c +1 -0
@@ -57,6 +57,7 @@ {PVMOVE, "PVMOVE", STATUS_FLAG}, {LOCKED, "LOCKED", STATUS_FLAG}, {LV_NOTSYNCED, "NOTSYNCED", STATUS_FLAG}, + {LV_REBUILD, "REBUILD", STATUS_FLAG}, {RAID, NULL, 0}, {RAID_META, NULL, 0}, {RAID_IMAGE, NULL, 0},
lib/metadata/metadata-exported.h +4 -0
@@ -61,7 +61,9 @@//#define VIRTUAL UINT64_C(0x00010000) /* LV - internal use only */ #define MIRROR_LOG UINT64_C(0x00020000)/* LV */ #define MIRROR_IMAGE UINT64_C(0x00040000)/* LV */ +#define LV_NOTSYNCED UINT64_C(0x00080000)/* LV */ +#define LV_REBUILD UINT64_C(0x00100000)/* LV - internal use only */ //#define PRECOMMITTED UINT64_C(0x00200000) /* VG - internal use only */ #define CONVERTING UINT64_C(0x00400000)/* LV */
@@ -788,6 +790,8 @@int lv_raid_merge (struct logical_volume *lv);int lv_raid_reshape (struct logical_volume *lv,const struct segment_type *new_segtype); +int lv_raid_replace (struct logical_volume *lv,struct dm_list *remove_pvs, +struct dm_list *allocate_pvs);/* -- metadata/raid_manip.c */
lib/metadata/raid_manip.c +239 -4
276 lines not on this page · raw message
lib/raid/raid.c +1 -1
@@ -183,7 +183,7 @@ }for (s =0 ; s < seg->area_count; s++) -if (seg_lv (seg, s)->status &LV_NOTSYNCED ) +if (seg_lv (seg, s)->status &LV_REBUILD ) rebuilds |=1 << s; if (!dm_tree_node_add_raid_target(node, len, _raid_name(seg),
libdm/ioctl/libdm-iface.c +2 -2
@@ -1653,10 +1653,10 @@ _cmd_data_v4[dmt->type].name, strerror(errno)); else - log_error("device-mapper: %s ioctl " + log_error("device-mapper: %s ioctl on %s ""failed: %s" , _cmd_data_v4[dmt->type].name, - strerror(errno)); + dmi->name, strerror(errno));/* * It's sometimes worth retrying after EBUSY in case
man/lvconvert.8.in +24 -0
@@ -52,6 +52,14 @@ [\-\-version] LogicalVolume[Path] [PhysicalVolume[Path]...] +.br +.B lvconvert +\-\-replace PhysicalVolume +[\-h|\-?|\-\-help] +[\-v|\-\-verbose] +[\-\-version] +LogicalVolume[Path] [PhysicalVolume[Path]...] + .SH DESCRIPTION lvconvert is used to change the segment type (i.e. linear, mirror, etc) or characteristics of a logical volume. For example, it can add or remove the
@@ -181,6 +189,14 @@ viz. activation/mirror_log_fault_policy or activation/mirror_device_fault_policy. .br + +.TP +.I \-\-replace PhysicalVolume +Remove the specified device (PhysicalVolume) and replace it with one that is +available in the volume group or from the specific list provided. This option +is only available to RAID segment types (e.g. "raid1", "raid5", etc). +.br + .SH Examples "lvconvert -m1 vg00/lvol1" .br
@@ -270,6 +286,14 @@ the '\-\-trackchanges' argument back into its original mirror and bring its contents back up-to-date. +.br +"lvconvert --replace /dev/sdb1 vg00/my_raid1 /dev/sdf1" +.br +Replace the physical volume "/dev/sdb1" in the RAID1 logical volume "my_raid1" +with the specified physical volume "/dev/sdf1". Had the argument "/dev/sdf1" +been left out, lvconvert would attempt to find a suitable device from those +available in the volume group. + .SH SEE ALSO .BR lvm (8), .BR vgcreate (8),
tools/args.h +1 -0
@@ -55,6 +55,7 @@ arg(mirrorlog_ARG, '\0', "mirrorlog", string_arg, 0) arg(splitmirrors_ARG, '\0', "splitmirrors", int_arg, 0) arg(trackchanges_ARG, '\0', "trackchanges", NULL, 0) +arg(replace_ARG, '\0', "replace", string_arg, ARG_GROUPABLE) arg(repair_ARG, '\0', "repair", NULL, 0) arg(use_policies_ARG, '\0', "use-policies", NULL, 0)arg (monitor_ARG,'\0' ,"monitor" , yes_no_arg,0 )
tools/commands.h +3 -2
@@ -100,6 +100,7 @@"[-m|--mirrors Mirrors [{--mirrorlog {disk|core|mirrored}|--corelog}]]\n" "\t[--type SegmentType]\n" "\t[--repair [--use-policies]]\n" +"\t[--replace PhysicalVolume]\n" "\t[-R|--regionsize MirrorLogRegionSize]\n" "\t[--alloc AllocationPolicy]\n" "\t[-b|--background]\n"
@@ -141,8 +142,8 @@ alloc_ARG, background_ARG, chunksize_ARG, corelog_ARG, interval_ARG, merge_ARG, mirrorlog_ARG, mirrors_ARG, name_ARG, noudevsync_ARG, - regionsize_ARG, repair_ARG, snapshot_ARG, splitmirrors_ARG, trackchanges_ARG, - type_ARG, stripes_long_ARG, stripesize_ARG, test_ARG, + regionsize_ARG, repair_ARG, replace_ARG, snapshot_ARG, splitmirrors_ARG, + trackchanges_ARG, type_ARG, stripes_long_ARG, stripesize_ARG, test_ARG, use_policies_ARG, yes_ARG, force_ARG, zero_ARG) xx(lvcreate,
tools/lvconvert.c +41 -2
85 lines not on this page · raw message