stable-2.02 - lvdisplay: enhance LV status output for raid(0)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c56b3fa4e2042230054786697cd0781f44d56f93 Commit: c56b3fa4e2042230054786697cd0781f44d56f93 Parent: 1d94748601056442b160df8802817404e0a5c7c4 Author: Heinz Mauelshagen <[email protected]> AuthorDate: Tue Jan 26 19:32:24 2021 +0100 Committer: Heinz Mauelshagen <[email protected]> CommitterDate: Wed Jan 27 16:59:02 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.02.188 - ================================== + Enhance lvdisplay to report raid availiable/partial. Enhance error handling for fsadm and hanled correct fsck result. Stop logging rename errors from persintent filter. Dmeventd lvm plugin ignores higher reserved_stack lvm.conf values.
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 ;
@@ -536,11 +536,18 @@ int lvdisplay_full(struct cmd_context *cmd,log_print ("LV Pool data %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 "vg.h" #include "lv.h" #include "lvm-percent.h" +#include <stdbool.h> #define MAX_STRIPES 128U#define SECTOR_SHIFT 9L
lib/metadata/segtype.h +1 -0
@@ -310,6 +310,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