master - commands: report: add lvm fullreport command
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=26c43c6ce525f5b338a2fbdae72bf308d42708d7 Commit: 26c43c6ce525f5b338a2fbdae72bf308d42708d7 Parent: f1e7f35bb5982f6767bcaa8ab775bde580316c5d Author: Peter Rajnoha <[email protected]> AuthorDate: Tue May 3 11:18:16 2016 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Mon Jun 20 11:33:42 2016 +0200
commands: report: add lvm fullreport command
lvm fullreport executes 5 subreports (vg, pv, lv, pvseg, seg) per each VG (and so taking one VG lock each time) within one command which makes it easier to produce full report about LVM entities.
Since all 5 subreports for a VG are done under a VG lock, the output is more consistent mainly in cases where LVM entities may be changed in parallel.
--- WHATS_NEW | 1 + lib/config/defaults.h | 12 +++ lib/report/report.h | 21 +++-- tools/Makefile.in | 2 +- tools/commands.h | 38 +++++++++ tools/reporter.c | 219 ++++++++++++++++++++++++++++++++++++++----------- 6 files changed, 235 insertions(+), 58 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.158 - ================================= + Add lvm fullreport command for joined PV, VG, LV and segment report per VG. Integrate report group handling and cmd log report into cmd processing code. Add log/report_command_log to lvm.conf to enable or disable cmd log report. Add log/report_output_format to lvm.conf for default report output format.
lib/config/defaults.h +12 -0
@@ -226,6 +226,12 @@#define DEFAULT_PVSEGS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"#define DEFAULT_DEVTYPES_COLS_VERB "devtype_name,devtype_max_partitions,devtype_description" +#define DEFAULT_VGS_COLS_FULL "vg_all" +#define DEFAULT_PVS_COLS_FULL "pv_all" +#define DEFAULT_LVS_COLS_FULL "lv_all" +#define DEFAULT_PVSEGS_COLS_FULL "pvseg_all,pv_uuid,lv_uuid" +#define DEFAULT_SEGS_COLS_FULL "seg_all,lv_uuid" +#define DEFAULT_LVS_SORT "vg_name,lv_name"#define DEFAULT_VGS_SORT "vg_name"#define DEFAULT_PVS_SORT "pv_name"
@@ -234,6 +240,12 @@#define DEFAULT_DEVTYPES_SORT "devtype_name"#define DEFAULT_COMMAND_LOG_SORT "log_seq_num" +#define DEFAULT_VGS_SORT_FULL "vg_name" +#define DEFAULT_PVS_SORT_FULL "pv_name" +#define DEFAULT_LVS_SORT_FULL "vg_name,lv_name" +#define DEFAULT_PVSEGS_SORT_FULL "pv_uuid,pvseg_start" +#define DEFAULT_SEGS_SORT_FULL "lv_uuid,seg_start" +#define DEFAULT_MIRROR_DEVICE_FAULT_POLICY "remove"#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"#define DEFAULT_SNAPSHOT_AUTOEXTEND_THRESHOLD 100
lib/report/report.h +11 -10
@@ -22,16 +22,17 @@typedef enum {CMDLOG =1 , -LVS =2 , -LVSINFO =4 , -LVSSTATUS =8 , -LVSINFOSTATUS =16 , -PVS =32 , -VGS =64 , -SEGS =128 , -PVSEGS =256 , -LABEL =512 , -DEVTYPES =1024 +FULL =2 , +LVS =4 , +LVSINFO =8 , +LVSSTATUS =16 , +LVSINFOSTATUS =32 , +PVS =64 , +VGS =128 , +SEGS =256 , +PVSEGS =512 , +LABEL =1024 , +DEVTYPES =2048 }report_type_t ;/*
tools/Makefile.in +1 -1
@@ -168,7 +168,7 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX) .commands: $(srcdir)/commands.h $(srcdir)/cmdnames.h Makefile $(CC) -E -P $(srcdir)/cmdnames.h 2> /dev/null | \ - egrep -v '^ *(|#.*|config|devtypes|dumpconfig|formats|help|lvpoll|pvdata|segtypes|systemid|tags|version) *$$' > .commands + egrep -v '^ *(|#.*|config|devtypes|dumpconfig|formats|fullreport|help|lvpoll|pvdata|segtypes|systemid|tags|version) *$$' > .commands ifneq ("$(CFLOW_CMD)", "") CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
tools/commands.h +38 -0
@@ -136,6 +136,44 @@ xx(lvactivate,"Logical Volume(s)\n") ***********/ +xx (fullreport, +"Display full report" , +PERMITTED_READ_ONLY |ALL_VGS_IS_DEFAULT |LOCKD_VG_SH , +"fullreport\n" +"\t[--aligned]\n" +"\t[--binary]\n" +"\t[-a|--all]\n" +"\t[--commandprofile ProfileName]\n" +"\t[-d|--debug]\n" +"\t[--foreign]\n" +"\t[-h|--help]\n" +"\t[--ignorelockingfailure]\n" +"\t[--ignoreskippedcluster]\n" +"\t[--nameprefixes]\n" +"\t[--noheadings]\n" +"\t[--nosuffix]\n" +"\t[-o|--options [+|-|#]Field[,Field]]\n" +"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n" +"\t[-P|--partial]\n" +"\t[--readonly]\n" +"\t[--reportformat {json}]\n" +"\t[--rows]\n" +"\t[-S|--select Selection]\n" +"\t[--separator Separator]\n" +"\t[--trustcache]\n" +"\t[--unbuffered]\n" +"\t[--units hHbBsSkKmMgGtTpPeE]\n" +"\t[--unquoted]\n" +"\t[-v|--verbose]\n" +"\t[--version]\n" +"\t[VolumeGroupName [VolumeGroupName...]]\n" , + + aligned_ARG, all_ARG, binary_ARG, foreign_ARG, ignorelockingfailure_ARG, + ignoreskippedcluster_ARG, nameprefixes_ARG, noheadings_ARG, nolocking_ARG, + nosuffix_ARG, options_ARG, partial_ARG, readonly_ARG, reportformat_ARG, + rows_ARG, select_ARG, separator_ARG, shared_ARG, sort_ARG, trustcache_ARG, + unbuffered_ARG, units_ARG, unquoted_ARG) + xx(lvchange, "Change the attributes of logical volume(s)", CACHE_VGMETADATA | PERMITTED_READ_ONLY,
tools/reporter.c +172 -47
336 lines not on this page · raw message