master - lvdisplay: enhance LV status output for raid(0)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f08ef238564a547477f18c3668c616d497d7f3f8 Commit: f08ef238564a547477f18c3668c616d497d7f3f8 Parent: 665d265349596d1d4e67b1db5cb33f78338f4c7c Author: Heinz Mauelshagen <[email protected]> AuthorDate: Tue Jan 26 19:32:24 2021 +0100 Committer: Heinz Mauelshagen <[email protected]> CommitterDate: Wed Jan 27 16:56:22 2021 +0100
lvdisplay: enhance LV status output for raid(0)
In case legs of a raid0 LV are removed, the lvdisplay command still reports 'available' though raid0 is not providing any resilience compared to the other raid levels.
Also lvdisplay does not display '(partial)' in case of missing raid0 legs as oposed to the lvs command.
Enhance lvdisplay to report "NOT available" for any RaidLV type in case too many legs are inaccessible hence causing data loss. I.e. any leg for raid0, all for raid1, more than 1 for raid4/5, more than 2 for raid6 and in case of completely lost mirror groups for raid10.
Add test/shell/lvdisplay-raid.sh.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1872678
--- WHATS_NEW | 1 + lib/display/display.c | 13 +++++-- lib/metadata/metadata-exported.h | 1 + lib/metadata/segtype.h | 1 + lib/raid/raid.c | 57 +++++++++++++++++++++++++++++ test/shell/lvdisplay-raid.sh | 79 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 149 insertions(+), 3 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.03.12 - =================================== + Enhance lvdisplay to report raid availiable/partial. Support online rename of VDO pools. Imporove removal of pmspare when last pool is removed. Fix problem with wiping of converted LVs.
lib/display/display.c +10 -3
@@ -399,7 +399,7 @@ int lvdisplay_full(struct cmd_context *cmd, void *handle __attribute__((unused))) {struct lvinfo info; -int inkernel, snap_active =0 ; +int inkernel, snap_active =0 , partial =0 , raid_is_avail =1 ; char uuid[64] __attribute__((aligned(8)));const char *access_str;struct lv_segment *snap_seg =NULL , *mirror_seg =NULL ;
@@ -558,11 +558,18 @@ int lvdisplay_full(struct cmd_context *cmd,log_print ("LV VDO Pool name %s" ,seg_lv (seg,0 )->name); } +if (lv_is_partial (lv)) + partial =1 ; + +if (lv_is_raid (lv)) + raid_is_avail =raid_is_available (lv) ?1 :0 ; +if (inkernel && info.suspended)log_print ("LV Status suspended" );else if (activation ()) -log_print ("LV Status %savailable" , - inkernel ?"" :"NOT " ); +log_print ("LV Status %savailable%s" , + (inkernel && raid_is_avail) ?"" :"NOT " , + partial ?" (partial)" :"" );/********* FIXME lv_number log_print("LV # %u", lv->lv_number + 1);
lib/metadata/metadata-exported.h +1 -0
@@ -26,6 +26,7 @@#include "lib/metadata/vg.h" #include "lib/metadata/lv.h" #include "lib/misc/lvm-percent.h" +#include <stdbool.h> #define MAX_STRIPES 128U#define SECTOR_SHIFT 9L
lib/metadata/segtype.h +1 -0
@@ -326,6 +326,7 @@ struct segment_type *init_unknown_segtype(struct cmd_context *cmd,#ifdef RAID_INTERNAL int init_raid_segtypes (struct cmd_context *cmd,struct segtype_library *seglib); +bool raid_is_available (const struct logical_volume *lv);#endif #define THIN_FEATURE_DISCARDS (1U << 0)
lib/raid/raid.c +57 -0
63 lines not on this page · raw message
test/shell/lvdisplay-raid.sh new file +79 -0
79 lines not on this page · raw message