RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 820203 - Provide option to validate lvm.conf files and report unrecognised entries
Summary: Provide option to validate lvm.conf files and report unrecognised entries
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.4
Hardware: All
OS: All
low
low
Target Milestone: rc
: ---
Assignee: Peter Rajnoha
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-09 11:40 UTC by Alasdair Kergon
Modified: 2013-11-21 23:16 UTC (History)
11 users (show)

Fixed In Version: lvm2-2.02.100-1.el6
Doc Type: Enhancement
Doc Text:
LVM now supports validating of configuration files and it can report any unrecognised entries or entries with wrong value types in addition to existing syntax checking. To support this feature, a new "config" configuration section has been added to lvm.conf. This section has two configurables: "config/checks" which enables or disables the checking (enabled by default), the other one is "config/abort_on_errors" which enables or disables immediate abort on any invalid configuration entry found (disabled by default), otherwise there's only a warning message issued. In addition, new options have been added to "lvm dumpconfig" command that make use of the new configuration handling code introduced. The "lvm dumpconfig" now recognizes: - "--type {current|default|missing|new|profilable}" to select the type of the configuration to dump on output, - "--atversion version" to select the version of LVM tools for which the LVM configuration should be dumped, - "--ignoreadvanced" to not show any advanced configuration items, - "--ignoreunsupported" to not show unsupported configuration items (unofficial configuration items used mostly for debugging purposes), - "--mergedconfig" to show fully merged configuration with the base configuration if tag/profile configuration or configuration defined using "--config" option is used (otherwise only the tag/profile/--config configuration itself is dumped) - "--withcomments" to show any comments for configuration items, - "--withversions" to show versions at which the configuration item was introduced, - "--validate" to validate current LVM configuration.
Clone Of:
Environment:
Last Closed: 2013-11-21 23:16:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Debian BTS 666931 0 None None None Never
Red Hat Product Errata RHBA-2013:1704 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2013-11-20 21:52:01 UTC

Description Alasdair Kergon 2012-05-09 11:40:57 UTC
People sometimes make mistakes when editing lvm.conf files and at the moment the tools do not report unrecognised entries.  This aids compatibility between different versions.

Perhaps there could be a new lvm.conf setting that, if enabled, would validate the file during startup and report unrecognised settings.  (The list of settings would need to be generated automatically - I can think of several different ways this could be done.)

Comment 2 RHEL Program Management 2012-05-13 04:03:46 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 Tom Lavigne 2012-09-07 15:23:39 UTC
This request was evaluated by Red Hat Product Management for 
inclusion in the current release of Red Hat Enterprise Linux.
Since we are unable to provide this feature at this time,  
it has been proposed for the next release of 
Red Hat Enterprise Linux.

Comment 4 Peter Rajnoha 2012-11-28 12:40:46 UTC
The patchset is ready, will undergo a review soon I hope, but this is low prio RFE so only after 6.4 stuff is fully resolved...

Comment 5 Peter Rajnoha 2013-03-06 13:58:18 UTC
Upstream commits 6ea68f233c2196856fbc008e30b1eb17deb62701 through 6b777ccbb5dca4a6d80b8b0bf071993c049f6a9f adds support for config validation.

lvm.conf has a new "config" section with new "checks" and "abort_on_errors" options:

# This section allows you to set the way the configuration settings are handled.
config {
 
  # If enabled, any LVM2 configuration mismatch is reported.
  # This implies checking that the configuration key is understood
  # by LVM2 and that the value of the key is of a proper type.
  # If disabled, any configuration mismatch is ignored and default
  # value is used instead without any warning (a message about the
  # configuration key not being found is issued in verbose mode only).
  checks = 1

  # If enabled, any configuration mismatch aborts the LVM2 process.
  abort_on_errors = 0
}

Also, lvm dumpconfig has been enhanced to output several types of config trees:

[1] raw/~ # lvm dumpconfig --help
  dumpconfig: Dump configuration

dumpconfig
	[-f|--file filename] 
	[--type {current|default|missing|new} 
	[--withcomments] 
	[--withversions] 
	[--ignoreadvanced] 
	[--ignoreunsupported] 
	[--atversion version]] 
	[--validate]
	[ConfigurationNode...]

