master - post-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=480c1c95993a1a...
Commit: 480c1c95993a1a2903e580ca402ba6368088decd
Parent: 37b8b84fee7459f0a78562c281c405484f25b9db
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Aug 10 03:01:55 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Aug 10 03:01:55 2016 +0100
post-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 3 +++
WHATS_NEW_DM | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index ed95ad7..5e46ebc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.163(2)-git (2016-08-10)
+2.02.164(2)-git (2016-08-10)
diff --git a/VERSION_DM b/VERSION_DM
index aecc584..a5de990 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.133-git (2016-08-10)
+1.02.134-git (2016-08-10)
diff --git a/WHATS_NEW b/WHATS_NEW
index 36bac09..8f4fe9c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.02.164 -
+===================================
+
Version 2.02.163 - 10th August 2016
===================================
Add profile for lvmdbusd which uses lvm shell json report output.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 2b32d76..7bbfd88 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.134 -
+===================================
+
Version 1.02.133 - 10th August 2016
===================================
Add dm_report_destroy_rows/dm_report_group_output_and_pop_all for lvm shell.
7 years, 9 months
master - pre-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=37b8b84fee7459...
Commit: 37b8b84fee7459f0a78562c281c405484f25b9db
Parent: b4f0503d1b55f0f28dbb0d53192aa0ed77423c37
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Aug 10 02:42:35 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Aug 10 02:42:35 2016 +0100
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 9 +++++++--
WHATS_NEW_DM | 6 ++++--
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/VERSION b/VERSION
index 32cef62..ed95ad7 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.163(2)-git (2016-07-28)
+2.02.163(2)-git (2016-08-10)
diff --git a/VERSION_DM b/VERSION_DM
index 41ac4ce..aecc584 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.133-git (2016-07-28)
+1.02.133-git (2016-08-10)
diff --git a/WHATS_NEW b/WHATS_NEW
index b51cb79..36bac09 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,10 @@
-Version 2.02.163 -
-=================================
+Version 2.02.163 - 10th August 2016
+===================================
+ Add profile for lvmdbusd which uses lvm shell json report output.
+ Restrict in-command modification of some parms in lvm shell.
+ Apply LVM_COMMAND_PROFILE early for lvm shell.
+ Refactor reporting so lvm shell log report collects whole of cmd execution.
+ Support LVM_*_FD envvars to redirect output to file descriptors.
Limit use of --corelog and --mirrorlog to mirrors in lvconvert.
Reject --nosync option for RAID6 LVs in lvcreate.
Do not refresh whole cmd context if profile dropped after processing LVM cmd.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 74722c5..2b32d76 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,7 @@
-Version 1.02.133 -
-=================================
+Version 1.02.133 - 10th August 2016
+===================================
+ Add dm_report_destroy_rows/dm_report_group_output_and_pop_all for lvm shell.
+ Adjust group handling and json production for lvm shell.
Version 1.02.132 - 28th July 2016
=================================
7 years, 9 months
master - man: fix references to names for --configreport arg in pvs, vgs and lvs man page
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b4f0503d1b55f0...
Commit: b4f0503d1b55f0f28dbb0d53192aa0ed77423c37
Parent: 6fcfa2855ba89f2516a22265a8ed1a70fd841aff
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 9 17:55:34 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 9 18:49:11 2016 +0200
man: fix references to names for --configreport arg in pvs, vgs and lvs man page
---
man/lvs.8.in | 2 +-
man/pvs.8.in | 2 +-
man/vgs.8.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/man/lvs.8.in b/man/lvs.8.in
index 3cb2d2b..48ef866 100644
--- a/man/lvs.8.in
+++ b/man/lvs.8.in
@@ -71,7 +71,7 @@ the "unknown" value which denotes that the value could not be determined).
.B \-\-configreport \fI ReportName
Make any subsequent \fB\-o, \-\-options\fP, \fB\-O, \-\-sort\fP or
\fB\-S, \-\-select\fP to apply for \fIReportName\fP where \fIReportName\fP
-is either 'lvs' for command's main report or 'log' for log report.
+is either 'lv' for command's main report or 'log' for log report.
If \fB\-\-configreport\fP option is not used to identify a report, then
command's main report is assumed. The log report is available only if
enabled by \fBlog/report_command_log\fP \fBlvm.conf\fP(5) setting or
diff --git a/man/pvs.8.in b/man/pvs.8.in
index 0a60b6f..54f21c3 100644
--- a/man/pvs.8.in
+++ b/man/pvs.8.in
@@ -60,7 +60,7 @@ the "unknown" value which denotes that the value could not be determined).
.B \-\-configreport \fI ReportName
Make any subsequent \fB\-o, \-\-options\fP, \fB\-O, \-\-sort\fP or
\fB\-S, \-\-select\fP to apply for \fIReportName\fP where \fIReportName\fP
-is either 'pvs' for command's main report or 'log' for log report.
+is either 'pv' for command's main report or 'log' for log report.
If \fB\-\-configreport\fP option is not used to identify a report, then
command's main report is assumed. The log report is available only if
enabled by \fBlog/report_command_log\fP \fBlvm.conf\fP(5) setting or
diff --git a/man/vgs.8.in b/man/vgs.8.in
index ab9d9ac..080086c 100644
--- a/man/vgs.8.in
+++ b/man/vgs.8.in
@@ -58,7 +58,7 @@ the "unknown" value which denotes that the value could not be determined).
.B \-\-configreport \fI ReportName
Make any subsequent \fB\-o, \-\-options\fP, \fB\-O, \-\-sort\fP or
\fB\-S, \-\-select\fP to apply for \fIReportName\fP where \fIReportName\fP
-is either 'vgs' for command's main report or 'log' for log report.
+is either 'vg' for command's main report or 'log' for log report.
If \fB\-\-configreport\fP option is not used to identify a report, then
command's main report is assumed. The log report is available only if
enabled by \fBlog/report_command_log\fP \fBlvm.conf\fP(5) setting or
7 years, 9 months
master - man: add lvm fullreport man page
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6fcfa2855ba89f...
Commit: 6fcfa2855ba89f2516a22265a8ed1a70fd841aff
Parent: 5ac008116be94797f7f9f39d61cb1bd96c60669c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 9 17:53:32 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 9 18:49:11 2016 +0200
man: add lvm fullreport man page
---
man/Makefile.in | 2 +-
man/lvm-fullreport.8.in | 145 +++++++++++++++++++++++++++++++++++++++++++++++
man/lvm.8.in | 4 +
3 files changed, 150 insertions(+), 1 deletions(-)
diff --git a/man/Makefile.in b/man/Makefile.in
index 2e0fd95..b923a9a 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -30,7 +30,7 @@ LVMDBUSDMAN = lvmdbusd.8
MAN5=lvm.conf.5
MAN7=lvmsystemid.7
-MAN8=lvm-config.8 lvm-dumpconfig.8 lvm-lvpoll.8 \
+MAN8=lvm-config.8 lvm-dumpconfig.8 lvm-fullreport.8 lvm-lvpoll.8 \
lvchange.8 lvmconfig.8 lvconvert.8 lvcreate.8 lvdisplay.8 lvextend.8 \
lvm.8 lvmchange.8 lvmconf.8 lvmdiskscan.8 lvmdump.8 lvmsadc.8 lvmsar.8 \
lvreduce.8 lvremove.8 lvrename.8 lvresize.8 lvs.8 \
diff --git a/man/lvm-fullreport.8.in b/man/lvm-fullreport.8.in
new file mode 100644
index 0000000..96ac937
--- /dev/null
+++ b/man/lvm-fullreport.8.in
@@ -0,0 +1,145 @@
+.TH LVM-FULLREPORT 8 "LVM TOOLS #VERSION#" "Red Hat, Inc" \" -*- nroff -*-
+.SH NAME
+lvm fullreport \(em Report information about PVs, PV segments, VGs, LVs and LV segments, all at once for each VG.
+.SH SYNOPSIS
+.B lvm fullreport
+.RB [ \-a | \-\-all ]
+.RB [ \-\-aligned ]
+.RB [ \-\-binary ]
+.RB [ \-\-commandprofile
+.IR ProfileName ]
+.RB [[ \-\-configreport
+.IR ReportName ]
+.RB [ \-o | \-\-options
+.RI [ + | \- | # ] Field1 [, Field2 ...]
+.RB [ \-O | \-\-sort
+.RI [ + | \- ] Key1 [, Key2 ...]]
+.RB [ \-S | \-\-select
+.IR Selection ]
+.RB ...]
+.RB [ \-d | \-\-debug ]
+.RB [ \-h | \-? | \-\-help ]
+.RB [ \-\-ignorelockingfailure ]
+.RB [ \-\-ignoreskippedcluster ]
+.RB [ \-\-logonly ]
+.RB [ \-\-nameprefixes ]
+.RB [ \-\-noheadings ]
+.RB [ \-\-nosuffix ]
+.RB [ \-P | \-\-partial ]
+.RB [ \-\-reportformat
+.RB { basic | json }]
+.RB [ \-\-rows ]
+.RB [ \-\-separator
+.IR Separator ]
+.RB [ \-\-unbuffered ]
+.RB [ \-\-units
+.IR hHbBsSkKmMgGtTpPeE ]
+.RB [ \-\-unquoted ]
+.RB [ \-v | \-\-verbose ]
+.RB [ \-\-version ]
+.RI [ VolumeGroupName
+.RI [ VolumeGroupName ...]]
+.SH DESCRIPTION
+lvm fullreport produces formatted output about PVs, PV segments, VGs, LVs
+and LV segments, all at once for each VG and guarded by per-VG lock
+for consistency.
+.SH OPTIONS
+See \fBlvm\fP(8) for common options.
+.TP
+.B \-\-all
+Include information in the output about internal Logical Volumes that
+are components of normally-accessible Logical Volumes, such as mirrors,
+but which are not independently accessible (e.g. not mountable).
+The names of such Logical Volumes are enclosed within square brackets
+in the output. For example, after creating a mirror using
+.B lvcreate -m1 \-\-mirrorlog disk
+, this option will reveal three internal Logical
+Volumes, with suffixes mimage_0, mimage_1, and mlog.
+.TP
+.B \-\-aligned
+Use with \fB\-\-separator\fP to align the output columns.
+.TP
+.B \-\-binary
+Use binary values "0" or "1" instead of descriptive literal values
+for columns that have exactly two valid values to report (not counting
+the "unknown" value which denotes that the value could not be determined).
+.TP
+.B \-\-configreport \fI ReportName
+Make any subsequent \fB\-o, \-\-options\fP, \fB\-O, \-\-sort\fP or
+\fB\-S, \-\-select\fP to apply for \fIReportName\fP where \fIReportName\fP
+is 'pv' for PV subreport, 'pvseg' for PV segment subreport, 'vg' for
+VG subreport, 'lv' for LV subreport, 'seg' for LV segment subreport or 'log'
+for log report. If \fB\-\-configreport\fP option is not used to identify a
+report, then all command's subreports are assumed except log report. The log
+report is available only if enabled by \fBlog/report_command_log\fP
+\fBlvm.conf\fP(5) setting or if \fB\-\-logonly\fP option is used.
+.TP
+.B \-\-logonly
+Suppress the main report itself and display only log report on output.
+.TP
+.B \-\-nameprefixes
+Add an "LVM2_" prefix plus the field name to the output. Useful
+with \fB\-\-noheadings\fP to produce a list of field=value pairs that can
+be used to set environment variables (for example, in \fBudev\fP(7) rules).
+.TP
+.B \-\-noheadings
+Suppress the headings line that is normally the first line of output.
+Useful if grepping the output.
+.TP
+.B \-\-nosuffix
+Suppress the suffix on output sizes. Use with \fB\-\-units\fP
+(except h and H) if processing the output.
+.TP
+.BR \-o ", " \-\-options
+Comma-separated ordered list of columns.
+.IP
+Precede the list with '\fI+\fP' to append to the current list
+of columns, '\fI-\fP' to remove from the current list of columns
+or '\fI#\fP' to compact given columns. The \fI\-o\fP option can
+be repeated, providing several lists. These lists are evaluated
+from left to right.
+.IP
+For the list of columns, see \fBpvs\fP(8), \fBvgs\fP(8),
+\fBlvs\fP(8) man page or check \fBpvs\fP, \fBvgs\fP, \fBlvs -o help\fP
+output.
+.TP
+.BR \-O ", " \-\-sort
+Comma-separated ordered list of columns to sort by. Replaces the default
+selection. Precede any column with '\fI\-\fP' for a reverse sort on that
+column.
+.TP
+.B \-\-rows
+Output columns as rows.
+.TP
+.BR \-S ", " \-\-select " " \fISelection
+Display only rows that match Selection criteria. All rows are displayed with
+the additional "selected" column (\fB-o selected\fP) showing 1 if the row
+matches the Selection and 0 otherwise. The Selection criteria are defined
+by specifying column names and their valid values (that can include reserved
+values) while making use of supported comparison operators. See \fBlvm\fP(8)
+and \fB\-S\fP, \fB\-\-select\fP description for more detailed information
+about constructing the Selection criteria. As a quick help and to see full
+list of column names that can be used in Selection including the list of
+reserved values and the set of supported selection operators, check the
+output of \fBpvs\fP, \fBvgs\fP, \fBlvs -S help\fP command.
+.TP
+.B \-\-separator \fISeparator
+String to use to separate each column. Useful if grepping the output.
+.TP
+.B \-\-unbuffered
+Produce output immediately without sorting or aligning the columns properly.
+.TP
+.B \-\-units \fIhHbBsSkKmMgGtTpPeE
+All sizes are output in these units: (h)uman-readable, (b)ytes, (s)ectors,
+(k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes.
+Capitalise to use multiples of 1000 (S.I.) instead of 1024. Can also specify
+custom units e.g. \-\-units 3M
+.TP
+.B \-\-unquoted
+When used with \fB\-\-nameprefixes\fP, output values in the field=value
+pairs are not quoted.
+.SH SEE ALSO
+.BR lvm (8),
+.BR pvs (8),
+.BR vgs (8),
+.BR lvs (8)
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 76d05fd..da85349 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -65,6 +65,10 @@ The same as \fBlvmconfig\fP(8) below.
.B formats
Display recognised metadata formats.
.TP
+.B fullreport
+Report information about PVs, PV segments, VGs, LVs and LV segments,
+all at once.
+.TP
.B help
Display the help text.
.TP
7 years, 9 months
master - report: add report_reset_cmdlog_seqnum and call it for each new cmd executed in lvm shell
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5ac008116be947...
Commit: 5ac008116be94797f7f9f39d61cb1bd96c60669c
Parent: 29f7dc292295bc6cad92e888691cb949d83c0413
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Aug 8 15:45:46 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 9 18:49:11 2016 +0200
report: add report_reset_cmdlog_seqnum and call it for each new cmd executed in lvm shell
---
lib/report/report.c | 12 +++++++++---
lib/report/report.h | 1 +
tools/lvm.c | 1 +
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index fab6379..ea36795 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -38,6 +38,9 @@ struct lvm_report_object {
struct label *label;
};
+static uint32_t log_seqnum = 1;
+
+
/*
* Enum for field_num index to use in per-field reserved value definition.
* Each field is represented by enum value with name "field_<id>" where <id>
@@ -3867,9 +3870,7 @@ int report_cmdlog(void *handle, const char *type, const char *context,
const char *object_group_id, const char *msg,
int current_errno, int ret_code)
{
- static uint32_t seq_num = 1;
-
- struct cmd_log_item log_item = {seq_num++, type, context, object_type_name,
+ struct cmd_log_item log_item = {log_seqnum++, type, context, object_type_name,
object_name ? : "", object_id ? : "",
object_group ? : "", object_group_id ? : "",
msg ? : "", current_errno, ret_code};
@@ -3880,6 +3881,11 @@ int report_cmdlog(void *handle, const char *type, const char *context,
return 1;
}
+void report_reset_cmdlog_seqnum(void)
+{
+ log_seqnum = 1;
+}
+
int report_current_object_cmdlog(const char *type, const char *msg, int32_t ret_code)
{
log_report_t log_state = log_get_report_state();
diff --git a/lib/report/report.h b/lib/report/report.h
index cf4145e..c787f56 100644
--- a/lib/report/report.h
+++ b/lib/report/report.h
@@ -111,6 +111,7 @@ int report_cmdlog(void *handle, const char *type, const char *context,
const char *object_id, const char *object_group,
const char *object_group_id, const char *msg,
int current_errno, int ret_code);
+void report_reset_cmdlog_seqnum(void);
#define REPORT_OBJECT_CMDLOG_NAME "status"
#define REPORT_OBJECT_CMDLOG_SUCCESS "success"
#define REPORT_OBJECT_CMDLOG_FAILURE "failure"
diff --git a/tools/lvm.c b/tools/lvm.c
index 628a29d..b3af020 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -229,6 +229,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_CMD);
while (1) {
+ report_reset_cmdlog_seqnum();
if (cmd->cmd_report.log_rh) {
/*
* If previous command was lastlog, reset log report selection to
7 years, 9 months
master - conf: mark selected settings with CFG_DISALLOW_INTERACTIVE flag
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=29f7dc292295bc...
Commit: 29f7dc292295bc6cad92e888691cb949d83c0413
Parent: e8985c71bc7c6e8316adf97f2397ac32ab67191b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Aug 8 10:43:33 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 9 18:49:11 2016 +0200
conf: mark selected settings with CFG_DISALLOW_INTERACTIVE flag
---
lib/config/config_settings.h | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 7d2cdd5..1084224 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -167,7 +167,7 @@ cfg(config_checks_CFG, "checks", config_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2,
cfg(config_abort_on_errors_CFG, "abort_on_errors", config_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2,2,99), NULL, 0, NULL,
"Abort the LVM process if a configuration mismatch is found.\n")
-cfg_runtime(config_profile_dir_CFG, "profile_dir", config_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(2, 2, 99), 0, NULL,
+cfg_runtime(config_profile_dir_CFG, "profile_dir", config_CFG_SECTION, CFG_DISALLOW_INTERACTIVE, CFG_TYPE_STRING, vsn(2, 2, 99), 0, NULL,
"Directory where LVM looks for configuration profiles.\n")
cfg(devices_dir_CFG, "dir", devices_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_STRING, DEFAULT_DEV_DIR, vsn(1, 0, 0), NULL, 0, NULL,
@@ -554,7 +554,7 @@ cfg_runtime(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocat
cfg(allocation_physical_extent_size_CFG, "physical_extent_size", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_EXTENT_SIZE, vsn(2, 2, 112), NULL, 0, NULL,
"Default physical extent size in KiB to use for new VGs.\n")
-cfg(log_report_command_log_CFG, "report_command_log", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_COMMAND_LOG_REPORT, vsn(2, 2, 158), NULL, 0, NULL,
+cfg(log_report_command_log_CFG, "report_command_log", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED | CFG_DISALLOW_INTERACTIVE, CFG_TYPE_BOOL, DEFAULT_COMMAND_LOG_REPORT, vsn(2, 2, 158), NULL, 0, NULL,
"Enable or disable LVM log reporting.\n"
"If enabled, LVM will collect a log of operations, messages,\n"
"per-object return codes with object identification and associated\n"
@@ -570,17 +570,17 @@ cfg(log_report_command_log_CFG, "report_command_log", log_CFG_SECTION, CFG_PROFI
"You can also use log/command_log_selection to define selection\n"
"criteria used each time the log is reported.\n")
-cfg(log_command_log_sort_CFG, "command_log_sort", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_COMMAND_LOG_SORT, vsn(2, 2, 158), NULL, 0, NULL,
+cfg(log_command_log_sort_CFG, "command_log_sort", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED | CFG_DISALLOW_INTERACTIVE, CFG_TYPE_STRING, DEFAULT_COMMAND_LOG_SORT, vsn(2, 2, 158), NULL, 0, NULL,
"List of columns to sort by when reporting command log.\n"
"See <lvm command> --logonly --configreport log -o help\n"
"for the list of possible fields.\n")
-cfg(log_command_log_cols_CFG, "command_log_cols", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_COMMAND_LOG_COLS, vsn(2, 2, 158), NULL, 0, NULL,
+cfg(log_command_log_cols_CFG, "command_log_cols", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED | CFG_DISALLOW_INTERACTIVE, CFG_TYPE_STRING, DEFAULT_COMMAND_LOG_COLS, vsn(2, 2, 158), NULL, 0, NULL,
"List of columns to report when reporting command log.\n"
"See <lvm command> --logonly --configreport log -o help\n"
"for the list of possible fields.\n")
-cfg(log_command_log_selection_CFG, "command_log_selection", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_COMMAND_LOG_SELECTION, vsn(2, 2, 158), NULL, 0, NULL,
+cfg(log_command_log_selection_CFG, "command_log_selection", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED | CFG_DISALLOW_INTERACTIVE, CFG_TYPE_STRING, DEFAULT_COMMAND_LOG_SELECTION, vsn(2, 2, 158), NULL, 0, NULL,
"Selection criteria used when reporting command log.\n"
"You can define selection criteria that are applied each\n"
"time log is reported. This way, it is possible to control the\n"
@@ -1510,7 +1510,7 @@ cfg(disk_area_start_sector_CFG, "start_sector", disk_area_CFG_SUBSECTION, CFG_UN
cfg(disk_area_size_CFG, "size", disk_area_CFG_SUBSECTION, CFG_UNSUPPORTED | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL, 0, NULL, NULL)
cfg(disk_area_id_CFG, "id", disk_area_CFG_SUBSECTION, CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL, NULL)
-cfg(report_output_format_CFG, "output_format", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_REP_OUTPUT_FORMAT, vsn(2, 2, 158), NULL, 0, NULL,
+cfg(report_output_format_CFG, "output_format", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED | CFG_DISALLOW_INTERACTIVE, CFG_TYPE_STRING, DEFAULT_REP_OUTPUT_FORMAT, vsn(2, 2, 158), NULL, 0, NULL,
"Format of LVM command's report output.\n"
"If there is more than one report per command, then the format\n"
"is applied for all reports. You can also change output format\n"
7 years, 9 months
master - config: add support for CFG_DISALLOW_INTERACTIVE flag to mark settings as not suitable for override in interactive mode
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e8985c71bc7c6e...
Commit: e8985c71bc7c6e8316adf97f2397ac32ab67191b
Parent: 54bf15555be1808eb292cfc3edeece236a1c9744
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Aug 8 10:43:18 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 9 18:49:11 2016 +0200
config: add support for CFG_DISALLOW_INTERACTIVE flag to mark settings as not suitable for override in interactive mode
Some settings are not suitable for override in interactive/shell
mode because such settings may confuse the code and it may end
up with unexpected behaviour. This is because of the fact that
once we're in the interactive/shell mode, we have already applied
some settings for the shell itself and we can't override them
further because we're already using those settings to drive the
interactive/shell mode. Such settings would get ignored silently
or, in worse case, they would mess up the existing configuration.
---
lib/commands/toolcontext.c | 3 +++
lib/config/config.c | 31 +++++++++++++++++++++++++++++++
lib/config/config.h | 33 +++++++++++++++++++--------------
lib/config/config_settings.h | 1 +
tools/lvmcmdline.c | 3 +++
5 files changed, 57 insertions(+), 14 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index a7f76ba..eaabf98 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -950,6 +950,9 @@ static void _destroy_config(struct cmd_context *cmd)
* they will get loaded again automatically.
*/
dm_list_iterate_items_safe(profile, tmp_profile, &cmd->profile_params->profiles) {
+ if (cmd->is_interactive && (profile == cmd->profile_params->shell_profile))
+ continue;
+
config_destroy(profile->cft);
profile->cft = NULL;
dm_list_move(&cmd->profile_params->profiles_to_load, &profile->list);
diff --git a/lib/config/config.c b/lib/config/config.c
index a569444..46ef8e7 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -385,6 +385,13 @@ int override_config_tree_from_string(struct cmd_context *cmd,
return 0;
}
+ if (cmd->is_interactive &&
+ !config_force_check(cmd, CONFIG_STRING, cft_new)) {
+ log_error("Ignoring invalid configuration string.");
+ dm_config_destroy(cft_new);
+ return_0;
+ }
+
if (!(cs = dm_pool_zalloc(cft_new->mem, sizeof(struct config_source)))) {
log_error("Failed to allocate config source.");
dm_config_destroy(cft_new);
@@ -984,6 +991,20 @@ static int _config_def_check_node_is_profilable(struct cft_check_handle *handle,
return 1;
}
+static int _config_def_check_node_is_allowed(struct cft_check_handle *handle,
+ const char *rp, struct dm_config_node *cn,
+ const cfg_def_item_t *def)
+{
+ if (handle->disallowed_flags & def->flags) {
+ log_warn_suppress(handle->suppress_messages,
+ "Configuration %s \"%s\" is not allowed here.",
+ cn->v ? "option" : "section", rp);
+ return 0;
+ }
+
+ return 1;
+}
+
static int _config_def_check_node(struct cft_check_handle *handle,
const char *vp, char *pvp, char *rp, char *prp,
size_t buf_size, struct dm_config_node *cn)
@@ -1034,6 +1055,9 @@ static int _config_def_check_node(struct cft_check_handle *handle,
!_config_def_check_node_is_profilable(handle, rp, cn, def))
return_0;
+ if (!_config_def_check_node_is_allowed(handle, rp, cn, def))
+ return_0;
+
handle->status[def->id] |= CFG_VALID;
return 1;
}
@@ -2130,6 +2154,13 @@ int config_force_check(struct cmd_context *cmd, config_source_t source, struct d
/* provide warning messages only if config/checks=1 */
handle->suppress_messages = !find_config_tree_bool(cmd, config_checks_CFG, NULL);
+ /*
+ * Some settings can't be changed if we're running commands interactively
+ * within lvm shell so check for them in case we're in this interactive mode.
+ */
+ if (cmd->is_interactive)
+ handle->disallowed_flags |= CFG_DISALLOW_INTERACTIVE;
+
r = config_def_check(handle);
dm_pool_free(cmd->libmem, handle);
diff --git a/lib/config/config.h b/lib/config/config.h
index 659b8b0..aa95202 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -48,6 +48,7 @@ struct profile_params {
struct profile *global_metadata_profile; /* profile (as given by --metadataprofile cmd arg) that overrides any other VG/LV-based profile */
struct dm_list profiles_to_load; /* list of profiles which are only added, but still need to be loaded for any use */
struct dm_list profiles; /* list of profiles which are loaded already and which are ready for use */
+ struct profile *shell_profile; /* master profile used in interactive/shell mode */
};
#define CFG_PATH_MAX_LEN 128
@@ -98,31 +99,34 @@ typedef union {
/* whether the configuration item name is variable */
-#define CFG_NAME_VARIABLE 0x001
+#define CFG_NAME_VARIABLE 0x0001
/* whether empty value is allowed */
-#define CFG_ALLOW_EMPTY 0x002
+#define CFG_ALLOW_EMPTY 0x0002
/* whether the configuration item is for advanced use only */
-#define CFG_ADVANCED 0x004
+#define CFG_ADVANCED 0x0004
/* whether the configuration item is not officially supported */
-#define CFG_UNSUPPORTED 0x008
+#define CFG_UNSUPPORTED 0x0008
/* whether the configuration item is customizable by a profile */
-#define CFG_PROFILABLE 0x010
-/* whether the configuration item is customizable by a profile */
-/* and whether it can be attached to VG/LV metadata at the same time
+#define CFG_PROFILABLE 0x0010
+/* whether the configuration item is customizable by a profile
+ * and whether it can be attached to VG/LV metadata at the same time
* The CFG_PROFILABLE_METADATA flag incorporates CFG_PROFILABLE flag!!! */
-#define CFG_PROFILABLE_METADATA 0x030
+#define CFG_PROFILABLE_METADATA 0x0030
/* whether the default value is undefned */
-#define CFG_DEFAULT_UNDEFINED 0x040
+#define CFG_DEFAULT_UNDEFINED 0x0040
/* whether the default value is commented out on output */
-#define CFG_DEFAULT_COMMENTED 0x080
+#define CFG_DEFAULT_COMMENTED 0x0080
/* whether the default value is calculated during run time */
-#define CFG_DEFAULT_RUN_TIME 0x100
+#define CFG_DEFAULT_RUN_TIME 0x0100
/* whether the configuration setting is disabled (and hence defaults always used) */
-#define CFG_DISABLED 0x200
+#define CFG_DISABLED 0x0200
/* whether to print integers in octal form (prefixed by "0") */
-#define CFG_FORMAT_INT_OCTAL 0x400
+#define CFG_FORMAT_INT_OCTAL 0x0400
/* whether to disable checks for the whole config section subtree */
-#define CFG_SECTION_NO_CHECK 0x800
+#define CFG_SECTION_NO_CHECK 0x0800
+/* whether to disallow a possibility to override configuration
+ * setting for commands run interactively (e.g. in lvm shell) */
+#define CFG_DISALLOW_INTERACTIVE 0x1000
/* configuration definition item structure */
typedef struct cfg_def_item {
@@ -212,6 +216,7 @@ struct cft_check_handle {
unsigned check_diff:1; /* check if the value used differs from default one */
unsigned ignoreadvanced:1; /* do not include advnced configs */
unsigned ignoreunsupported:1; /* do not include unsupported configs */
+ uint16_t disallowed_flags; /* set of disallowed flags */
uint8_t status[CFG_COUNT]; /* flags for each configuration item - the result of the check */
};
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 9c46667..7d2cdd5 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -52,6 +52,7 @@
* CFG_DISABLED - configuration is disabled (defaults always used)
* CFG_FORMAT_INT_OCTAL - print integer number in octal form (also prefixed by "0")
* CFG_SECTION_NO_CHECK - do not check content of the section at all - use with care!!!
+ * CFG_DISALLOW_INTERACTIVE - disallow configuration node for use in interactive environment (e.g. cmds run in lvm shell)
*
* type: Allowed type for the value of simple configuation setting, one of:
* CFG_TYPE_BOOL
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index cb41534..af38799 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1430,6 +1430,9 @@ static int _prepare_profiles(struct cmd_context *cmd)
log_debug(_setting_global_profile_msg, _command_profile_source_name, profile->name);
cmd->profile_params->global_command_profile = profile;
+
+ if (!cmd->arg_values)
+ cmd->profile_params->shell_profile = profile;
}
7 years, 9 months
master - refactor: modify original _check_profile fn and rename to config_force_check for general use
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=54bf15555be180...
Commit: 54bf15555be1808eb292cfc3edeece236a1c9744
Parent: 785e2c31f553b0d2e98eb2a0d2087c942da81be7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Aug 8 12:55:15 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 9 18:49:11 2016 +0200
refactor: modify original _check_profile fn and rename to config_force_check for general use
---
lib/config/config.c | 9 ++++-----
lib/config/config.h | 3 +++
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 784c4b0..a569444 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -2113,7 +2113,7 @@ bad:
return NULL;
}
-static int _check_profile(struct cmd_context *cmd, struct profile *profile)
+int config_force_check(struct cmd_context *cmd, config_source_t source, struct dm_config_tree *cft)
{
struct cft_check_handle *handle;
int r;
@@ -2124,9 +2124,8 @@ static int _check_profile(struct cmd_context *cmd, struct profile *profile)
}
handle->cmd = cmd;
- handle->cft = profile->cft;
- handle->source = profile->source;
- /* the check is compulsory - allow only profilable items in a profile config! */
+ handle->cft = cft;
+ handle->source = source;
handle->force_check = 1;
/* provide warning messages only if config/checks=1 */
handle->suppress_messages = !find_config_tree_bool(cmd, config_checks_CFG, NULL);
@@ -2252,7 +2251,7 @@ int load_profile(struct cmd_context *cmd, struct profile *profile) {
* messages to be suppressed, but the check itself is always done
* for profiles!
*/
- if (!_check_profile(cmd, profile)) {
+ if (!config_force_check(cmd, profile->source, profile->cft)) {
log_error("Ignoring invalid %s %s.",
_config_source_names[profile->source], profile->name);
config_destroy(profile->cft);
diff --git a/lib/config/config.h b/lib/config/config.h
index 157cfeb..659b8b0 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -216,7 +216,10 @@ struct cft_check_handle {
};
int config_def_get_path(char *buf, size_t buf_size, int id);
+/* Checks config using given handle - the handle may be reused. */
int config_def_check(struct cft_check_handle *handle);
+/* Forces config check and automatically creates a new handle inside with defaults and discards the handle after the check. */
+int config_force_check(struct cmd_context *cmd, config_source_t source, struct dm_config_tree *cft);
int override_config_tree_from_string(struct cmd_context *cmd, const char *config_settings);
int override_config_tree_from_profile(struct cmd_context *cmd, struct profile *profile);
7 years, 9 months
master - conf: add lvmdbusd.profile
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=785e2c31f553b0...
Commit: 785e2c31f553b0d2e98eb2a0d2087c942da81be7
Parent: 7111d4874822e900cc3216df3fb81d7fa5af359c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Aug 4 18:16:21 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 9 18:49:11 2016 +0200
conf: add lvmdbusd.profile
---
conf/Makefile.in | 3 +-
conf/lvmdbusd.profile | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletions(-)
diff --git a/conf/Makefile.in b/conf/Makefile.in
index c88045c..db8e99f 100644
--- a/conf/Makefile.in
+++ b/conf/Makefile.in
@@ -24,7 +24,8 @@ PROFILES=$(PROFILE_TEMPLATES) \
$(srcdir)/cache-mq.profile \
$(srcdir)/cache-smq.profile \
$(srcdir)/thin-generic.profile \
- $(srcdir)/thin-performance.profile
+ $(srcdir)/thin-performance.profile \
+ $(srcdir)/lvmdbusd.profile
include $(top_builddir)/make.tmpl
diff --git a/conf/lvmdbusd.profile b/conf/lvmdbusd.profile
new file mode 100644
index 0000000..2cdc6da
--- /dev/null
+++ b/conf/lvmdbusd.profile
@@ -0,0 +1,50 @@
+#
+# DO NOT EDIT THIS FILE!
+#
+# LVM configuration profile used by lvmdbusd daemon.
+#
+# This sets up LVM to produce output in the most suitable format for processing
+# by lvmdbusd daemon which utilizes LVM shell to execute LVM commands.
+#
+# Do not edit this file in any way. This profile is distributed together with
+# lvmdbusd and it contains configuration that is important for lvmdbusd to
+# cooperate and interface with LVM correctly.
+#
+
+global {
+ # use bytes for expected and deterministic output
+ units=b
+ # no need for suffix if we have units set
+ suffix=0
+}
+
+report {
+ compact_output=0
+ compact_output_cols=""
+ binary_values_as_numeric=0
+ # time in number of seconds since the Epoch
+ time_format="%s"
+ mark_hidden_devices=1
+ # lvmdbusd expects JSON output
+ output_format=json
+ # *_cols_full for lvm fullreport's fields which lvmdbusd relies on to update its state
+ vgs_cols_full="vg_name,vg_uuid,vg_fmt,vg_size,vg_free,vg_sysid,vg_extent_size,vg_extent_count,vg_free_count,vg_profile,max_lv,max_pv,pv_count,lv_count,snap_count,vg_seqno,vg_mda_count,vg_mda_free,vg_mda_size,vg_mda_used_count,vg_attr,vg_tags"
+ pvs_cols_full="pv_name,pv_uuid,pv_fmt,pv_size,pv_free,pv_used,dev_size,pv_mda_size,pv_mda_free,pv_ba_start,pv_ba_size,pe_start,pv_pe_count,pv_pe_alloc_count,pv_attr,pv_tags,vg_name,vg_uuid"
+ lvs_cols_full="lv_uuid,lv_name,lv_path,lv_size,vg_name,pool_lv_uuid,pool_lv,origin_uuid,origin,data_percent,lv_attr,lv_tags,vg_uuid,lv_active,data_lv,metadata_lv,lv_parent,lv_role,lv_layout"
+ pvsegs_cols_full="pvseg_start,pvseg_size,segtype,pv_uuid,lv_uuid,pv_name"
+ segs_cols_full="seg_pe_ranges,segtype,lv_uuid"
+ vgs_sort_full="vg_name"
+ pvs_sort_full="pv_name"
+ lvs_sort_full="vg_name,lv_name"
+ pvsegs_sort_full="pv_uuid,pvseg_start"
+ segs_sort_full="lv_uuid,seg_start"
+}
+
+log {
+ # lvmdbusd relies on command log report to inspect LVM command's execution status
+ report_command_log=1
+ # display only outermost LVM shell-related log that lvmdbusd inspects first after LVM command execution (it calls 'lastlog' for more detailed log afterwards if needed)
+ command_log_selection="log_context=shell"
+ command_log_cols="log_seq_num,log_type,log_context,log_object_type,log_object_name,log_object_id,log_object_group,log_object_group_id,log_message,log_errno,log_ret_code"
+ command_log_sort="log_seq_num"
+}
7 years, 9 months
master - lvm: shell: honor log/command_log_selection as default and reset to this value after lastlog
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7111d4874822e9...
Commit: 7111d4874822e900cc3216df3fb81d7fa5af359c
Parent: e805ef2d66bc8a06481de648497ff1369965d3c3
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Aug 4 18:15:54 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 9 18:49:11 2016 +0200
lvm: shell: honor log/command_log_selection as default and reset to this value after lastlog
---
tools/lvm.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/tools/lvm.c b/tools/lvm.c
index 2b95c41..628a29d 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -209,7 +209,8 @@ static void _discard_log_report_content(struct cmd_context *cmd)
int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
{
log_report_t saved_log_report_state = log_get_report_state();
- int is_lastlog_cmd, argc, ret;
+ char *orig_command_log_selection = NULL;
+ int is_lastlog_cmd = 0, argc, ret;
char *input = NULL, *args[MAX_ARGS], **argv;
rl_readline_name = "lvm";
@@ -223,10 +224,21 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
if (!report_format_init(cmd))
return_ECMD_FAILED;
+ orig_command_log_selection = dm_pool_strdup(cmd->libmem, find_config_tree_str(cmd, log_command_log_selection_CFG, NULL));
log_set_report_context(LOG_REPORT_CONTEXT_SHELL);
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_CMD);
while (1) {
+ if (cmd->cmd_report.log_rh) {
+ /*
+ * If previous command was lastlog, reset log report selection to
+ * its original value as set by log/command_log_selection config setting.
+ */
+ if (is_lastlog_cmd &&
+ !dm_report_set_selection(cmd->cmd_report.log_rh, orig_command_log_selection))
+ log_error("Failed to reset log report selection.");
+ }
+
log_set_report(cmd->cmd_report.log_rh);
log_set_report_object_name_and_id(NULL, NULL);
7 years, 9 months