Where type is one of:
  - current: the original behaviour of lvm dumpconfig, just output existing lvm.conf/--config
  - default: output all possbile config nodes with default values
  - missing: output all missing config nodes that are not written in lvm.conf/--config (for which default values are used)
  - new: output all new options introduced in version that is defined by the --atversion arg (if --atversion is not specified, current version is assumed)

--withcomments will add a short commentary on output for each config node if it was defined

--withversions will add a commentary on output for each config node with an LVM version in which the config node appeared

--ignoreadvanced will cause the output to not include any advanced nodes

--ignoreunsupported will cause the output to not include any unsupported nodes (the ones which are targeted for internal or debug purposes only)

--validate will validate the lvm.conf/--config on demand (no matter what the config/checks setting is set to)


---

A few examples (pvs used, but works for all tools globally):

(adding unrecognized global/abc setting while config/abort_on_errors=1 is used)
[3] raw/~ # pvs
  Configuration setting "global/abc" unknown.
  LVM configuration invalid.

(adding unrecognized global/abc setting while config/abort_on_errors=0 is used)
[3] raw/~ # pvs
  Configuration setting "global/abc" unknown.
  PV         VG         Fmt  Attr PSize  PFree
  /dev/vda2  fedora_raw lvm2 a--  19.51g    0 

(using recognized global/umask setting, but with wrong type)
[3] raw/~ # pvs 
  Configuration setting "global/umask" has invalid type. Found string, expected integer.
  PV         VG         Fmt  Attr PSize  PFree
  /dev/vda2  fedora_raw lvm2 a--  19.51g    0 


(lvm dumpconfig enhancements)
[3] raw/~ # lvm dumpconfig --type current config
config {
	checks=1
	abort_on_errors=1
}

[3] raw/~ # lvm dumpconfig --type default config
config {
	checks=1
	abort_on_errors=0
}

[3] raw/~ # lvm dumpconfig --type default config --withcomments
# Configuration section config.
# Configuration handling.
config {
	# Configuration option config/checks.
	# Configuration tree check on each LVM command execution.
	checks=1
	# Configuration option config/abort_on_errors.
	# Abort LVM command execution if configuration is invalid.
	abort_on_errors=0
}

[3] raw/~ # lvm dumpconfig --type default config --withcomments --withversions
# Configuration section config.
# Configuration handling.
# Since version 2.2.99.
config {
	# Configuration option config/checks.
	# Configuration tree check on each LVM command execution.
	# Since version 2.2.99.
	checks=1
	# Configuration option config/abort_on_errors.
	# Abort LVM command execution if configuration is invalid.
	# Since version 2.2.99.
	abort_on_errors=0
}

[3] raw/~ # lvm dumpconfig --type new --withversions
# Since version 2.2.99.
config {
	# Since version 2.2.99.
	checks=1
	# Since version 2.2.99.
	abort_on_errors=0
}
# Since version 2.2.77.
allocation {
	# Since version 2.2.99.
	thin_pool_zero=1
	# Since version 2.2.99.
	thin_pool_discards="passdown"
	# Since version 2.2.99.
	thin_pool_chunk_size=64
}
# Since version 1.0.0.
log {
	# Since version 2.2.99.
	debug_classes=["memory", "devices", "activation", "allocation", "lvmetad", "metadata", "cache", "locking"]
}
# Since version 1.0.0.
global {
	# Since version 2.2.99.
	raid10_segtype_default="mirror"
	# Since version 2.2.99.
	thin_disabled_features=""
}
# Since version 1.0.0.
activation {
	# Since version 2.2.99.
	raid_region_size=512
}

and so on...

Comment 7 Nenad Peric 2013-09-27 08:10:50 UTC
Marking Verified with lvm2-2.02.103-0.100.el6


Users should be aware that the configuration tests are done after lvm.conf syntax checking, so that improper syntax inside the config file (unquoted string for example) would produce a syntax error rather than a configuration check error. 

Man page of lvm(8) as of this version does not contain explanations of each command line options. It is supposed to be added in a future version (it's still in the works).

Comment 8 errata-xmlrpc 2013-11-21 23:16:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1704.html


Note You need to log in before you can comment on or make changes to this bug.