master - conf: add separate 'conf' dir for config files
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d1ed2254ccfe2...
Commit: 6d1ed2254ccfe2a34f1423ea2359cf6a554e8d9e
Parent: 9c12a23a997418700b4dac1a44d193e6a837f3a3
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jun 28 10:46:00 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:22:11 2013 +0200
conf: add separate 'conf' dir for config files
---
Makefile.in | 4 +-
conf/Makefile.in | 31 ++
conf/example.conf.in | 923 ++++++++++++++++++++++++++++++++++++++++++++++++++
configure | 6 +-
configure.in | 4 +-
doc/Makefile.in | 31 --
doc/example.conf.in | 923 --------------------------------------------------
7 files changed, 961 insertions(+), 961 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index ceb8964..2ee20e5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -16,7 +16,7 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-SUBDIRS = doc include man
+SUBDIRS = conf include man
ifeq ("@UDEV_RULES@", "yes")
SUBDIRS += udev
@@ -43,7 +43,7 @@ ifeq ($(MAKECMDGOALS),clean)
endif
# FIXME Should use intermediate Makefiles here!
ifeq ($(MAKECMDGOALS),distclean)
- SUBDIRS = doc include man test scripts \
+ SUBDIRS = conf include man test scripts \
libdaemon lib tools daemons libdm \
udev po liblvm python \
unit-tests/datastruct unit-tests/mm unit-tests/regex
diff --git a/conf/Makefile.in b/conf/Makefile.in
new file mode 100644
index 0000000..c63e3ce
--- /dev/null
+++ b/conf/Makefile.in
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
+#
+# This file is part of LVM2.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+
+CONFSRC=example.conf
+CONFDEST=lvm.conf
+
+include $(top_builddir)/make.tmpl
+
+install_lvm2: $(CONFSRC)
+ @if [ ! -e $(confdir)/$(CONFDEST) ]; then \
+ echo "$(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST)"; \
+ $(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST); \
+ fi
+
+install: install_lvm2
+
+DISTCLEAN_TARGETS += $(CONFSRC)
diff --git a/conf/example.conf.in b/conf/example.conf.in
new file mode 100644
index 0000000..3bc8c3c
--- /dev/null
+++ b/conf/example.conf.in
@@ -0,0 +1,923 @@
+# This is an example configuration file for the LVM2 system.
+# It contains the default settings that would be used if there was no
+# @DEFAULT_SYS_DIR(a)/lvm.conf file.
+#
+# Refer to 'man lvm.conf' for further information including the file layout.
+#
+# To put this file in a different directory and override @DEFAULT_SYS_DIR@ set
+# the environment variable LVM_SYSTEM_DIR before running the tools.
+#
+# N.B. Take care that each setting only appears once if uncommenting
+# example settings in this file.
+
+# 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
+
+ # Directory where LVM looks for configuration profiles.
+ profile_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_PROFILE_SUBDIR"
+}
+
+# This section allows you to configure which block devices should
+# be used by the LVM system.
+devices {
+
+ # Where do you want your volume groups to appear ?
+ dir = "/dev"
+
+ # An array of directories that contain the device nodes you wish
+ # to use with LVM2.
+ scan = [ "/dev" ]
+
+ # If set, the cache of block device nodes with all associated symlinks
+ # will be constructed out of the existing udev database content.
+ # This avoids using and opening any inapplicable non-block devices or
+ # subdirectories found in the device directory. This setting is applied
+ # to udev-managed device directory only, other directories will be scanned
+ # fully. LVM2 needs to be compiled with udev support for this setting to
+ # take effect. N.B. Any device node or symlink not managed by udev in
+ # udev directory will be ignored with this setting on.
+ obtain_device_list_from_udev = 1
+
+ # If several entries in the scanned directories correspond to the
+ # same block device and the tools need to display a name for device,
+ # all the pathnames are matched against each item in the following
+ # list of regular expressions in turn and the first match is used.
+ preferred_names = [ ]
+
+ # Try to avoid using undescriptive /dev/dm-N names, if present.
+ # preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
+
+ # A filter that tells LVM2 to only use a restricted set of devices.
+ # The filter consists of an array of regular expressions. These
+ # expressions can be delimited by a character of your choice, and
+ # prefixed with either an 'a' (for accept) or 'r' (for reject).
+ # The first expression found to match a device name determines if
+ # the device will be accepted or rejected (ignored). Devices that
+ # don't match any patterns are accepted.
+
+ # Be careful if there there are symbolic links or multiple filesystem
+ # entries for the same device as each name is checked separately against
+ # the list of patterns. The effect is that if the first pattern in the
+ # list to match a name is an 'a' pattern for any of the names, the device
+ # is accepted; otherwise if the first pattern in the list to match a name
+ # is an 'r' pattern for any of the names it is rejected; otherwise it is
+ # accepted.
+
+ # Don't have more than one filter line active at once: only one gets used.
+
+ # Run vgscan after you change this parameter to ensure that
+ # the cache file gets regenerated (see below).
+ # If it doesn't do what you expect, check the output of 'vgscan -vvvv'.
+
+
+ # By default we accept every block device:
+ filter = [ "a/.*/" ]
+
+ # Exclude the cdrom drive
+ # filter = [ "r|/dev/cdrom|" ]
+
+ # When testing I like to work with just loopback devices:
+ # filter = [ "a/loop/", "r/.*/" ]
+
+ # Or maybe all loops and ide drives except hdc:
+ # filter =[ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ]
+
+ # Use anchors if you want to be really specific
+ # filter = [ "a|^/dev/hda8$|", "r/.*/" ]
+
+ # Since "filter" is often overridden from command line, it is not suitable
+ # for system-wide device filtering (udev rules, lvmetad). To hide devices
+ # from LVM-specific udev processing and/or from lvmetad, you need to set
+ # global_filter. The syntax is the same as for normal "filter"
+ # above. Devices that fail the global_filter are not even opened by LVM.
+
+ # global_filter = []
+
+ # The results of the filtering are cached on disk to avoid
+ # rescanning dud devices (which can take a very long time).
+ # By default this cache is stored in the @DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@ directory
+ # in a file called '.cache'.
+ # It is safe to delete the contents: the tools regenerate it.
+ # (The old setting 'cache' is still respected if neither of
+ # these new ones is present.)
+ # N.B. If obtain_device_list_from_udev is set to 1 the list of
+ # devices is instead obtained from udev and any existing .cache
+ # file is removed.
+ cache_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@"
+ cache_file_prefix = ""
+
+ # You can turn off writing this cache file by setting this to 0.
+ write_cache_state = 1
+
+ # Advanced settings.
+
+ # List of pairs of additional acceptable block device types found
+ # in /proc/devices with maximum (non-zero) number of partitions.
+ # types = [ "fd", 16 ]
+
+ # If sysfs is mounted (2.6 kernels) restrict device scanning to
+ # the block devices it believes are valid.
+ # 1 enables; 0 disables.
+ sysfs_scan = 1
+
+ # By default, LVM2 will ignore devices used as component paths
+ # of device-mapper multipath devices.
+ # 1 enables; 0 disables.
+ multipath_component_detection = 1
+
+ # By default, LVM2 will ignore devices used as components of
+ # software RAID (md) devices by looking for md superblocks.
+ # 1 enables; 0 disables.
+ md_component_detection = 1
+
+ # By default, if a PV is placed directly upon an md device, LVM2
+ # will align its data blocks with the md device's stripe-width.
+ # 1 enables; 0 disables.
+ md_chunk_alignment = 1
+
+ # Default alignment of the start of a data area in MB. If set to 0,
+ # a value of 64KB will be used. Set to 1 for 1MiB, 2 for 2MiB, etc.
+ # default_data_alignment = @DEFAULT_DATA_ALIGNMENT@
+
+ # By default, the start of a PV's data area will be a multiple of
+ # the 'minimum_io_size' or 'optimal_io_size' exposed in sysfs.
+ # - minimum_io_size - the smallest request the device can perform
+ # w/o incurring a read-modify-write penalty (e.g. MD's chunk size)
+ # - optimal_io_size - the device's preferred unit of receiving I/O
+ # (e.g. MD's stripe width)
+ # minimum_io_size is used if optimal_io_size is undefined (0).
+ # If md_chunk_alignment is enabled, that detects the optimal_io_size.
+ # This setting takes precedence over md_chunk_alignment.
+ # 1 enables; 0 disables.
+ data_alignment_detection = 1
+
+ # Alignment (in KB) of start of data area when creating a new PV.
+ # md_chunk_alignment and data_alignment_detection are disabled if set.
+ # Set to 0 for the default alignment (see: data_alignment_default)
+ # or page size, if larger.
+ data_alignment = 0
+
+ # By default, the start of the PV's aligned data area will be shifted by
+ # the 'alignment_offset' exposed in sysfs. This offset is often 0 but
+ # may be non-zero; e.g.: certain 4KB sector drives that compensate for
+ # windows partitioning will have an alignment_offset of 3584 bytes
+ # (sector 7 is the lowest aligned logical block, the 4KB sectors start
+ # at LBA -1, and consequently sector 63 is aligned on a 4KB boundary).
+ # But note that pvcreate --dataalignmentoffset will skip this detection.
+ # 1 enables; 0 disables.
+ data_alignment_offset_detection = 1
+
+ # If, while scanning the system for PVs, LVM2 encounters a device-mapper
+ # device that has its I/O suspended, it waits for it to become accessible.
+ # Set this to 1 to skip such devices. This should only be needed
+ # in recovery situations.
+ ignore_suspended_devices = 0
+
+ # During each LVM operation errors received from each device are counted.
+ # If the counter of a particular device exceeds the limit set here, no
+ # further I/O is sent to that device for the remainder of the respective
+ # operation. Setting the parameter to 0 disables the counters altogether.
+ disable_after_error_count = 0
+
+ # Allow use of pvcreate --uuid without requiring --restorefile.
+ require_restorefile_with_uuid = 1
+
+ # Minimum size (in KB) of block devices which can be used as PVs.
+ # In a clustered environment all nodes must use the same value.
+ # Any value smaller than 512KB is ignored.
+
+ # Ignore devices smaller than 2MB such as floppy drives.
+ pv_min_size = 2048
+
+ # The original built-in setting was 512 up to and including version 2.02.84.
+ # pv_min_size = 512
+
+ # Issue discards to a logical volumes's underlying physical volume(s) when
+ # the logical volume is no longer using the physical volumes' space (e.g.
+ # lvremove, lvreduce, etc). Discards inform the storage that a region is
+ # no longer in use. Storage that supports discards advertise the protocol
+ # specific way discards should be issued by the kernel (TRIM, UNMAP, or
+ # WRITE SAME with UNMAP bit set). Not all storage will support or benefit
+ # from discards but SSDs and thinly provisioned LUNs generally do. If set
+ # to 1, discards will only be issued if both the storage and kernel provide
+ # support.
+ # 1 enables; 0 disables.
+ issue_discards = 0
+}
+
+# This section allows you to configure the way in which LVM selects
+# free space for its Logical Volumes.
+allocation {
+
+ # When searching for free space to extend an LV, the "cling"
+ # allocation policy will choose space on the same PVs as the last
+ # segment of the existing LV. If there is insufficient space and a
+ # list of tags is defined here, it will check whether any of them are
+ # attached to the PVs concerned and then seek to match those PV tags
+ # between existing extents and new extents.
+ # Use the special tag "@*" as a wildcard to match any PV tag.
+
+ # Example: LVs are mirrored between two sites within a single VG.
+ # PVs are tagged with either @site1 or @site2 to indicate where
+ # they are situated.
+
+ # cling_tag_list = [ "@site1", "@site2" ]
+ # cling_tag_list = [ "@*" ]
+
+ # Changes made in version 2.02.85 extended the reach of the 'cling'
+ # policies to detect more situations where data can be grouped
+ # onto the same disks. Set this to 0 to revert to the previous
+ # algorithm.
+ maximise_cling = 1
+
+ # Set to 1 to guarantee that mirror logs will always be placed on
+ # different PVs from the mirror images. This was the default
+ # until version 2.02.85.
+ mirror_logs_require_separate_pvs = 0
+
+ # Set to 1 to guarantee that thin pool metadata will always
+ # be placed on different PVs from the pool data.
+ thin_pool_metadata_require_separate_pvs = 0
+
+ # Specify the minimal chunk size (in KB) for thin pool volumes.
+ # Use of the larger chunk size may improve perfomance for plain
+ # thin volumes, however using them for snapshot volumes is less efficient,
+ # as it consumes more space and takes extra time for copying.
+ # When unset, lvm tries to estimate chunk size starting from 64KB
+ # Supported values are in range from 64 to 1048576.
+ # thin_pool_chunk_size = 64
+
+ # Specify discards behavior of the thin pool volume.
+ # Select one of "ignore", "nopassdown", "passdown"
+ # thin_pool_discards = "passdown"
+
+ # Set to 0, to disable zeroing of thin pool data chunks before their
+ # first use.
+ # N.B. zeroing larger thin pool chunk size degrades performance.
+ # thin_pool_zero = 1
+}
+
+# This section that allows you to configure the nature of the
+# information that LVM2 reports.
+log {
+
+ # Controls the messages sent to stdout or stderr.
+ # There are three levels of verbosity, 3 being the most verbose.
+ verbose = 0
+
+ # Set to 1 to suppress all non-essential messages from stdout.
+ # This has the same effect as -qq.
+ # When this is set, the following commands still produce output:
+ # dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay,
+ # pvs, version, vgcfgrestore -l, vgdisplay, vgs.
+ # Non-essential messages are shifted from log level 4 to log level 5
+ # for syslog and lvm2_log_fn purposes.
+ # Any 'yes' or 'no' questions not overridden by other arguments
+ # are suppressed and default to 'no'.
+ silent = 0
+
+ # Should we send log messages through syslog?
+ # 1 is yes; 0 is no.
+ syslog = 1
+
+ # Should we log error and debug messages to a file?
+ # By default there is no log file.
+ #file = "/var/log/lvm2.log"
+
+ # Should we overwrite the log file each time the program is run?
+ # By default we append.
+ overwrite = 0
+
+ # What level of log messages should we send to the log file and/or syslog?
+ # There are 6 syslog-like log levels currently in use - 2 to 7 inclusive.
+ # 7 is the most verbose (LOG_DEBUG).
+ level = 0
+
+ # Format of output messages
+ # Whether or not (1 or 0) to indent messages according to their severity
+ indent = 1
+
+ # Whether or not (1 or 0) to display the command name on each line output
+ command_names = 0
+
+ # A prefix to use before the message text (but after the command name,
+ # if selected). Default is two spaces, so you can see/grep the severity
+ # of each message.
+ prefix = " "
+
+ # To make the messages look similar to the original LVM tools use:
+ # indent = 0
+ # command_names = 1
+ # prefix = " -- "
+
+ # Set this if you want log messages during activation.
+ # Don't use this in low memory situations (can deadlock).
+ # activation = 0
+
+ # Some debugging messages are assigned to a class and only appear
+ # in debug output if the class is listed here.
+ # Classes currently available:
+ # memory, devices, activation, allocation, lvmetad, metadata, cache,
+ # locking
+ # Use "all" to see everything.
+ debug_classes = [ "memory", "devices", "activation", "allocation",
+ "lvmetad", "metadata", "cache", "locking" ]
+}
+
+# Configuration of metadata backups and archiving. In LVM2 when we
+# talk about a 'backup' we mean making a copy of the metadata for the
+# *current* system. The 'archive' contains old metadata configurations.
+# Backups are stored in a human readeable text format.
+backup {
+
+ # Should we maintain a backup of the current metadata configuration ?
+ # Use 1 for Yes; 0 for No.
+ # Think very hard before turning this off!
+ backup = 1
+
+ # Where shall we keep it ?
+ # Remember to back up this directory regularly!
+ backup_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_BACKUP_SUBDIR@"
+
+ # Should we maintain an archive of old metadata configurations.
+ # Use 1 for Yes; 0 for No.
+ # On by default. Think very hard before turning this off.
+ archive = 1
+
+ # Where should archived files go ?
+ # Remember to back up this directory regularly!
+ archive_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_ARCHIVE_SUBDIR@"
+
+ # What is the minimum number of archive files you wish to keep ?
+ retain_min = 10
+
+ # What is the minimum time you wish to keep an archive file for ?
+ retain_days = 30
+}
+
+# Settings for the running LVM2 in shell (readline) mode.
+shell {
+
+ # Number of lines of history to store in ~/.lvm_history
+ history_size = 100
+}
+
+
+# Miscellaneous global LVM2 settings
+global {
+ # The file creation mask for any files and directories created.
+ # Interpreted as octal if the first digit is zero.
+ umask = 077
+
+ # Allow other users to read the files
+ #umask = 022
+
+ # Enabling test mode means that no changes to the on disk metadata
+ # will be made. Equivalent to having the -t option on every
+ # command. Defaults to off.
+ test = 0
+
+ # Default value for --units argument
+ units = "h"
+
+ # Since version 2.02.54, the tools distinguish between powers of
+ # 1024 bytes (e.g. KiB, MiB, GiB) and powers of 1000 bytes (e.g.
+ # KB, MB, GB).
+ # If you have scripts that depend on the old behaviour, set this to 0
+ # temporarily until you update them.
+ si_unit_consistency = 1
+
+ # Whether or not to communicate with the kernel device-mapper.
+ # Set to 0 if you want to use the tools to manipulate LVM metadata
+ # without activating any logical volumes.
+ # If the device-mapper kernel driver is not present in your kernel
+ # setting this to 0 should suppress the error messages.
+ activation = 1
+
+ # If we can't communicate with device-mapper, should we try running
+ # the LVM1 tools?
+ # This option only applies to 2.4 kernels and is provided to help you
+ # switch between device-mapper kernels and LVM1 kernels.
+ # The LVM1 tools need to be installed with .lvm1 suffices
+ # e.g. vgscan.lvm1 and they will stop working after you start using
+ # the new lvm2 on-disk metadata format.
+ # The default value is set when the tools are built.
+ # fallback_to_lvm1 = 0
+
+ # The default metadata format that commands should use - "lvm1" or "lvm2".
+ # The command line override is -M1 or -M2.
+ # Defaults to "lvm2".
+ # format = "lvm2"
+
+ # Location of proc filesystem
+ proc = "/proc"
+
+ # Type of locking to use. Defaults to local file-based locking (1).
+ # Turn locking off by setting to 0 (dangerous: risks metadata corruption
+ # if LVM2 commands get run concurrently).
+ # Type 2 uses the external shared library locking_library.
+ # Type 3 uses built-in clustered locking.
+ # Type 4 uses read-only locking which forbids any operations that might
+ # change metadata.
+ locking_type = 1
+
+ # Set to 0 to fail when a lock request cannot be satisfied immediately.
+ wait_for_locks = 1
+
+ # If using external locking (type 2) and initialisation fails,
+ # with this set to 1 an attempt will be made to use the built-in
+ # clustered locking.
+ # If you are using a customised locking_library you should set this to 0.
+ fallback_to_clustered_locking = 1
+
+ # If an attempt to initialise type 2 or type 3 locking failed, perhaps
+ # because cluster components such as clvmd are not running, with this set
+ # to 1 an attempt will be made to use local file-based locking (type 1).
+ # If this succeeds, only commands against local volume groups will proceed.
+ # Volume Groups marked as clustered will be ignored.
+ fallback_to_local_locking = 1
+
+ # Local non-LV directory that holds file-based locks while commands are
+ # in progress. A directory like /tmp that may get wiped on reboot is OK.
+ locking_dir = "@DEFAULT_LOCK_DIR@"
+
+ # Whenever there are competing read-only and read-write access requests for
+ # a volume group's metadata, instead of always granting the read-only
+ # requests immediately, delay them to allow the read-write requests to be
+ # serviced. Without this setting, write access may be stalled by a high
+ # volume of read-only requests.
+ # NB. This option only affects locking_type = 1 viz. local file-based
+ # locking.
+ prioritise_write_locks = 1
+
+ # Other entries can go here to allow you to load shared libraries
+ # e.g. if support for LVM1 metadata was compiled as a shared library use
+ # format_libraries = "liblvm2format1.so"
+ # Full pathnames can be given.
+
+ # Search this directory first for shared libraries.
+ # library_dir = "/lib"
+
+ # The external locking library to load if locking_type is set to 2.
+ # locking_library = "liblvm2clusterlock.so"
+
+ # Treat any internal errors as fatal errors, aborting the process that
+ # encountered the internal error. Please only enable for debugging.
+ abort_on_internal_errors = 0
+
+ # Check whether CRC is matching when parsed VG is used multiple times.
+ # This is useful to catch unexpected internal cached volume group
+ # structure modification. Please only enable for debugging.
+ detect_internal_vg_cache_corruption = 0
+
+ # If set to 1, no operations that change on-disk metadata will be permitted.
+ # Additionally, read-only commands that encounter metadata in need of repair
+ # will still be allowed to proceed exactly as if the repair had been
+ # performed (except for the unchanged vg_seqno).
+ # Inappropriate use could mess up your system, so seek advice first!
+ metadata_read_only = 0
+
+ # 'mirror_segtype_default' defines which segtype will be used when the
+ # shorthand '-m' option is used for mirroring. The possible options are:
+ #
+ # "mirror" - The original RAID1 implementation provided by LVM2/DM. It is
+ # characterized by a flexible log solution (core, disk, mirrored)
+ # and by the necessity to block I/O while reconfiguring in the
+ # event of a failure.
+ #
+ # There is an inherent race in the dmeventd failure handling
+ # logic with snapshots of devices using this type of RAID1 that
+ # in the worst case could cause a deadlock.
+ # Ref: https://bugzilla.redhat.com/show_bug.cgi?id=817130#c10
+ #
+ # "raid1" - This implementation leverages MD's RAID1 personality through
+ # device-mapper. It is characterized by a lack of log options.
+ # (A log is always allocated for every device and they are placed
+ # on the same device as the image - no separate devices are
+ # required.) This mirror implementation does not require I/O
+ # to be blocked in the kernel in the event of a failure.
+ # This mirror implementation is not cluster-aware and cannot be
+ # used in a shared (active/active) fashion in a cluster.
+ #
+ # Specify the '--type <mirror|raid1>' option to override this default
+ # setting.
+ mirror_segtype_default = "mirror"
+
+ # 'raid10_segtype_default' determines the segment types used by default
+ # when the '--stripes/-i' and '--mirrors/-m' arguments are both specified
+ # during the creation of a logical volume.
+ # Possible settings include:
+ #
+ # "raid10" - This implementation leverages MD's RAID10 personality through
+ # device-mapper.
+ #
+ # "mirror" - LVM will layer the 'mirror' and 'stripe' segment types. It
+ # will do this by creating a mirror on top of striped sub-LVs;
+ # effectively creating a RAID 0+1 array. This is suboptimal
+ # in terms of providing redunancy and performance. Changing to
+ # this setting is not advised.
+ # Specify the '--type <raid10|mirror>' option to override this default
+ # setting.
+ raid10_segtype_default = "mirror"
+
+ # The default format for displaying LV names in lvdisplay was changed
+ # in version 2.02.89 to show the LV name and path separately.
+ # Previously this was always shown as /dev/vgname/lvname even when that
+ # was never a valid path in the /dev filesystem.
+ # Set to 1 to reinstate the previous format.
+ #
+ # lvdisplay_shows_full_device_path = 0
+
+ # Whether to use (trust) a running instance of lvmetad. If this is set to
+ # 0, all commands fall back to the usual scanning mechanisms. When set to 1
+ # *and* when lvmetad is running (it is not auto-started), the volume group
+ # metadata and PV state flags are obtained from the lvmetad instance and no
+ # scanning is done by the individual commands. In a setup with lvmetad,
+ # lvmetad udev rules *must* be set up for LVM to work correctly. Without
+ # proper udev rules, all changes in block device configuration will be
+ # *ignored* until a manual 'pvscan --cache' is performed.
+ #
+ # If lvmetad has been running while use_lvmetad was 0, it MUST be stopped
+ # before changing use_lvmetad to 1 and started again afterwards.
+ use_lvmetad = 0
+
+ # Full path of the utility called to check that a thin metadata device
+ # is in a state that allows it to be used.
+ # Each time a thin pool needs to be activated or after it is deactivated
+ # this utility is executed. The activation will only proceed if the utility
+ # has an exit status of 0.
+ # Set to "" to skip this check. (Not recommended.)
+ # The thin tools are available as part of the device-mapper-persistent-data
+ # package from https://github.com/jthornber/thin-provisioning-tools.
+ #
+ thin_check_executable = "@THIN_CHECK_CMD@"
+
+ # String with options passed with thin_check command. By default,
+ # option '-q' is for quiet output.
+ thin_check_options = [ "-q" ]
+
+ # If set, given features are not used by thin driver.
+ # This can be helpful not just for testing, but i.e. allows to avoid
+ # using problematic implementation of some thin feature.
+ # Features:
+ # block_size
+ # discards
+ # discards_non_power_2
+ #
+ # thin_disabled_features = [ "discards", "block_size" ]
+}
+
+activation {
+ # Set to 1 to perform internal checks on the operations issued to
+ # libdevmapper. Useful for debugging problems with activation.
+ # Some of the checks may be expensive, so it's best to use this
+ # only when there seems to be a problem.
+ checks = 0
+
+ # Set to 0 to disable udev synchronisation (if compiled into the binaries).
+ # Processes will not wait for notification from udev.
+ # They will continue irrespective of any possible udev processing
+ # in the background. You should only use this if udev is not running
+ # or has rules that ignore the devices LVM2 creates.
+ # The command line argument --nodevsync takes precedence over this setting.
+ # If set to 1 when udev is not running, and there are LVM2 processes
+ # waiting for udev, run 'dmsetup udevcomplete_all' manually to wake them up.
+ udev_sync = 1
+
+ # Set to 0 to disable the udev rules installed by LVM2 (if built with
+ # --enable-udev_rules). LVM2 will then manage the /dev nodes and symlinks
+ # for active logical volumes directly itself.
+ # N.B. Manual intervention may be required if this setting is changed
+ # while any logical volumes are active.
+ udev_rules = 1
+
+ # Set to 1 for LVM2 to verify operations performed by udev. This turns on
+ # additional checks (and if necessary, repairs) on entries in the device
+ # directory after udev has completed processing its events.
+ # Useful for diagnosing problems with LVM2/udev interactions.
+ verify_udev_operations = 0
+
+ # If set to 1 and if deactivation of an LV fails, perhaps because
+ # a process run from a quick udev rule temporarily opened the device,
+ # retry the operation for a few seconds before failing.
+ retry_deactivation = 1
+
+ # How to fill in missing stripes if activating an incomplete volume.
+ # Using "error" will make inaccessible parts of the device return
+ # I/O errors on access. You can instead use a device path, in which
+ # case, that device will be used to in place of missing stripes.
+ # But note that using anything other than "error" with mirrored
+ # or snapshotted volumes is likely to result in data corruption.
+ missing_stripe_filler = "error"
+
+ # The linear target is an optimised version of the striped target
+ # that only handles a single stripe. Set this to 0 to disable this
+ # optimisation and always use the striped target.
+ use_linear_target = 1
+
+ # How much stack (in KB) to reserve for use while devices suspended
+ # Prior to version 2.02.89 this used to be set to 256KB
+ reserved_stack = 64
+
+ # How much memory (in KB) to reserve for use while devices suspended
+ reserved_memory = 8192
+
+ # Nice value used while devices suspended
+ process_priority = -18
+
+ # If volume_list is defined, each LV is only activated if there is a
+ # match against the list.
+ #
+ # "vgname" and "vgname/lvname" are matched exactly.
+ # "@tag" matches any tag set in the LV or VG.
+ # "@*" matches if any tag defined on the host is also set in the LV or VG
+ #
+ # If any host tags exist but volume_list is not defined, a default
+ # single-entry list containing "@*" is assumed.
+ #
+ # volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
+
+ # If auto_activation_volume_list is defined, each LV that is to be
+ # activated with the autoactivation option (--activate ay/-a ay) is
+ # first checked against the list. There are two scenarios in which
+ # the autoactivation option is used:
+ #
+ # - automatic activation of volumes based on incoming PVs. If all the
+ # PVs making up a VG are present in the system, the autoactivation
+ # is triggered. This requires lvmetad (global/use_lvmetad=1) and udev
+ # to be running. In this case, "pvscan --cache -aay" is called
+ # automatically without any user intervention while processing
+ # udev events. Please, make sure you define auto_activation_volume_list
+ # properly so only the volumes you want and expect are autoactivated.
+ #
+ # - direct activation on command line with the autoactivation option.
+ # In this case, the user calls "vgchange --activate ay/-a ay" or
+ # "lvchange --activate ay/-a ay" directly.
+ #
+ # By default, the auto_activation_volume_list is not defined and all
+ # volumes will be activated either automatically or by using --activate ay/-a ay.
+ #
+ # N.B. The "activation/volume_list" is still honoured in all cases so even
+ # if the VG/LV passes the auto_activation_volume_list, it still needs to
+ # pass the volume_list for it to be activated in the end.
+
+ # If auto_activation_volume_list is defined but empty, no volumes will be
+ # activated automatically and --activate ay/-a ay will do nothing.
+ #
+ # auto_activation_volume_list = []
+
+ # If auto_activation_volume_list is defined and it's not empty, only matching
+ # volumes will be activated either automatically or by using --activate ay/-a ay.
+ #
+ # "vgname" and "vgname/lvname" are matched exactly.
+ # "@tag" matches any tag set in the LV or VG.
+ # "@*" matches if any tag defined on the host is also set in the LV or VG
+ #
+ # auto_activation_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
+
+ # If read_only_volume_list is defined, each LV that is to be activated
+ # is checked against the list, and if it matches, it as activated
+ # in read-only mode. (This overrides '--permission rw' stored in the
+ # metadata.)
+ #
+ # "vgname" and "vgname/lvname" are matched exactly.
+ # "@tag" matches any tag set in the LV or VG.
+ # "@*" matches if any tag defined on the host is also set in the LV or VG
+ #
+ # read_only_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
+
+ # For RAID or 'mirror' segment types, 'raid_region_size' is the
+ # size (in kiB) of each:
+ # - synchronization operation when initializing
+ # - each copy operation when performing a 'pvmove' (using 'mirror' segtype)
+ # This setting has replaced 'mirror_region_size' since version 2.02.99
+ raid_region_size = 512
+
+ # Setting to use when there is no readahead value stored in the metadata.
+ #
+ # "none" - Disable readahead.
+ # "auto" - Use default value chosen by kernel.
+ readahead = "auto"
+
+ # 'raid_fault_policy' defines how a device failure in a RAID logical
+ # volume is handled. This includes logical volumes that have the following
+ # segment types: raid1, raid4, raid5*, and raid6*.
+ #
+ # In the event of a failure, the following policies will determine what
+ # actions are performed during the automated response to failures (when
+ # dmeventd is monitoring the RAID logical volume) and when 'lvconvert' is
+ # called manually with the options '--repair' and '--use-policies'.
+ #
+ # "warn" - Use the system log to warn the user that a device in the RAID
+ # logical volume has failed. It is left to the user to run
+ # 'lvconvert --repair' manually to remove or replace the failed
+ # device. As long as the number of failed devices does not
+ # exceed the redundancy of the logical volume (1 device for
+ # raid4/5, 2 for raid6, etc) the logical volume will remain
+ # usable.
+ #
+ # "allocate" - Attempt to use any extra physical volumes in the volume
+ # group as spares and replace faulty devices.
+ #
+ raid_fault_policy = "warn"
+
+ # 'mirror_image_fault_policy' and 'mirror_log_fault_policy' define
+ # how a device failure affecting a mirror (of "mirror" segment type) is
+ # handled. A mirror is composed of mirror images (copies) and a log.
+ # A disk log ensures that a mirror does not need to be re-synced
+ # (all copies made the same) every time a machine reboots or crashes.
+ #
+ # In the event of a failure, the specified policy will be used to determine
+ # what happens. This applies to automatic repairs (when the mirror is being
+ # monitored by dmeventd) and to manual lvconvert --repair when
+ # --use-policies is given.
+ #
+ # "remove" - Simply remove the faulty device and run without it. If
+ # the log device fails, the mirror would convert to using
+ # an in-memory log. This means the mirror will not
+ # remember its sync status across crashes/reboots and
+ # the entire mirror will be re-synced. If a
+ # mirror image fails, the mirror will convert to a
+ # non-mirrored device if there is only one remaining good
+ # copy.
+ #
+ # "allocate" - Remove the faulty device and try to allocate space on
+ # a new device to be a replacement for the failed device.
+ # Using this policy for the log is fast and maintains the
+ # ability to remember sync state through crashes/reboots.
+ # Using this policy for a mirror device is slow, as it
+ # requires the mirror to resynchronize the devices, but it
+ # will preserve the mirror characteristic of the device.
+ # This policy acts like "remove" if no suitable device and
+ # space can be allocated for the replacement.
+ #
+ # "allocate_anywhere" - Not yet implemented. Useful to place the log device
+ # temporarily on same physical volume as one of the mirror
+ # images. This policy is not recommended for mirror devices
+ # since it would break the redundant nature of the mirror. This
+ # policy acts like "remove" if no suitable device and space can
+ # be allocated for the replacement.
+
+ mirror_log_fault_policy = "allocate"
+ mirror_image_fault_policy = "remove"
+
+ # 'snapshot_autoextend_threshold' and 'snapshot_autoextend_percent' define
+ # how to handle automatic snapshot extension. The former defines when the
+ # snapshot should be extended: when its space usage exceeds this many
+ # percent. The latter defines how much extra space should be allocated for
+ # the snapshot, in percent of its current size.
+ #
+ # For example, if you set snapshot_autoextend_threshold to 70 and
+ # snapshot_autoextend_percent to 20, whenever a snapshot exceeds 70% usage,
+ # it will be extended by another 20%. For a 1G snapshot, using up 700M will
+ # trigger a resize to 1.2G. When the usage exceeds 840M, the snapshot will
+ # be extended to 1.44G, and so on.
+ #
+ # Setting snapshot_autoextend_threshold to 100 disables automatic
+ # extensions. The minimum value is 50 (A setting below 50 will be treated
+ # as 50).
+
+ snapshot_autoextend_threshold = 100
+ snapshot_autoextend_percent = 20
+
+ # 'thin_pool_autoextend_threshold' and 'thin_pool_autoextend_percent' define
+ # how to handle automatic pool extension. The former defines when the
+ # pool should be extended: when its space usage exceeds this many
+ # percent. The latter defines how much extra space should be allocated for
+ # the pool, in percent of its current size.
+ #
+ # For example, if you set thin_pool_autoextend_threshold to 70 and
+ # thin_pool_autoextend_percent to 20, whenever a pool exceeds 70% usage,
+ # it will be extended by another 20%. For a 1G pool, using up 700M will
+ # trigger a resize to 1.2G. When the usage exceeds 840M, the pool will
+ # be extended to 1.44G, and so on.
+ #
+ # Setting thin_pool_autoextend_threshold to 100 disables automatic
+ # extensions. The minimum value is 50 (A setting below 50 will be treated
+ # as 50).
+
+ thin_pool_autoextend_threshold = 100
+ thin_pool_autoextend_percent = 20
+
+ # While activating devices, I/O to devices being (re)configured is
+ # suspended, and as a precaution against deadlocks, LVM2 needs to pin
+ # any memory it is using so it is not paged out. Groups of pages that
+ # are known not to be accessed during activation need not be pinned
+ # into memory. Each string listed in this setting is compared against
+ # each line in /proc/self/maps, and the pages corresponding to any
+ # lines that match are not pinned. On some systems locale-archive was
+ # found to make up over 80% of the memory used by the process.
+ # mlock_filter = [ "locale/locale-archive", "gconv/gconv-modules.cache" ]
+
+ # Set to 1 to revert to the default behaviour prior to version 2.02.62
+ # which used mlockall() to pin the whole process's memory while activating
+ # devices.
+ use_mlockall = 0
+
+ # Monitoring is enabled by default when activating logical volumes.
+ # Set to 0 to disable monitoring or use the --ignoremonitoring option.
+ monitoring = 1
+
+ # When pvmove or lvconvert must wait for the kernel to finish
+ # synchronising or merging data, they check and report progress
+ # at intervals of this number of seconds. The default is 15 seconds.
+ # If this is set to 0 and there is only one thing to wait for, there
+ # are no progress reports, but the process is awoken immediately the
+ # operation is complete.
+ polling_interval = 15
+}
+
+
+####################
+# Advanced section #
+####################
+
+# Metadata settings
+#
+# metadata {
+ # Default number of copies of metadata to hold on each PV. 0, 1 or 2.
+ # You might want to override it from the command line with 0
+ # when running pvcreate on new PVs which are to be added to large VGs.
+
+ # pvmetadatacopies = 1
+
+ # Default number of copies of metadata to maintain for each VG.
+ # If set to a non-zero value, LVM automatically chooses which of
+ # the available metadata areas to use to achieve the requested
+ # number of copies of the VG metadata. If you set a value larger
+ # than the the total number of metadata areas available then
+ # metadata is stored in them all.
+ # The default value of 0 ("unmanaged") disables this automatic
+ # management and allows you to control which metadata areas
+ # are used at the individual PV level using 'pvchange
+ # --metadataignore y/n'.
+
+ # vgmetadatacopies = 0
+
+ # Approximate default size of on-disk metadata areas in sectors.
+ # You should increase this if you have large volume groups or
+ # you want to retain a large on-disk history of your metadata changes.
+
+ # pvmetadatasize = 255
+
+ # List of directories holding live copies of text format metadata.
+ # These directories must not be on logical volumes!
+ # It's possible to use LVM2 with a couple of directories here,
+ # preferably on different (non-LV) filesystems, and with no other
+ # on-disk metadata (pvmetadatacopies = 0). Or this can be in
+ # addition to on-disk metadata areas.
+ # The feature was originally added to simplify testing and is not
+ # supported under low memory situations - the machine could lock up.
+ #
+ # Never edit any files in these directories by hand unless you
+ # you are absolutely sure you know what you are doing! Use
+ # the supplied toolset to make changes (e.g. vgcfgrestore).
+
+ # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]
+#}
+
+# Event daemon
+#
+dmeventd {
+ # mirror_library is the library used when monitoring a mirror device.
+ #
+ # "libdevmapper-event-lvm2mirror.so" attempts to recover from
+ # failures. It removes failed devices from a volume group and
+ # reconfigures a mirror as necessary. If no mirror library is
+ # provided, mirrors are not monitored through dmeventd.
+
+ mirror_library = "libdevmapper-event-lvm2mirror.so"
+
+ # snapshot_library is the library used when monitoring a snapshot device.
+ #
+ # "libdevmapper-event-lvm2snapshot.so" monitors the filling of
+ # snapshots and emits a warning through syslog when the use of
+ # the snapshot exceeds 80%. The warning is repeated when 85%, 90% and
+ # 95% of the snapshot is filled.
+
+ snapshot_library = "libdevmapper-event-lvm2snapshot.so"
+
+ # thin_library is the library used when monitoring a thin device.
+ #
+ # "libdevmapper-event-lvm2thin.so" monitors the filling of
+ # pool and emits a warning through syslog when the use of
+ # the pool exceeds 80%. The warning is repeated when 85%, 90% and
+ # 95% of the pool is filled.
+
+ thin_library = "libdevmapper-event-lvm2thin.so"
+
+ # Full path of the dmeventd binary.
+ #
+ # executable = "@DMEVENTD_PATH@"
+}
diff --git a/configure b/configure
index 8a1db74..aeb2b46 100755
--- a/configure
+++ b/configure
@@ -10810,7 +10810,7 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'`
################################################################################
-ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/lvmetad/Makefile doc/Makefile doc/example.conf include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/replicator/Makefile lib/misc/lvm-version.h lib/raid/Makefile lib/snapshot/Makefile lib/thin/Makefile libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/bl
k_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/dm_event_systemd_red_hat.socket scripts/dm_event_systemd_red_hat.service scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_tmpfiles_red_hat.conf scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
+ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/lvmetad/Makefile conf/Makefile conf/example.conf include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/replicator/Makefile lib/misc/lvm-version.h lib/raid/Makefile lib/snapshot/Makefile lib/thin/Makefile libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/
blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/dm_event_systemd_red_hat.socket scripts/dm_event_systemd_red_hat.service scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_tmpfiles_red_hat.conf scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -11513,8 +11513,8 @@ do
"daemons/dmeventd/plugins/snapshot/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/dmeventd/plugins/snapshot/Makefile" ;;
"daemons/dmeventd/plugins/thin/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/dmeventd/plugins/thin/Makefile" ;;
"daemons/lvmetad/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmetad/Makefile" ;;
- "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
- "doc/example.conf") CONFIG_FILES="$CONFIG_FILES doc/example.conf" ;;
+ "conf/Makefile") CONFIG_FILES="$CONFIG_FILES conf/Makefile" ;;
+ "conf/example.conf") CONFIG_FILES="$CONFIG_FILES conf/example.conf" ;;
"include/.symlinks") CONFIG_FILES="$CONFIG_FILES include/.symlinks" ;;
"include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
"lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
diff --git a/configure.in b/configure.in
index d90eb1a..77a0503 100644
--- a/configure.in
+++ b/configure.in
@@ -1640,8 +1640,8 @@ daemons/dmeventd/plugins/mirror/Makefile
daemons/dmeventd/plugins/snapshot/Makefile
daemons/dmeventd/plugins/thin/Makefile
daemons/lvmetad/Makefile
-doc/Makefile
-doc/example.conf
+conf/Makefile
+conf/example.conf
include/.symlinks
include/Makefile
lib/Makefile
diff --git a/doc/Makefile.in b/doc/Makefile.in
deleted file mode 100644
index c63e3ce..0000000
--- a/doc/Makefile.in
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
-#
-# This file is part of LVM2.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions
-# of the GNU General Public License v.2.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-top_builddir = @top_builddir@
-
-CONFSRC=example.conf
-CONFDEST=lvm.conf
-
-include $(top_builddir)/make.tmpl
-
-install_lvm2: $(CONFSRC)
- @if [ ! -e $(confdir)/$(CONFDEST) ]; then \
- echo "$(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST)"; \
- $(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST); \
- fi
-
-install: install_lvm2
-
-DISTCLEAN_TARGETS += $(CONFSRC)
diff --git a/doc/example.conf.in b/doc/example.conf.in
deleted file mode 100644
index 3bc8c3c..0000000
--- a/doc/example.conf.in
+++ /dev/null
@@ -1,923 +0,0 @@
-# This is an example configuration file for the LVM2 system.
-# It contains the default settings that would be used if there was no
-# @DEFAULT_SYS_DIR(a)/lvm.conf file.
-#
-# Refer to 'man lvm.conf' for further information including the file layout.
-#
-# To put this file in a different directory and override @DEFAULT_SYS_DIR@ set
-# the environment variable LVM_SYSTEM_DIR before running the tools.
-#
-# N.B. Take care that each setting only appears once if uncommenting
-# example settings in this file.
-
-# 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
-
- # Directory where LVM looks for configuration profiles.
- profile_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_PROFILE_SUBDIR"
-}
-
-# This section allows you to configure which block devices should
-# be used by the LVM system.
-devices {
-
- # Where do you want your volume groups to appear ?
- dir = "/dev"
-
- # An array of directories that contain the device nodes you wish
- # to use with LVM2.
- scan = [ "/dev" ]
-
- # If set, the cache of block device nodes with all associated symlinks
- # will be constructed out of the existing udev database content.
- # This avoids using and opening any inapplicable non-block devices or
- # subdirectories found in the device directory. This setting is applied
- # to udev-managed device directory only, other directories will be scanned
- # fully. LVM2 needs to be compiled with udev support for this setting to
- # take effect. N.B. Any device node or symlink not managed by udev in
- # udev directory will be ignored with this setting on.
- obtain_device_list_from_udev = 1
-
- # If several entries in the scanned directories correspond to the
- # same block device and the tools need to display a name for device,
- # all the pathnames are matched against each item in the following
- # list of regular expressions in turn and the first match is used.
- preferred_names = [ ]
-
- # Try to avoid using undescriptive /dev/dm-N names, if present.
- # preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
-
- # A filter that tells LVM2 to only use a restricted set of devices.
- # The filter consists of an array of regular expressions. These
- # expressions can be delimited by a character of your choice, and
- # prefixed with either an 'a' (for accept) or 'r' (for reject).
- # The first expression found to match a device name determines if
- # the device will be accepted or rejected (ignored). Devices that
- # don't match any patterns are accepted.
-
- # Be careful if there there are symbolic links or multiple filesystem
- # entries for the same device as each name is checked separately against
- # the list of patterns. The effect is that if the first pattern in the
- # list to match a name is an 'a' pattern for any of the names, the device
- # is accepted; otherwise if the first pattern in the list to match a name
- # is an 'r' pattern for any of the names it is rejected; otherwise it is
- # accepted.
-
- # Don't have more than one filter line active at once: only one gets used.
-
- # Run vgscan after you change this parameter to ensure that
- # the cache file gets regenerated (see below).
- # If it doesn't do what you expect, check the output of 'vgscan -vvvv'.
-
-
- # By default we accept every block device:
- filter = [ "a/.*/" ]
-
- # Exclude the cdrom drive
- # filter = [ "r|/dev/cdrom|" ]
-
- # When testing I like to work with just loopback devices:
- # filter = [ "a/loop/", "r/.*/" ]
-
- # Or maybe all loops and ide drives except hdc:
- # filter =[ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ]
-
- # Use anchors if you want to be really specific
- # filter = [ "a|^/dev/hda8$|", "r/.*/" ]
-
- # Since "filter" is often overridden from command line, it is not suitable
- # for system-wide device filtering (udev rules, lvmetad). To hide devices
- # from LVM-specific udev processing and/or from lvmetad, you need to set
- # global_filter. The syntax is the same as for normal "filter"
- # above. Devices that fail the global_filter are not even opened by LVM.
-
- # global_filter = []
-
- # The results of the filtering are cached on disk to avoid
- # rescanning dud devices (which can take a very long time).
- # By default this cache is stored in the @DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@ directory
- # in a file called '.cache'.
- # It is safe to delete the contents: the tools regenerate it.
- # (The old setting 'cache' is still respected if neither of
- # these new ones is present.)
- # N.B. If obtain_device_list_from_udev is set to 1 the list of
- # devices is instead obtained from udev and any existing .cache
- # file is removed.
- cache_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@"
- cache_file_prefix = ""
-
- # You can turn off writing this cache file by setting this to 0.
- write_cache_state = 1
-
- # Advanced settings.
-
- # List of pairs of additional acceptable block device types found
- # in /proc/devices with maximum (non-zero) number of partitions.
- # types = [ "fd", 16 ]
-
- # If sysfs is mounted (2.6 kernels) restrict device scanning to
- # the block devices it believes are valid.
- # 1 enables; 0 disables.
- sysfs_scan = 1
-
- # By default, LVM2 will ignore devices used as component paths
- # of device-mapper multipath devices.
- # 1 enables; 0 disables.
- multipath_component_detection = 1
-
- # By default, LVM2 will ignore devices used as components of
- # software RAID (md) devices by looking for md superblocks.
- # 1 enables; 0 disables.
- md_component_detection = 1
-
- # By default, if a PV is placed directly upon an md device, LVM2
- # will align its data blocks with the md device's stripe-width.
- # 1 enables; 0 disables.
- md_chunk_alignment = 1
-
- # Default alignment of the start of a data area in MB. If set to 0,
- # a value of 64KB will be used. Set to 1 for 1MiB, 2 for 2MiB, etc.
- # default_data_alignment = @DEFAULT_DATA_ALIGNMENT@
-
- # By default, the start of a PV's data area will be a multiple of
- # the 'minimum_io_size' or 'optimal_io_size' exposed in sysfs.
- # - minimum_io_size - the smallest request the device can perform
- # w/o incurring a read-modify-write penalty (e.g. MD's chunk size)
- # - optimal_io_size - the device's preferred unit of receiving I/O
- # (e.g. MD's stripe width)
- # minimum_io_size is used if optimal_io_size is undefined (0).
- # If md_chunk_alignment is enabled, that detects the optimal_io_size.
- # This setting takes precedence over md_chunk_alignment.
- # 1 enables; 0 disables.
- data_alignment_detection = 1
-
- # Alignment (in KB) of start of data area when creating a new PV.
- # md_chunk_alignment and data_alignment_detection are disabled if set.
- # Set to 0 for the default alignment (see: data_alignment_default)
- # or page size, if larger.
- data_alignment = 0
-
- # By default, the start of the PV's aligned data area will be shifted by
- # the 'alignment_offset' exposed in sysfs. This offset is often 0 but
- # may be non-zero; e.g.: certain 4KB sector drives that compensate for
- # windows partitioning will have an alignment_offset of 3584 bytes
- # (sector 7 is the lowest aligned logical block, the 4KB sectors start
- # at LBA -1, and consequently sector 63 is aligned on a 4KB boundary).
- # But note that pvcreate --dataalignmentoffset will skip this detection.
- # 1 enables; 0 disables.
- data_alignment_offset_detection = 1
-
- # If, while scanning the system for PVs, LVM2 encounters a device-mapper
- # device that has its I/O suspended, it waits for it to become accessible.
- # Set this to 1 to skip such devices. This should only be needed
- # in recovery situations.
- ignore_suspended_devices = 0
-
- # During each LVM operation errors received from each device are counted.
- # If the counter of a particular device exceeds the limit set here, no
- # further I/O is sent to that device for the remainder of the respective
- # operation. Setting the parameter to 0 disables the counters altogether.
- disable_after_error_count = 0
-
- # Allow use of pvcreate --uuid without requiring --restorefile.
- require_restorefile_with_uuid = 1
-
- # Minimum size (in KB) of block devices which can be used as PVs.
- # In a clustered environment all nodes must use the same value.
- # Any value smaller than 512KB is ignored.
-
- # Ignore devices smaller than 2MB such as floppy drives.
- pv_min_size = 2048
-
- # The original built-in setting was 512 up to and including version 2.02.84.
- # pv_min_size = 512
-
- # Issue discards to a logical volumes's underlying physical volume(s) when
- # the logical volume is no longer using the physical volumes' space (e.g.
- # lvremove, lvreduce, etc). Discards inform the storage that a region is
- # no longer in use. Storage that supports discards advertise the protocol
- # specific way discards should be issued by the kernel (TRIM, UNMAP, or
- # WRITE SAME with UNMAP bit set). Not all storage will support or benefit
- # from discards but SSDs and thinly provisioned LUNs generally do. If set
- # to 1, discards will only be issued if both the storage and kernel provide
- # support.
- # 1 enables; 0 disables.
- issue_discards = 0
-}
-
-# This section allows you to configure the way in which LVM selects
-# free space for its Logical Volumes.
-allocation {
-
- # When searching for free space to extend an LV, the "cling"
- # allocation policy will choose space on the same PVs as the last
- # segment of the existing LV. If there is insufficient space and a
- # list of tags is defined here, it will check whether any of them are
- # attached to the PVs concerned and then seek to match those PV tags
- # between existing extents and new extents.
- # Use the special tag "@*" as a wildcard to match any PV tag.
-
- # Example: LVs are mirrored between two sites within a single VG.
- # PVs are tagged with either @site1 or @site2 to indicate where
- # they are situated.
-
- # cling_tag_list = [ "@site1", "@site2" ]
- # cling_tag_list = [ "@*" ]
-
- # Changes made in version 2.02.85 extended the reach of the 'cling'
- # policies to detect more situations where data can be grouped
- # onto the same disks. Set this to 0 to revert to the previous
- # algorithm.
- maximise_cling = 1
-
- # Set to 1 to guarantee that mirror logs will always be placed on
- # different PVs from the mirror images. This was the default
- # until version 2.02.85.
- mirror_logs_require_separate_pvs = 0
-
- # Set to 1 to guarantee that thin pool metadata will always
- # be placed on different PVs from the pool data.
- thin_pool_metadata_require_separate_pvs = 0
-
- # Specify the minimal chunk size (in KB) for thin pool volumes.
- # Use of the larger chunk size may improve perfomance for plain
- # thin volumes, however using them for snapshot volumes is less efficient,
- # as it consumes more space and takes extra time for copying.
- # When unset, lvm tries to estimate chunk size starting from 64KB
- # Supported values are in range from 64 to 1048576.
- # thin_pool_chunk_size = 64
-
- # Specify discards behavior of the thin pool volume.
- # Select one of "ignore", "nopassdown", "passdown"
- # thin_pool_discards = "passdown"
-
- # Set to 0, to disable zeroing of thin pool data chunks before their
- # first use.
- # N.B. zeroing larger thin pool chunk size degrades performance.
- # thin_pool_zero = 1
-}
-
-# This section that allows you to configure the nature of the
-# information that LVM2 reports.
-log {
-
- # Controls the messages sent to stdout or stderr.
- # There are three levels of verbosity, 3 being the most verbose.
- verbose = 0
-
- # Set to 1 to suppress all non-essential messages from stdout.
- # This has the same effect as -qq.
- # When this is set, the following commands still produce output:
- # dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay,
- # pvs, version, vgcfgrestore -l, vgdisplay, vgs.
- # Non-essential messages are shifted from log level 4 to log level 5
- # for syslog and lvm2_log_fn purposes.
- # Any 'yes' or 'no' questions not overridden by other arguments
- # are suppressed and default to 'no'.
- silent = 0
-
- # Should we send log messages through syslog?
- # 1 is yes; 0 is no.
- syslog = 1
-
- # Should we log error and debug messages to a file?
- # By default there is no log file.
- #file = "/var/log/lvm2.log"
-
- # Should we overwrite the log file each time the program is run?
- # By default we append.
- overwrite = 0
-
- # What level of log messages should we send to the log file and/or syslog?
- # There are 6 syslog-like log levels currently in use - 2 to 7 inclusive.
- # 7 is the most verbose (LOG_DEBUG).
- level = 0
-
- # Format of output messages
- # Whether or not (1 or 0) to indent messages according to their severity
- indent = 1
-
- # Whether or not (1 or 0) to display the command name on each line output
- command_names = 0
-
- # A prefix to use before the message text (but after the command name,
- # if selected). Default is two spaces, so you can see/grep the severity
- # of each message.
- prefix = " "
-
- # To make the messages look similar to the original LVM tools use:
- # indent = 0
- # command_names = 1
- # prefix = " -- "
-
- # Set this if you want log messages during activation.
- # Don't use this in low memory situations (can deadlock).
- # activation = 0
-
- # Some debugging messages are assigned to a class and only appear
- # in debug output if the class is listed here.
- # Classes currently available:
- # memory, devices, activation, allocation, lvmetad, metadata, cache,
- # locking
- # Use "all" to see everything.
- debug_classes = [ "memory", "devices", "activation", "allocation",
- "lvmetad", "metadata", "cache", "locking" ]
-}
-
-# Configuration of metadata backups and archiving. In LVM2 when we
-# talk about a 'backup' we mean making a copy of the metadata for the
-# *current* system. The 'archive' contains old metadata configurations.
-# Backups are stored in a human readeable text format.
-backup {
-
- # Should we maintain a backup of the current metadata configuration ?
- # Use 1 for Yes; 0 for No.
- # Think very hard before turning this off!
- backup = 1
-
- # Where shall we keep it ?
- # Remember to back up this directory regularly!
- backup_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_BACKUP_SUBDIR@"
-
- # Should we maintain an archive of old metadata configurations.
- # Use 1 for Yes; 0 for No.
- # On by default. Think very hard before turning this off.
- archive = 1
-
- # Where should archived files go ?
- # Remember to back up this directory regularly!
- archive_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_ARCHIVE_SUBDIR@"
-
- # What is the minimum number of archive files you wish to keep ?
- retain_min = 10
-
- # What is the minimum time you wish to keep an archive file for ?
- retain_days = 30
-}
-
-# Settings for the running LVM2 in shell (readline) mode.
-shell {
-
- # Number of lines of history to store in ~/.lvm_history
- history_size = 100
-}
-
-
-# Miscellaneous global LVM2 settings
-global {
- # The file creation mask for any files and directories created.
- # Interpreted as octal if the first digit is zero.
- umask = 077
-
- # Allow other users to read the files
- #umask = 022
-
- # Enabling test mode means that no changes to the on disk metadata
- # will be made. Equivalent to having the -t option on every
- # command. Defaults to off.
- test = 0
-
- # Default value for --units argument
- units = "h"
-
- # Since version 2.02.54, the tools distinguish between powers of
- # 1024 bytes (e.g. KiB, MiB, GiB) and powers of 1000 bytes (e.g.
- # KB, MB, GB).
- # If you have scripts that depend on the old behaviour, set this to 0
- # temporarily until you update them.
- si_unit_consistency = 1
-
- # Whether or not to communicate with the kernel device-mapper.
- # Set to 0 if you want to use the tools to manipulate LVM metadata
- # without activating any logical volumes.
- # If the device-mapper kernel driver is not present in your kernel
- # setting this to 0 should suppress the error messages.
- activation = 1
-
- # If we can't communicate with device-mapper, should we try running
- # the LVM1 tools?
- # This option only applies to 2.4 kernels and is provided to help you
- # switch between device-mapper kernels and LVM1 kernels.
- # The LVM1 tools need to be installed with .lvm1 suffices
- # e.g. vgscan.lvm1 and they will stop working after you start using
- # the new lvm2 on-disk metadata format.
- # The default value is set when the tools are built.
- # fallback_to_lvm1 = 0
-
- # The default metadata format that commands should use - "lvm1" or "lvm2".
- # The command line override is -M1 or -M2.
- # Defaults to "lvm2".
- # format = "lvm2"
-
- # Location of proc filesystem
- proc = "/proc"
-
- # Type of locking to use. Defaults to local file-based locking (1).
- # Turn locking off by setting to 0 (dangerous: risks metadata corruption
- # if LVM2 commands get run concurrently).
- # Type 2 uses the external shared library locking_library.
- # Type 3 uses built-in clustered locking.
- # Type 4 uses read-only locking which forbids any operations that might
- # change metadata.
- locking_type = 1
-
- # Set to 0 to fail when a lock request cannot be satisfied immediately.
- wait_for_locks = 1
-
- # If using external locking (type 2) and initialisation fails,
- # with this set to 1 an attempt will be made to use the built-in
- # clustered locking.
- # If you are using a customised locking_library you should set this to 0.
- fallback_to_clustered_locking = 1
-
- # If an attempt to initialise type 2 or type 3 locking failed, perhaps
- # because cluster components such as clvmd are not running, with this set
- # to 1 an attempt will be made to use local file-based locking (type 1).
- # If this succeeds, only commands against local volume groups will proceed.
- # Volume Groups marked as clustered will be ignored.
- fallback_to_local_locking = 1
-
- # Local non-LV directory that holds file-based locks while commands are
- # in progress. A directory like /tmp that may get wiped on reboot is OK.
- locking_dir = "@DEFAULT_LOCK_DIR@"
-
- # Whenever there are competing read-only and read-write access requests for
- # a volume group's metadata, instead of always granting the read-only
- # requests immediately, delay them to allow the read-write requests to be
- # serviced. Without this setting, write access may be stalled by a high
- # volume of read-only requests.
- # NB. This option only affects locking_type = 1 viz. local file-based
- # locking.
- prioritise_write_locks = 1
-
- # Other entries can go here to allow you to load shared libraries
- # e.g. if support for LVM1 metadata was compiled as a shared library use
- # format_libraries = "liblvm2format1.so"
- # Full pathnames can be given.
-
- # Search this directory first for shared libraries.
- # library_dir = "/lib"
-
- # The external locking library to load if locking_type is set to 2.
- # locking_library = "liblvm2clusterlock.so"
-
- # Treat any internal errors as fatal errors, aborting the process that
- # encountered the internal error. Please only enable for debugging.
- abort_on_internal_errors = 0
-
- # Check whether CRC is matching when parsed VG is used multiple times.
- # This is useful to catch unexpected internal cached volume group
- # structure modification. Please only enable for debugging.
- detect_internal_vg_cache_corruption = 0
-
- # If set to 1, no operations that change on-disk metadata will be permitted.
- # Additionally, read-only commands that encounter metadata in need of repair
- # will still be allowed to proceed exactly as if the repair had been
- # performed (except for the unchanged vg_seqno).
- # Inappropriate use could mess up your system, so seek advice first!
- metadata_read_only = 0
-
- # 'mirror_segtype_default' defines which segtype will be used when the
- # shorthand '-m' option is used for mirroring. The possible options are:
- #
- # "mirror" - The original RAID1 implementation provided by LVM2/DM. It is
- # characterized by a flexible log solution (core, disk, mirrored)
- # and by the necessity to block I/O while reconfiguring in the
- # event of a failure.
- #
- # There is an inherent race in the dmeventd failure handling
- # logic with snapshots of devices using this type of RAID1 that
- # in the worst case could cause a deadlock.
- # Ref: https://bugzilla.redhat.com/show_bug.cgi?id=817130#c10
- #
- # "raid1" - This implementation leverages MD's RAID1 personality through
- # device-mapper. It is characterized by a lack of log options.
- # (A log is always allocated for every device and they are placed
- # on the same device as the image - no separate devices are
- # required.) This mirror implementation does not require I/O
- # to be blocked in the kernel in the event of a failure.
- # This mirror implementation is not cluster-aware and cannot be
- # used in a shared (active/active) fashion in a cluster.
- #
- # Specify the '--type <mirror|raid1>' option to override this default
- # setting.
- mirror_segtype_default = "mirror"
-
- # 'raid10_segtype_default' determines the segment types used by default
- # when the '--stripes/-i' and '--mirrors/-m' arguments are both specified
- # during the creation of a logical volume.
- # Possible settings include:
- #
- # "raid10" - This implementation leverages MD's RAID10 personality through
- # device-mapper.
- #
- # "mirror" - LVM will layer the 'mirror' and 'stripe' segment types. It
- # will do this by creating a mirror on top of striped sub-LVs;
- # effectively creating a RAID 0+1 array. This is suboptimal
- # in terms of providing redunancy and performance. Changing to
- # this setting is not advised.
- # Specify the '--type <raid10|mirror>' option to override this default
- # setting.
- raid10_segtype_default = "mirror"
-
- # The default format for displaying LV names in lvdisplay was changed
- # in version 2.02.89 to show the LV name and path separately.
- # Previously this was always shown as /dev/vgname/lvname even when that
- # was never a valid path in the /dev filesystem.
- # Set to 1 to reinstate the previous format.
- #
- # lvdisplay_shows_full_device_path = 0
-
- # Whether to use (trust) a running instance of lvmetad. If this is set to
- # 0, all commands fall back to the usual scanning mechanisms. When set to 1
- # *and* when lvmetad is running (it is not auto-started), the volume group
- # metadata and PV state flags are obtained from the lvmetad instance and no
- # scanning is done by the individual commands. In a setup with lvmetad,
- # lvmetad udev rules *must* be set up for LVM to work correctly. Without
- # proper udev rules, all changes in block device configuration will be
- # *ignored* until a manual 'pvscan --cache' is performed.
- #
- # If lvmetad has been running while use_lvmetad was 0, it MUST be stopped
- # before changing use_lvmetad to 1 and started again afterwards.
- use_lvmetad = 0
-
- # Full path of the utility called to check that a thin metadata device
- # is in a state that allows it to be used.
- # Each time a thin pool needs to be activated or after it is deactivated
- # this utility is executed. The activation will only proceed if the utility
- # has an exit status of 0.
- # Set to "" to skip this check. (Not recommended.)
- # The thin tools are available as part of the device-mapper-persistent-data
- # package from https://github.com/jthornber/thin-provisioning-tools.
- #
- thin_check_executable = "@THIN_CHECK_CMD@"
-
- # String with options passed with thin_check command. By default,
- # option '-q' is for quiet output.
- thin_check_options = [ "-q" ]
-
- # If set, given features are not used by thin driver.
- # This can be helpful not just for testing, but i.e. allows to avoid
- # using problematic implementation of some thin feature.
- # Features:
- # block_size
- # discards
- # discards_non_power_2
- #
- # thin_disabled_features = [ "discards", "block_size" ]
-}
-
-activation {
- # Set to 1 to perform internal checks on the operations issued to
- # libdevmapper. Useful for debugging problems with activation.
- # Some of the checks may be expensive, so it's best to use this
- # only when there seems to be a problem.
- checks = 0
-
- # Set to 0 to disable udev synchronisation (if compiled into the binaries).
- # Processes will not wait for notification from udev.
- # They will continue irrespective of any possible udev processing
- # in the background. You should only use this if udev is not running
- # or has rules that ignore the devices LVM2 creates.
- # The command line argument --nodevsync takes precedence over this setting.
- # If set to 1 when udev is not running, and there are LVM2 processes
- # waiting for udev, run 'dmsetup udevcomplete_all' manually to wake them up.
- udev_sync = 1
-
- # Set to 0 to disable the udev rules installed by LVM2 (if built with
- # --enable-udev_rules). LVM2 will then manage the /dev nodes and symlinks
- # for active logical volumes directly itself.
- # N.B. Manual intervention may be required if this setting is changed
- # while any logical volumes are active.
- udev_rules = 1
-
- # Set to 1 for LVM2 to verify operations performed by udev. This turns on
- # additional checks (and if necessary, repairs) on entries in the device
- # directory after udev has completed processing its events.
- # Useful for diagnosing problems with LVM2/udev interactions.
- verify_udev_operations = 0
-
- # If set to 1 and if deactivation of an LV fails, perhaps because
- # a process run from a quick udev rule temporarily opened the device,
- # retry the operation for a few seconds before failing.
- retry_deactivation = 1
-
- # How to fill in missing stripes if activating an incomplete volume.
- # Using "error" will make inaccessible parts of the device return
- # I/O errors on access. You can instead use a device path, in which
- # case, that device will be used to in place of missing stripes.
- # But note that using anything other than "error" with mirrored
- # or snapshotted volumes is likely to result in data corruption.
- missing_stripe_filler = "error"
-
- # The linear target is an optimised version of the striped target
- # that only handles a single stripe. Set this to 0 to disable this
- # optimisation and always use the striped target.
- use_linear_target = 1
-
- # How much stack (in KB) to reserve for use while devices suspended
- # Prior to version 2.02.89 this used to be set to 256KB
- reserved_stack = 64
-
- # How much memory (in KB) to reserve for use while devices suspended
- reserved_memory = 8192
-
- # Nice value used while devices suspended
- process_priority = -18
-
- # If volume_list is defined, each LV is only activated if there is a
- # match against the list.
- #
- # "vgname" and "vgname/lvname" are matched exactly.
- # "@tag" matches any tag set in the LV or VG.
- # "@*" matches if any tag defined on the host is also set in the LV or VG
- #
- # If any host tags exist but volume_list is not defined, a default
- # single-entry list containing "@*" is assumed.
- #
- # volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
-
- # If auto_activation_volume_list is defined, each LV that is to be
- # activated with the autoactivation option (--activate ay/-a ay) is
- # first checked against the list. There are two scenarios in which
- # the autoactivation option is used:
- #
- # - automatic activation of volumes based on incoming PVs. If all the
- # PVs making up a VG are present in the system, the autoactivation
- # is triggered. This requires lvmetad (global/use_lvmetad=1) and udev
- # to be running. In this case, "pvscan --cache -aay" is called
- # automatically without any user intervention while processing
- # udev events. Please, make sure you define auto_activation_volume_list
- # properly so only the volumes you want and expect are autoactivated.
- #
- # - direct activation on command line with the autoactivation option.
- # In this case, the user calls "vgchange --activate ay/-a ay" or
- # "lvchange --activate ay/-a ay" directly.
- #
- # By default, the auto_activation_volume_list is not defined and all
- # volumes will be activated either automatically or by using --activate ay/-a ay.
- #
- # N.B. The "activation/volume_list" is still honoured in all cases so even
- # if the VG/LV passes the auto_activation_volume_list, it still needs to
- # pass the volume_list for it to be activated in the end.
-
- # If auto_activation_volume_list is defined but empty, no volumes will be
- # activated automatically and --activate ay/-a ay will do nothing.
- #
- # auto_activation_volume_list = []
-
- # If auto_activation_volume_list is defined and it's not empty, only matching
- # volumes will be activated either automatically or by using --activate ay/-a ay.
- #
- # "vgname" and "vgname/lvname" are matched exactly.
- # "@tag" matches any tag set in the LV or VG.
- # "@*" matches if any tag defined on the host is also set in the LV or VG
- #
- # auto_activation_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
-
- # If read_only_volume_list is defined, each LV that is to be activated
- # is checked against the list, and if it matches, it as activated
- # in read-only mode. (This overrides '--permission rw' stored in the
- # metadata.)
- #
- # "vgname" and "vgname/lvname" are matched exactly.
- # "@tag" matches any tag set in the LV or VG.
- # "@*" matches if any tag defined on the host is also set in the LV or VG
- #
- # read_only_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
-
- # For RAID or 'mirror' segment types, 'raid_region_size' is the
- # size (in kiB) of each:
- # - synchronization operation when initializing
- # - each copy operation when performing a 'pvmove' (using 'mirror' segtype)
- # This setting has replaced 'mirror_region_size' since version 2.02.99
- raid_region_size = 512
-
- # Setting to use when there is no readahead value stored in the metadata.
- #
- # "none" - Disable readahead.
- # "auto" - Use default value chosen by kernel.
- readahead = "auto"
-
- # 'raid_fault_policy' defines how a device failure in a RAID logical
- # volume is handled. This includes logical volumes that have the following
- # segment types: raid1, raid4, raid5*, and raid6*.
- #
- # In the event of a failure, the following policies will determine what
- # actions are performed during the automated response to failures (when
- # dmeventd is monitoring the RAID logical volume) and when 'lvconvert' is
- # called manually with the options '--repair' and '--use-policies'.
- #
- # "warn" - Use the system log to warn the user that a device in the RAID
- # logical volume has failed. It is left to the user to run
- # 'lvconvert --repair' manually to remove or replace the failed
- # device. As long as the number of failed devices does not
- # exceed the redundancy of the logical volume (1 device for
- # raid4/5, 2 for raid6, etc) the logical volume will remain
- # usable.
- #
- # "allocate" - Attempt to use any extra physical volumes in the volume
- # group as spares and replace faulty devices.
- #
- raid_fault_policy = "warn"
-
- # 'mirror_image_fault_policy' and 'mirror_log_fault_policy' define
- # how a device failure affecting a mirror (of "mirror" segment type) is
- # handled. A mirror is composed of mirror images (copies) and a log.
- # A disk log ensures that a mirror does not need to be re-synced
- # (all copies made the same) every time a machine reboots or crashes.
- #
- # In the event of a failure, the specified policy will be used to determine
- # what happens. This applies to automatic repairs (when the mirror is being
- # monitored by dmeventd) and to manual lvconvert --repair when
- # --use-policies is given.
- #
- # "remove" - Simply remove the faulty device and run without it. If
- # the log device fails, the mirror would convert to using
- # an in-memory log. This means the mirror will not
- # remember its sync status across crashes/reboots and
- # the entire mirror will be re-synced. If a
- # mirror image fails, the mirror will convert to a
- # non-mirrored device if there is only one remaining good
- # copy.
- #
- # "allocate" - Remove the faulty device and try to allocate space on
- # a new device to be a replacement for the failed device.
- # Using this policy for the log is fast and maintains the
- # ability to remember sync state through crashes/reboots.
- # Using this policy for a mirror device is slow, as it
- # requires the mirror to resynchronize the devices, but it
- # will preserve the mirror characteristic of the device.
- # This policy acts like "remove" if no suitable device and
- # space can be allocated for the replacement.
- #
- # "allocate_anywhere" - Not yet implemented. Useful to place the log device
- # temporarily on same physical volume as one of the mirror
- # images. This policy is not recommended for mirror devices
- # since it would break the redundant nature of the mirror. This
- # policy acts like "remove" if no suitable device and space can
- # be allocated for the replacement.
-
- mirror_log_fault_policy = "allocate"
- mirror_image_fault_policy = "remove"
-
- # 'snapshot_autoextend_threshold' and 'snapshot_autoextend_percent' define
- # how to handle automatic snapshot extension. The former defines when the
- # snapshot should be extended: when its space usage exceeds this many
- # percent. The latter defines how much extra space should be allocated for
- # the snapshot, in percent of its current size.
- #
- # For example, if you set snapshot_autoextend_threshold to 70 and
- # snapshot_autoextend_percent to 20, whenever a snapshot exceeds 70% usage,
- # it will be extended by another 20%. For a 1G snapshot, using up 700M will
- # trigger a resize to 1.2G. When the usage exceeds 840M, the snapshot will
- # be extended to 1.44G, and so on.
- #
- # Setting snapshot_autoextend_threshold to 100 disables automatic
- # extensions. The minimum value is 50 (A setting below 50 will be treated
- # as 50).
-
- snapshot_autoextend_threshold = 100
- snapshot_autoextend_percent = 20
-
- # 'thin_pool_autoextend_threshold' and 'thin_pool_autoextend_percent' define
- # how to handle automatic pool extension. The former defines when the
- # pool should be extended: when its space usage exceeds this many
- # percent. The latter defines how much extra space should be allocated for
- # the pool, in percent of its current size.
- #
- # For example, if you set thin_pool_autoextend_threshold to 70 and
- # thin_pool_autoextend_percent to 20, whenever a pool exceeds 70% usage,
- # it will be extended by another 20%. For a 1G pool, using up 700M will
- # trigger a resize to 1.2G. When the usage exceeds 840M, the pool will
- # be extended to 1.44G, and so on.
- #
- # Setting thin_pool_autoextend_threshold to 100 disables automatic
- # extensions. The minimum value is 50 (A setting below 50 will be treated
- # as 50).
-
- thin_pool_autoextend_threshold = 100
- thin_pool_autoextend_percent = 20
-
- # While activating devices, I/O to devices being (re)configured is
- # suspended, and as a precaution against deadlocks, LVM2 needs to pin
- # any memory it is using so it is not paged out. Groups of pages that
- # are known not to be accessed during activation need not be pinned
- # into memory. Each string listed in this setting is compared against
- # each line in /proc/self/maps, and the pages corresponding to any
- # lines that match are not pinned. On some systems locale-archive was
- # found to make up over 80% of the memory used by the process.
- # mlock_filter = [ "locale/locale-archive", "gconv/gconv-modules.cache" ]
-
- # Set to 1 to revert to the default behaviour prior to version 2.02.62
- # which used mlockall() to pin the whole process's memory while activating
- # devices.
- use_mlockall = 0
-
- # Monitoring is enabled by default when activating logical volumes.
- # Set to 0 to disable monitoring or use the --ignoremonitoring option.
- monitoring = 1
-
- # When pvmove or lvconvert must wait for the kernel to finish
- # synchronising or merging data, they check and report progress
- # at intervals of this number of seconds. The default is 15 seconds.
- # If this is set to 0 and there is only one thing to wait for, there
- # are no progress reports, but the process is awoken immediately the
- # operation is complete.
- polling_interval = 15
-}
-
-
-####################
-# Advanced section #
-####################
-
-# Metadata settings
-#
-# metadata {
- # Default number of copies of metadata to hold on each PV. 0, 1 or 2.
- # You might want to override it from the command line with 0
- # when running pvcreate on new PVs which are to be added to large VGs.
-
- # pvmetadatacopies = 1
-
- # Default number of copies of metadata to maintain for each VG.
- # If set to a non-zero value, LVM automatically chooses which of
- # the available metadata areas to use to achieve the requested
- # number of copies of the VG metadata. If you set a value larger
- # than the the total number of metadata areas available then
- # metadata is stored in them all.
- # The default value of 0 ("unmanaged") disables this automatic
- # management and allows you to control which metadata areas
- # are used at the individual PV level using 'pvchange
- # --metadataignore y/n'.
-
- # vgmetadatacopies = 0
-
- # Approximate default size of on-disk metadata areas in sectors.
- # You should increase this if you have large volume groups or
- # you want to retain a large on-disk history of your metadata changes.
-
- # pvmetadatasize = 255
-
- # List of directories holding live copies of text format metadata.
- # These directories must not be on logical volumes!
- # It's possible to use LVM2 with a couple of directories here,
- # preferably on different (non-LV) filesystems, and with no other
- # on-disk metadata (pvmetadatacopies = 0). Or this can be in
- # addition to on-disk metadata areas.
- # The feature was originally added to simplify testing and is not
- # supported under low memory situations - the machine could lock up.
- #
- # Never edit any files in these directories by hand unless you
- # you are absolutely sure you know what you are doing! Use
- # the supplied toolset to make changes (e.g. vgcfgrestore).
-
- # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]
-#}
-
-# Event daemon
-#
-dmeventd {
- # mirror_library is the library used when monitoring a mirror device.
- #
- # "libdevmapper-event-lvm2mirror.so" attempts to recover from
- # failures. It removes failed devices from a volume group and
- # reconfigures a mirror as necessary. If no mirror library is
- # provided, mirrors are not monitored through dmeventd.
-
- mirror_library = "libdevmapper-event-lvm2mirror.so"
-
- # snapshot_library is the library used when monitoring a snapshot device.
- #
- # "libdevmapper-event-lvm2snapshot.so" monitors the filling of
- # snapshots and emits a warning through syslog when the use of
- # the snapshot exceeds 80%. The warning is repeated when 85%, 90% and
- # 95% of the snapshot is filled.
-
- snapshot_library = "libdevmapper-event-lvm2snapshot.so"
-
- # thin_library is the library used when monitoring a thin device.
- #
- # "libdevmapper-event-lvm2thin.so" monitors the filling of
- # pool and emits a warning through syslog when the use of
- # the pool exceeds 80%. The warning is repeated when 85%, 90% and
- # 95% of the pool is filled.
-
- thin_library = "libdevmapper-event-lvm2thin.so"
-
- # Full path of the dmeventd binary.
- #
- # executable = "@DMEVENTD_PATH@"
-}
10 years, 10 months
master - profile: strictly require profiles to be valid
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9c12a23a997418...
Commit: 9c12a23a997418700b4dac1a44d193e6a837f3a3
Parent: 24a84549a88a6c937091b894d1f0babe10aed17d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 27 14:01:22 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:22:11 2013 +0200
profile: strictly require profiles to be valid
We must ensure that the profile is valid and contains
only items that are profilable - the check is forced
for profiles.
---
lib/config/config.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 59f9bb0..2994111 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1500,7 +1500,21 @@ int load_profile(struct cmd_context *cmd, struct profile *profile) {
dm_list_move(&cmd->profile_params->profiles, &profile->list);
- (void) _check_profile(cmd, profile);
+ /*
+ * *Profile must be valid* otherwise we'd end up with incorrect config!
+ * If there were config items present that are not supposed to be
+ * customized by a profile, we could end up with non-deterministic
+ * behaviour. Therefore, this check is *strictly forced* even if
+ * config/checks=0. The config/checks=0 will only cause the warning
+ * messages to be suppressed, but the check itself is always done
+ * for profiles!
+ */
+ if (!_check_profile(cmd, profile)) {
+ log_error("Ignoring invalid configuration profile %s.", profile->name);
+ /* if invalid, cut the whole tree and leave it empty */
+ dm_pool_free(profile->cft->mem, profile->cft->root);
+ profile->cft->root = NULL;
+ }
return 1;
}
10 years, 10 months
master - thin: make selected thinp settings profilable
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=24a84549a88a6c...
Commit: 24a84549a88a6c937091b894d1f0babe10aed17d
Parent: 6f0427cc56b1ef3ca63ba20b0ac8c0764d38632a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 27 11:22:02 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:22:11 2013 +0200
thin: make selected thinp settings profilable
These settins are customizable by profiles:
allocation/thin_pool_zero
allocation/thin_pool_discards
allocation/thin_pool_chunk_size
activation/thin_pool_autoextend_threshold
activation/thin_pool_autoextend_percent
---
lib/config/config_settings.h | 14 +++++++-------
lib/metadata/thin_manip.c | 3 ++-
tools/lvconvert.c | 14 +++++++-------
tools/lvcreate.c | 2 +-
tools/lvresize.c | 6 ++++--
tools/toollib.c | 10 ++++++----
tools/toollib.h | 4 +++-
7 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index a8d02be..d9112f5 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -56,12 +56,12 @@ cfg_section(root_CFG_SECTION, "(root)", root_CFG_SECTION, 0, vsn(0, 0, 0), NULL)
cfg_section(config_CFG_SECTION, "config", root_CFG_SECTION, 0, vsn(2, 2, 99), "Configuration handling.")
cfg_section(devices_CFG_SECTION, "devices", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
-cfg_section(allocation_CFG_SECTION, "allocation", root_CFG_SECTION, 0, vsn(2, 2, 77), NULL)
+cfg_section(allocation_CFG_SECTION, "allocation", root_CFG_SECTION, CFG_PROFILABLE, vsn(2, 2, 77), NULL)
cfg_section(log_CFG_SECTION, "log", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
cfg_section(backup_CFG_SECTION, "backup", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
cfg_section(shell_CFG_SECTION, "shell", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
cfg_section(global_CFG_SECTION, "global", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
-cfg_section(activation_CFG_SECTION, "activation", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
+cfg_section(activation_CFG_SECTION, "activation", root_CFG_SECTION, CFG_PROFILABLE, vsn(1, 0, 0), NULL)
cfg_section(metadata_CFG_SECTION, "metadata", root_CFG_SECTION, CFG_ADVANCED, vsn(1, 0, 0), NULL)
cfg_section(report_CFG_SECTION, "report", root_CFG_SECTION, CFG_ADVANCED, vsn(1, 0, 0), NULL)
cfg_section(dmeventd_CFG_SECTION, "dmeventd", root_CFG_SECTION, 0, vsn(1, 2, 3), NULL)
@@ -101,9 +101,9 @@ cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTIO
cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MAXIMISE_CLING, vsn(2, 2, 85), NULL)
cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 85), NULL)
cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
-cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
-cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_THIN_POOL_DISCARDS, vsn(2, 2, 99), NULL)
-cfg(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_THIN_POOL_CHUNK_SIZE, vsn(2, 2, 99), NULL)
+cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
+cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_THIN_POOL_DISCARDS, vsn(2, 2, 99), NULL)
+cfg(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_INT, DEFAULT_THIN_POOL_CHUNK_SIZE, vsn(2, 2, 99), NULL)
cfg(log_verbose_CFG, "verbose", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_VERBOSE, vsn(1, 0, 0), NULL)
cfg(log_silent_CFG, "silent", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SILENT, vsn(2, 2, 98), NULL)
@@ -179,8 +179,8 @@ cfg(activation_mirror_log_fault_policy_CFG, "mirror_log_fault_policy", activatio
cfg(activation_mirror_image_fault_policy_CFG, "mirror_image_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 57), NULL)
cfg(activation_snapshot_autoextend_threshold_CFG, "snapshot_autoextend_threshold", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_SNAPSHOT_AUTOEXTEND_THRESHOLD, vsn(2, 2, 75), NULL)
cfg(activation_snapshot_autoextend_percent_CFG, "snapshot_autoextend_percent", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_SNAPSHOT_AUTOEXTEND_PERCENT, vsn(2, 2, 75), NULL)
-cfg(activation_thin_pool_autoextend_threshold_CFG, "thin_pool_autoextend_threshold", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD, vsn(2, 2, 89), NULL)
-cfg(activation_thin_pool_autoextend_percent_CFG, "thin_pool_autoextend_percent", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_PERCENT, vsn(2, 2, 89), NULL)
+cfg(activation_thin_pool_autoextend_threshold_CFG, "thin_pool_autoextend_threshold", activation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD, vsn(2, 2, 89), NULL)
+cfg(activation_thin_pool_autoextend_percent_CFG, "thin_pool_autoextend_percent", activation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_PERCENT, vsn(2, 2, 89), NULL)
cfg_array(activation_mlock_filter_CFG, "mlock_filter", activation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 62), NULL)
cfg(activation_use_mlockall_CFG, "use_mlockall", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_USE_MLOCKALL, vsn(2, 2, 62), NULL)
cfg(activation_monitoring_CFG, "monitoring", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_DMEVENTD_MONITOR, vsn(2, 2, 63), NULL)
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 9fccc6f..4ff647a 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -335,7 +335,8 @@ int pool_below_threshold(const struct lv_segment *pool_seg)
{
percent_t percent;
int threshold = PERCENT_1 *
- find_config_tree_int(pool_seg->lv->vg->cmd, activation_thin_pool_autoextend_threshold_CFG, NULL);
+ find_config_tree_int(pool_seg->lv->vg->cmd, activation_thin_pool_autoextend_threshold_CFG,
+ lv_config_profile(pool_seg->lv));
/* Data */
if (!lv_thin_pool_percent(pool_seg->lv, 0, &percent))
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index ffdc3f4..542c71d 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -385,13 +385,6 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
return 0;
}
- if (!get_pool_params(cmd, &lp->passed_args,
- &lp->chunk_size,
- &lp->discards,
- &lp->poolmetadata_size,
- &lp->zero))
- return_0;
-
if (arg_count(cmd, poolmetadata_ARG)) {
if (arg_count(cmd, poolmetadatasize_ARG)) {
log_error("--poolmetadatasize is invalid with --poolmetadata.");
@@ -2415,6 +2408,13 @@ static int lvconvert_single(struct cmd_context *cmd, struct lvconvert_params *lp
if (!lv)
goto_out;
+ if (arg_count(cmd, thinpool_ARG) &&
+ !get_pool_params(cmd, lv_config_profile(lv),
+ &lp->passed_args, &lp->chunk_size,
+ &lp->discards, &lp->poolmetadata_size,
+ &lp->zero))
+ goto_out;
+
/*
* lp->pvh holds the list of PVs available for allocation or removal
*/
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index dcd05d0..698d72f 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -859,7 +859,7 @@ static int _lvcreate_params(struct lvcreate_params *lp,
!_read_size_params(lp, lcp, cmd) ||
!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size) ||
(lp->create_thin_pool &&
- !get_pool_params(cmd, &lp->passed_args,
+ !get_pool_params(cmd, NULL, &lp->passed_args,
&lp->chunk_size, &lp->discards,
&lp->poolmetadatasize, &lp->zero)) ||
!_read_mirror_params(lp, cmd) ||
diff --git a/tools/lvresize.c b/tools/lvresize.c
index bd29bc6..47cb6aa 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -306,9 +306,11 @@ static int _adjust_policy_params(struct cmd_context *cmd,
if (lv_is_thin_pool(lv)) {
policy_threshold =
- find_config_tree_int(cmd, activation_thin_pool_autoextend_threshold_CFG, NULL) * PERCENT_1;
+ find_config_tree_int(cmd, activation_thin_pool_autoextend_threshold_CFG,
+ lv_config_profile(lv)) * PERCENT_1;
policy_amount =
- find_config_tree_int(cmd, activation_thin_pool_autoextend_percent_CFG, NULL);
+ find_config_tree_int(cmd, activation_thin_pool_autoextend_percent_CFG,
+ lv_config_profile(lv));
if (!policy_amount && policy_threshold < PERCENT_100)
return 0;
} else {
diff --git a/tools/toollib.c b/tools/toollib.c
index 7f57604..46eb864 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1537,7 +1537,9 @@ int get_activation_monitoring_mode(struct cmd_context *cmd,
return 1;
}
-int get_pool_params(struct cmd_context *cmd, int *passed_args,
+int get_pool_params(struct cmd_context *cmd,
+ struct profile *profile,
+ int *passed_args,
uint32_t *chunk_size,
thin_discards_t *discards,
uint64_t *pool_metadata_size,
@@ -1551,7 +1553,7 @@ int get_pool_params(struct cmd_context *cmd, int *passed_args,
*zero = strcmp(arg_str_value(cmd, zero_ARG, "y"), "n");
log_very_verbose("Setting pool zeroing: %u", *zero);
} else
- *zero = find_config_tree_bool(cmd, allocation_thin_pool_zero_CFG, NULL);
+ *zero = find_config_tree_bool(cmd, allocation_thin_pool_zero_CFG, profile);
if (arg_count(cmd, discards_ARG)) {
*passed_args |= PASS_ARG_DISCARDS;
@@ -1559,7 +1561,7 @@ int get_pool_params(struct cmd_context *cmd, int *passed_args,
log_very_verbose("Setting pool discards: %s",
get_pool_discards_name(*discards));
} else {
- dstr = find_config_tree_str(cmd, allocation_thin_pool_discards_CFG, NULL);
+ dstr = find_config_tree_str(cmd, allocation_thin_pool_discards_CFG, profile);
if (!get_pool_discards(dstr, discards))
return_0;
}
@@ -1575,7 +1577,7 @@ int get_pool_params(struct cmd_context *cmd, int *passed_args,
log_very_verbose("Setting pool chunk size: %s",
display_size(cmd, *chunk_size));
} else
- *chunk_size = find_config_tree_int(cmd, allocation_thin_pool_chunk_size_CFG, NULL) * 2;
+ *chunk_size = find_config_tree_int(cmd, allocation_thin_pool_chunk_size_CFG, profile) * 2;
if ((*chunk_size < DM_THIN_MIN_DATA_BLOCK_SIZE) ||
(*chunk_size > DM_THIN_MAX_DATA_BLOCK_SIZE)) {
diff --git a/tools/toollib.h b/tools/toollib.h
index d2fd9ac..32884db 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -114,7 +114,9 @@ int pvcreate_params_validate(struct cmd_context *cmd,
int get_activation_monitoring_mode(struct cmd_context *cmd,
int *monitoring_mode);
-int get_pool_params(struct cmd_context *cmd, int *passed_args,
+int get_pool_params(struct cmd_context *cmd,
+ struct profile *profile,
+ int *passed_args,
uint32_t *chunk_size,
thin_discards_t *discards,
uint64_t *pool_metadata_size,
10 years, 10 months
master - lv: add lv_config_profile fn
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6f0427cc56b1ef...
Commit: 6f0427cc56b1ef3ca63ba20b0ac8c0764d38632a
Parent: e8832917f68f5d130f1f69e73d60f06f6f707363
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 27 11:17:16 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:22:11 2013 +0200
lv: add lv_config_profile fn
Returns LV's profile if it exists, VG's profile otherwise
(LV inherits VG's profile).
---
lib/metadata/lv.c | 5 +++++
lib/metadata/lv.h | 1 +
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 6215e1a..93ae92d 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -816,3 +816,8 @@ const struct logical_volume *lv_lock_holder(const struct logical_volume *lv)
return lv;
}
+
+struct profile *lv_config_profile(const struct logical_volume *lv)
+{
+ return lv->profile ? : lv->vg->profile;
+}
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index b123109..6831f67 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -92,4 +92,5 @@ int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv);
const struct logical_volume *lv_lock_holder(const struct logical_volume *lv);
struct logical_volume *lv_ondisk(struct logical_volume *lv);
+struct profile *lv_config_profile(const struct logical_volume *lv);
#endif /* _LVM_LV_H */
10 years, 10 months
master - config: add validation for configuration profiles
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e8832917f68f5d...
Commit: e8832917f68f5d130f1f69e73d60f06f6f707363
Parent: f1c292cc38f4ba2e8d9b7272bc1a1ce17bd729a5
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 26 16:27:28 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:22:11 2013 +0200
config: add validation for configuration profiles
Besides the classical configuration checks (type checking and
checking whether the item is recognized by lvm tools) for profiles,
do an extra check whether the configuration setting is customizable
by a profile at all. Give a warning message if not.
---
lib/config/config.c | 38 ++++++++++++++++++++++++++++++++++++++
lib/config/config.h | 5 ++++-
lib/config/config_settings.h | 1 +
3 files changed, 43 insertions(+), 1 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 2934b5a..59f9bb0 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -654,6 +654,19 @@ static int _config_def_check_node(struct cft_check_handle *handle,
if (!_config_def_check_node_value(handle, rp, cn->v, def))
return 0;
+ /*
+ * Also check whether this configuration item is allowed
+ * in certain types of configuration trees as in some
+ * the use of configuration is restricted, e.g. profiles...
+ */
+ if (handle->source == CONFIG_PROFILE &&
+ !(def->flags & CFG_PROFILABLE)) {
+ log_warn_suppress(handle->suppress_messages,
+ "Configuration %s \"%s\" is not customizable by "
+ "a profile.", cn->v ? "option" : "section", rp);
+ return 0;
+ }
+
handle->status[def->id] |= CFG_VALID;
return 1;
}
@@ -1405,6 +1418,29 @@ struct dm_config_tree *config_def_create_tree(struct config_def_tree_spec *spec)
return cft;
}
+static int _check_profile(struct cmd_context *cmd, struct profile *profile)
+{
+ struct cft_check_handle *handle;
+ int r;
+
+ if (!(handle = dm_pool_zalloc(cmd->libmem, sizeof(*handle)))) {
+ log_debug("_check_profile: profile check handle allocation failed");
+ return 0;
+ }
+
+ handle->cft = profile->cft;
+ handle->source = CONFIG_PROFILE;
+ /* the check is compulsory - allow only profilable items in a profile config! */
+ handle->force_check = 1;
+ /* provide warning messages only if config/checks=1 */
+ handle->suppress_messages = !find_config_tree_bool(cmd, config_checks_CFG, NULL);
+
+ r = config_def_check(cmd, handle);
+
+ dm_pool_free(cmd->libmem, handle);
+ return r;
+}
+
struct profile *add_profile(struct cmd_context *cmd, const char *profile_name)
{
struct profile *profile;
@@ -1464,6 +1500,8 @@ int load_profile(struct cmd_context *cmd, struct profile *profile) {
dm_list_move(&cmd->profile_params->profiles, &profile->list);
+ (void) _check_profile(cmd, profile);
+
return 1;
}
diff --git a/lib/config/config.h b/lib/config/config.h
index 51c777a..5109a23 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -78,8 +78,10 @@ typedef union {
#define CFG_ALLOW_EMPTY 0x02
/* whether the configuration item is for advanced use only */
#define CFG_ADVANCED 0x04
-/* whether the configuraton item is not officially supported */
+/* whether the configuration item is not officially supported */
#define CFG_UNSUPPORTED 0x08
+/* whether the configuration item is customizable by a profile */
+#define CFG_PROFILABLE 0x10
/* configuration definition item structure */
typedef struct cfg_def_item {
@@ -136,6 +138,7 @@ int load_pending_profiles(struct cmd_context *cmd);
/* configuration check handle for each instance of the validation check */
struct cft_check_handle {
struct dm_config_tree *cft; /* the tree for which the check is done */
+ config_source_t source; /* configuration source */
unsigned force_check:1; /* force check even if disabled by config/checks setting */
unsigned skip_if_checked:1; /* skip the check if already done before - return last state */
unsigned suppress_messages:1; /* suppress messages during the check if config item is found invalid */
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 65d869b..a8d02be 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -31,6 +31,7 @@
* CFG_ALLOW_EMPTY - node value can be emtpy
* CFG_ADVANCED - this node belongs to advanced config set
* CFG_UNSUPPORTED - this node belongs to unsupported config set
+ * CFG_PROFILABLE - this node is customizable by a profile
* type: allowed type for the value of simple configuation setting
* types: allowed types for the values of array configuration setting
* (use logical "OR" to define more than one allowed type,
10 years, 10 months
master - config: make it possible to run several instances of configuration check at once
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f1c292cc38f4ba...
Commit: f1c292cc38f4ba2e8d9b7272bc1a1ce17bd729a5
Parent: 8769033e078c79ee4167c5186d7407d1729fd8a4
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 26 14:53:57 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:22:11 2013 +0200
config: make it possible to run several instances of configuration check at once
Before, the status of the configuration check (config_def_check fn call)
was saved directly in global configuration definitinion array (as part
of the cfg_def_item_t/flags)
This patch introduces the "struct cft_check_handle" that defines
configuration check parameters as well as separate place to store
the status (status here means CFG_USED and CFG_VALID flags, formerly
saved in cfg_def_item_t/flags). This struct can hold config check
parameters as well as the status for each config tree separately,
thus making it possible to run several instances of config_def_check
without interference.
---
lib/commands/toolcontext.c | 29 +++++++++++--
lib/commands/toolcontext.h | 2 +
lib/config/config.c | 103 +++++++++++++++++++++----------------------
lib/config/config.h | 21 +++++++--
tools/dumpconfig.c | 36 ++++++++++++++-
5 files changed, 127 insertions(+), 64 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index b7e3d46..4919b93 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -263,6 +263,29 @@ static int _check_disable_udev(const char *msg) {
return 0;
}
+static int _check_config(struct cmd_context *cmd)
+{
+ if (!find_config_tree_bool(cmd, config_checks_CFG, NULL))
+ return 1;
+
+ if (!cmd->cft_check_handle) {
+ if (!(cmd->cft_check_handle = dm_pool_zalloc(cmd->libmem, sizeof(*cmd->cft_check_handle)))) {
+ log_error("Configuration check handle allocation failed.");
+ return 0;
+ }
+ }
+
+ cmd->cft_check_handle->cft = cmd->cft;
+
+ if (!config_def_check(cmd, cmd->cft_check_handle) &&
+ find_config_tree_bool(cmd, config_abort_on_errors_CFG, NULL)) {
+ log_error("LVM configuration invalid.");
+ return 0;
+ }
+
+ return 1;
+}
+
static int _process_config(struct cmd_context *cmd)
{
mode_t old_umask;
@@ -275,10 +298,8 @@ static int _process_config(struct cmd_context *cmd)
int udev_disabled = 0;
char sysfs_dir[PATH_MAX];
- if (!config_def_check(cmd, 0, 0, 0) && find_config_tree_bool(cmd, config_abort_on_errors_CFG, NULL)) {
- log_error("LVM configuration invalid.");
- return 0;
- }
+ if (!_check_config(cmd))
+ return_0;
/* umask */
cmd->default_settings.umask = find_config_tree_int(cmd, global_umask_CFG, NULL);
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 42a4e54..2d90138 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -102,7 +102,9 @@ struct cmd_context {
struct profile_params *profile_params; /* profile handling params including loaded profile configs */
struct dm_config_tree *cft; /* the whole cascade: CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_FILE/CONFIG_MERGED_FILES */
int config_initialized; /* used to reinitialize config if previous init was not successful */
+
struct dm_hash_table *cft_def_hash; /* config definition hash used for validity check (item type + item recognized) */
+ struct cft_check_handle *cft_check_handle;
/* selected settings with original default/configured value which can be changed during cmd processing */
struct config_info default_settings;
diff --git a/lib/config/config.c b/lib/config/config.c
index 6398eb0..2934b5a 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -584,12 +584,13 @@ static int _config_def_check_node_single_value(const char *rp, const struct dm_c
return 1;
}
-static int _config_def_check_node_value(const char *rp, const struct dm_config_value *v,
- const cfg_def_item_t *def, int suppress_messages)
+static int _config_def_check_node_value(struct cft_check_handle *handle,
+ const char *rp, const struct dm_config_value *v,
+ const cfg_def_item_t *def)
{
if (!v) {
if (def->type != CFG_TYPE_SECTION) {
- _log_type_error(rp, CFG_TYPE_SECTION, def->type, suppress_messages);
+ _log_type_error(rp, CFG_TYPE_SECTION, def->type, handle->suppress_messages);
return 0;
}
return 1;
@@ -597,13 +598,13 @@ static int _config_def_check_node_value(const char *rp, const struct dm_config_v
if (v->next) {
if (!(def->type & CFG_TYPE_ARRAY)) {
- _log_type_error(rp, CFG_TYPE_ARRAY, def->type, suppress_messages);
+ _log_type_error(rp, CFG_TYPE_ARRAY, def->type, handle->suppress_messages);
return 0;
}
}
do {
- if (!_config_def_check_node_single_value(rp, v, def, suppress_messages))
+ if (!_config_def_check_node_single_value(rp, v, def, handle->suppress_messages))
return 0;
v = v->next;
} while (v);
@@ -611,9 +612,10 @@ static int _config_def_check_node_value(const char *rp, const struct dm_config_v
return 1;
}
-static int _config_def_check_node(const char *vp, char *pvp, char *rp, char *prp,
+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,
- struct dm_hash_table *ht, int suppress_messages)
+ struct dm_hash_table *ht)
{
cfg_def_item_t *def;
int sep = vp != pvp; /* don't use '/' separator for top-level node */
@@ -628,7 +630,7 @@ static int _config_def_check_node(const char *vp, char *pvp, char *rp, char *prp
if (!(def = (cfg_def_item_t *) dm_hash_lookup(ht, vp))) {
/* If the node is not a section but a setting, fail now. */
if (cn->v) {
- log_warn_suppress(suppress_messages,
+ log_warn_suppress(handle->suppress_messages,
"Configuration setting \"%s\" unknown.", rp);
cn->id = -1;
return 0;
@@ -639,38 +641,38 @@ static int _config_def_check_node(const char *vp, char *pvp, char *rp, char *prp
/* The real path without '#' is still stored in rp variable. */
pvp[sep] = '#', pvp[sep + 1] = '\0';
if (!(def = (cfg_def_item_t *) dm_hash_lookup(ht, vp))) {
- log_warn_suppress(suppress_messages,
+ log_warn_suppress(handle->suppress_messages,
"Configuration section \"%s\" unknown.", rp);
cn->id = -1;
return 0;
}
}
- def->flags |= CFG_USED;
+ handle->status[def->id] |= CFG_USED;
cn->id = def->id;
- if (!_config_def_check_node_value(rp, cn->v, def, suppress_messages))
- return 0;
+ if (!_config_def_check_node_value(handle, rp, cn->v, def))
+ return 0;
- def->flags |= CFG_VALID;
+ handle->status[def->id] |= CFG_VALID;
return 1;
}
-static int _config_def_check_tree(const char *vp, char *pvp, char *rp, char *prp,
+static int _config_def_check_tree(struct cft_check_handle *handle,
+ const char *vp, char *pvp, char *rp, char *prp,
size_t buf_size, struct dm_config_node *root,
- struct dm_hash_table *ht, int suppress_messages)
+ struct dm_hash_table *ht)
{
struct dm_config_node *cn;
int valid, r = 1;
size_t len;
for (cn = root->child; cn; cn = cn->sib) {
- if ((valid = _config_def_check_node(vp, pvp, rp, prp, buf_size,
- cn, ht, suppress_messages)) && !cn->v) {
+ if ((valid = _config_def_check_node(handle, vp, pvp, rp, prp,
+ buf_size, cn, ht)) && !cn->v) {
len = strlen(rp);
- valid = _config_def_check_tree(vp, pvp + strlen(pvp),
- rp, prp + len, buf_size - len, cn, ht,
- suppress_messages);
+ valid = _config_def_check_tree(handle, vp, pvp + strlen(pvp),
+ rp, prp + len, buf_size - len, cn, ht);
}
if (!valid)
r = 0;
@@ -679,7 +681,7 @@ static int _config_def_check_tree(const char *vp, char *pvp, char *rp, char *prp
return r;
}
-int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_messages)
+int config_def_check(struct cmd_context *cmd, struct cft_check_handle *handle)
{
cfg_def_item_t *def;
struct dm_config_node *cn;
@@ -695,28 +697,21 @@ int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_
*/
/*
- * If the check has already been done and 'skip' is set,
+ * If the check has already been done and 'skip_if_checked' is set,
* skip the actual check and use last result if available.
* If not available, we must do the check. The global status
* is stored in root node.
*/
- def = cfg_def_get_item_p(root_CFG_SECTION);
- if (skip && (def->flags & CFG_USED))
- return def->flags & CFG_VALID;
-
- /* Clear 'used' and 'valid' status flags. */
- for (id = 0; id < CFG_COUNT; id++) {
- def = cfg_def_get_item_p(id);
- def->flags &= ~(CFG_USED | CFG_VALID);
- }
+ if (handle->skip_if_checked && (handle->status[root_CFG_SECTION] & CFG_USED))
+ return handle->status[root_CFG_SECTION] & CFG_VALID;
- if (!force && !find_config_tree_bool(cmd, config_checks_CFG, NULL)) {
- if (cmd->cft_def_hash) {
- dm_hash_destroy(cmd->cft_def_hash);
- cmd->cft_def_hash = NULL;
- }
+ /* Nothing to do if checks are disabled and also not forced. */
+ if (!handle->force_check && !find_config_tree_bool(cmd, config_checks_CFG, NULL))
return 1;
- }
+
+ /* Clear 'used' and 'valid' status flags. */
+ for (id = 0; id < CFG_COUNT; id++)
+ handle->status[id] &= ~(CFG_USED | CFG_VALID);
/*
* Create a hash of all possible configuration
@@ -743,44 +738,46 @@ int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_
}
}
- cfg_def_get_item_p(root_CFG_SECTION)->flags |= CFG_USED;
+ /*
+ * Mark this handle as used so next time we know that the check
+ * has already been done and so we can just reuse the previous
+ * status instead of running this whole check again.
+ */
+ handle->status[root_CFG_SECTION] |= CFG_USED;
/*
* Allow only sections as top-level elements.
* Iterate top-level sections and dive deeper.
* If any of subsequent checks fails, the whole check fails.
*/
- for (cn = cmd->cft->root; cn; cn = cn->sib) {
+ for (cn = handle->cft->root; cn; cn = cn->sib) {
if (!cn->v) {
/* top level node: vp=vp, rp=rp */
- if (!_config_def_check_node(vp, vp, rp, rp,
+ if (!_config_def_check_node(handle, vp, vp, rp, rp,
CFG_PATH_MAX_LEN,
- cn, cmd->cft_def_hash,
- suppress_messages)) {
+ cn, cmd->cft_def_hash)) {
r = 0; continue;
}
rplen = strlen(rp);
- if (!_config_def_check_tree(vp, vp + strlen(vp),
+ if (!_config_def_check_tree(handle,
+ vp, vp + strlen(vp),
rp, rp + rplen,
CFG_PATH_MAX_LEN - rplen,
- cn, cmd->cft_def_hash,
- suppress_messages))
+ cn, cmd->cft_def_hash))
r = 0;
} else {
- log_error_suppress(suppress_messages,
+ log_error_suppress(handle->suppress_messages,
"Configuration setting \"%s\" invalid. "
"It's not part of any section.", cn->key);
r = 0;
}
}
out:
- if (r) {
- cfg_def_get_item_p(root_CFG_SECTION)->flags |= CFG_VALID;
- def->flags |= CFG_VALID;
- } else {
- cfg_def_get_item_p(root_CFG_SECTION)->flags &= ~CFG_VALID;
- def->flags &= ~CFG_VALID;
- }
+ if (r)
+ handle->status[root_CFG_SECTION] |= CFG_VALID;
+ else
+ handle->status[root_CFG_SECTION] &= ~CFG_VALID;
+
return r;
}
diff --git a/lib/config/config.h b/lib/config/config.h
index fe4c31d..51c777a 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -80,10 +80,6 @@ typedef union {
#define CFG_ADVANCED 0x04
/* whether the configuraton item is not officially supported */
#define CFG_UNSUPPORTED 0x08
-/* helper flag to mark the item as used in a config tree instance */
-#define CFG_USED 0x10
-/* helper flag to mark the item as valid in a config tree instance */
-#define CFG_VALID 0x20
/* configuration definition item structure */
typedef struct cfg_def_item {
@@ -114,6 +110,12 @@ struct config_def_tree_spec {
int ignoreunsupported; /* do not include unsupported configs */
};
+
+/* flag to mark the item as used in a config tree instance during validation */
+#define CFG_USED 0x01
+/* flag to mark the item as valid in a config tree instance during validation */
+#define CFG_VALID 0x02
+
/*
* Register ID for each possible item in the configuration tree.
*/
@@ -131,8 +133,17 @@ struct profile *add_profile(struct cmd_context *cmd, const char *profile_name);
int load_profile(struct cmd_context *cmd, struct profile *profile);
int load_pending_profiles(struct cmd_context *cmd);
+/* configuration check handle for each instance of the validation check */
+struct cft_check_handle {
+ struct dm_config_tree *cft; /* the tree for which the check is done */
+ unsigned force_check:1; /* force check even if disabled by config/checks setting */
+ unsigned skip_if_checked:1; /* skip the check if already done before - return last state */
+ unsigned suppress_messages:1; /* suppress messages during the check if config item is found invalid */
+ uint8_t status[CFG_COUNT]; /* flags for each configuration item - the result of the check */
+};
+
int config_def_get_path(char *buf, size_t buf_size, int id);
-int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_messages);
+int config_def_check(struct cmd_context *cmd, struct cft_check_handle *handle);
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);
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index 9ba451e..2d6cbe3 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -31,6 +31,22 @@ static int _get_vsn(struct cmd_context *cmd, unsigned int *major,
return 1;
}
+static struct cft_check_handle *_get_cft_check_handle(struct cmd_context *cmd)
+{
+ struct cft_check_handle *handle = cmd->cft_check_handle;
+
+ if (!handle) {
+ if (!(handle = dm_pool_zalloc(cmd->libmem, sizeof(*cmd->cft_check_handle)))) {
+ log_error("Configuration check handle allocation failed.");
+ return NULL;
+ }
+ handle->cft = cmd->cft;
+ cmd->cft_check_handle = handle;
+ }
+
+ return handle;
+}
+
int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
{
const char *file = arg_str_value(cmd, file_ARG, NULL);
@@ -38,6 +54,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
unsigned int major, minor, patchlevel;
struct config_def_tree_spec tree_spec = {0};
struct dm_config_tree *cft = cmd->cft;
+ struct cft_check_handle *cft_check_handle;
int r = ECMD_PROCESSED;
if (arg_count(cmd, configtype_ARG) && arg_count(cmd, validate_ARG)) {
@@ -57,7 +74,14 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
tree_spec.ignoreunsupported = 1;
if (arg_count(cmd, validate_ARG)) {
- if (config_def_check(cmd, 1, 1, 0)) {
+ if (!(cft_check_handle = _get_cft_check_handle(cmd)))
+ return ECMD_FAILED;
+
+ cft_check_handle->force_check = 1;
+ cft_check_handle->skip_if_checked = 1;
+ cft_check_handle->suppress_messages = 0;
+
+ if (config_def_check(cmd, cft_check_handle)) {
log_print("LVM configuration valid.");
return ECMD_PROCESSED;
} else {
@@ -72,7 +96,15 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
tree_spec.type = CFG_DEF_TREE_CURRENT;
- config_def_check(cmd, 1, 1, 1);
+
+ if (!(cft_check_handle = _get_cft_check_handle(cmd)))
+ return ECMD_FAILED;
+
+ cft_check_handle->force_check = 1;
+ cft_check_handle->skip_if_checked = 1;
+ cft_check_handle->suppress_messages = 1;
+
+ config_def_check(cmd, cft_check_handle);
}
else if (!strcmp(type, "default"))
10 years, 10 months
master - toolcontext: add a few comments for struct cmd_context and rename config_valid -> config_initialized
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8769033e078c79...
Commit: 8769033e078c79ee4167c5186d7407d1729fd8a4
Parent: 0cd47947359d2ba093dc7da5e489cafb34b038d0
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 26 12:29:19 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:22:11 2013 +0200
toolcontext: add a few comments for struct cmd_context and rename config_valid -> config_initialized
Just to make it more clear and also not to confuse
config_valid with check against config definition
(and its 'valid' flag within the config defintion tree).
---
daemons/clvmd/lvm-functions.c | 2 +-
lib/commands/toolcontext.c | 8 ++++----
lib/commands/toolcontext.h | 14 ++++++++------
tools/lvmcmdline.c | 2 +-
4 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index 9d62675..5f1658d 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -508,7 +508,7 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
DEBUGLOG("do_lock_lv: resource '%s', cmd = %s, flags = %s, critical_section = %d\n",
resource, decode_locking_cmd(command), decode_flags(lock_flags), critical_section());
- if (!cmd->config_valid || config_files_changed(cmd)) {
+ if (!cmd->config_initialized || config_files_changed(cmd)) {
/* Reinitialise various settings inc. logging, filters */
if (do_refresh_cache()) {
log_error("Updated config file invalid. Aborting.");
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 5f99b0b..b7e3d46 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1507,9 +1507,9 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
cmd->default_settings.cache_vgmetadata = 1;
cmd->current_settings = cmd->default_settings;
- cmd->config_valid = 1;
+ cmd->config_initialized = 1;
out:
- if (cmd->config_valid != 1) {
+ if (!cmd->config_initialized) {
destroy_toolcontext(cmd);
cmd = NULL;
}
@@ -1624,7 +1624,7 @@ int refresh_toolcontext(struct cmd_context *cmd)
cft_cmdline = remove_config_tree_by_source(cmd, CONFIG_STRING);
_destroy_config(cmd);
- cmd->config_valid = 0;
+ cmd->config_initialized = 0;
cmd->hosttags = 0;
@@ -1681,7 +1681,7 @@ int refresh_toolcontext(struct cmd_context *cmd)
if (!_init_backup(cmd))
return 0;
- cmd->config_valid = 1;
+ cmd->config_initialized = 1;
reset_lvm_errno(1);
return 1;
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 7551245..42a4e54 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -98,14 +98,16 @@ struct cmd_context {
struct dev_filter *lvmetad_filter;
int dump_filter; /* Dump filter when exiting? */
- struct dm_list config_files;
- int config_valid;
- struct dm_config_tree *cft;
+ struct dm_list config_files; /* master lvm config + any existing tag configs */
+ struct profile_params *profile_params; /* profile handling params including loaded profile configs */
+ struct dm_config_tree *cft; /* the whole cascade: CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_FILE/CONFIG_MERGED_FILES */
+ int config_initialized; /* used to reinitialize config if previous init was not successful */
+ struct dm_hash_table *cft_def_hash; /* config definition hash used for validity check (item type + item recognized) */
+
+ /* selected settings with original default/configured value which can be changed during cmd processing */
struct config_info default_settings;
+ /* may contain changed values compared to default_settings */
struct config_info current_settings;
- struct dm_hash_table *cft_def_hash; /* cft definition hash used for validity check */
-
- struct profile_params *profile_params;
struct archive_params *archive_params;
struct backup_params *backup_params;
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 6efa29a..3aa4206 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1080,7 +1080,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
goto_out;
}
- if (arg_count(cmd, config_ARG) || !cmd->config_valid || config_files_changed(cmd)) {
+ if (arg_count(cmd, config_ARG) || !cmd->config_initialized || config_files_changed(cmd)) {
/* Reinitialise various settings inc. logging, filters */
if (!refresh_toolcontext(cmd)) {
old_cft = remove_config_tree_by_source(cmd, CONFIG_STRING);
10 years, 10 months
master - tools: add support for changing configuration profile for existing volumes (vgchange/lvchange)
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0cd47947359d2b...
Commit: 0cd47947359d2ba093dc7da5e489cafb34b038d0
Parent: e21e38cf740b5b174e59fe400663bf6847f2f547
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:33:06 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:22:10 2013 +0200
tools: add support for changing configuration profile for existing volumes (vgchange/lvchange)
The command to change the profile for existing VG/LV:
"vgchange/lvchange --profile <profile_name>"
The command to detach any existing profile from VG/LV:
"vgchange/lvchange --detachprofile"
---
tools/args.h | 1 +
tools/commands.h | 24 +++++++++++++-----------
tools/lvchange.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-----
tools/vgchange.c | 35 ++++++++++++++++++++++++++++++++++-
4 files changed, 94 insertions(+), 17 deletions(-)
diff --git a/tools/args.h b/tools/args.h
index cadd211..73312ca 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -92,6 +92,7 @@ arg(writebehind_ARG, '\0', "writebehind", int_arg, 0)
arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", size_kb_arg, 0)
arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", size_kb_arg, 0)
arg(profile_ARG, '\0', "profile", string_arg, 0)
+arg(detachprofile_ARG, '\0', "detachprofile", NULL, 0)
/* Allow some variations */
arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
diff --git a/tools/commands.h b/tools/commands.h
index 2d99d5a..f84aa35 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -76,6 +76,7 @@ xx(lvchange,
"\t[-C|--contiguous y|n]\n"
"\t[-d|--debug]\n"
"\t[--deltag Tag]\n"
+ "\t[--detachprofile]\n"
"\t[-f|--force]\n"
"\t[-h|--help]\n"
"\t[--discards {ignore|nopassdown|passdown}]\n"
@@ -104,12 +105,12 @@ xx(lvchange,
"\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
alloc_ARG, autobackup_ARG, activate_ARG, available_ARG, contiguous_ARG,
- discards_ARG, force_ARG, ignorelockingfailure_ARG, ignoremonitoring_ARG,
- major_ARG, minor_ARG, monitor_ARG, minrecoveryrate_ARG, maxrecoveryrate_ARG,
- noudevsync_ARG, partial_ARG,
- permission_ARG, persistent_ARG, poll_ARG, readahead_ARG, resync_ARG,
- refresh_ARG, addtag_ARG, deltag_ARG, syncaction_ARG, sysinit_ARG, test_ARG,
- writebehind_ARG, writemostly_ARG, zero_ARG)
+ discards_ARG, detachprofile_ARG, force_ARG, ignorelockingfailure_ARG,
+ ignoremonitoring_ARG, major_ARG, minor_ARG, monitor_ARG, minrecoveryrate_ARG,
+ maxrecoveryrate_ARG, noudevsync_ARG, partial_ARG, permission_ARG,
+ persistent_ARG, poll_ARG, readahead_ARG, resync_ARG, refresh_ARG, addtag_ARG,
+ deltag_ARG, syncaction_ARG, sysinit_ARG, test_ARG, writebehind_ARG,
+ writemostly_ARG, zero_ARG)
xx(lvconvert,
"Change logical volume layout",
@@ -770,6 +771,7 @@ xx(vgchange,
"\t[--alloc AllocationPolicy] " "\n"
"\t[-P|--partial] " "\n"
"\t[-d|--debug] " "\n"
+ "\t[--detachprofile] " "\n"
"\t[-h|--help] " "\n"
"\t[--ignorelockingfailure]\n"
"\t[--ignoremonitoring]\n"
@@ -794,11 +796,11 @@ xx(vgchange,
"\t[VolumeGroupName...]\n",
addtag_ARG, alloc_ARG, allocation_ARG, autobackup_ARG, activate_ARG,
- available_ARG, clustered_ARG, deltag_ARG, ignorelockingfailure_ARG,
- ignoremonitoring_ARG, logicalvolume_ARG, maxphysicalvolumes_ARG,
- monitor_ARG, noudevsync_ARG, metadatacopies_ARG, vgmetadatacopies_ARG,
- partial_ARG, physicalextentsize_ARG, poll_ARG, refresh_ARG, resizeable_ARG,
- resizable_ARG, sysinit_ARG, test_ARG, uuid_ARG)
+ available_ARG, clustered_ARG, deltag_ARG, detachprofile_ARG,
+ ignorelockingfailure_ARG, ignoremonitoring_ARG, logicalvolume_ARG,
+ maxphysicalvolumes_ARG, monitor_ARG, noudevsync_ARG, metadatacopies_ARG,
+ vgmetadatacopies_ARG, partial_ARG, physicalextentsize_ARG, poll_ARG,
+ refresh_ARG, resizeable_ARG, resizable_ARG, sysinit_ARG, test_ARG, uuid_ARG)
xx(vgck,
"Check the consistency of volume group(s)",
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 5fc3585..4b88a51 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -859,6 +859,33 @@ static int lvchange_recovery_rate(struct logical_volume *lv)
return 1;
}
+static int lvchange_profile(struct logical_volume *lv)
+{
+ const char *old_profile_name, *new_profile_name;
+ struct profile *new_profile;
+
+ old_profile_name = lv->profile ? lv->profile->name : "(inherited)";
+
+ if (arg_count(lv->vg->cmd, detachprofile_ARG)) {
+ new_profile_name = "(inherited)";
+ lv->profile = NULL;
+ } else {
+ new_profile_name = arg_str_value(lv->vg->cmd, profile_ARG, NULL);
+ if (!(new_profile = add_profile(lv->vg->cmd, new_profile_name)))
+ return_0;
+ lv->profile = new_profile;
+ }
+
+ log_verbose("Changing configuration profile for LV %s: %s -> %s.",
+ lv->name, old_profile_name, new_profile_name);
+
+ if (!vg_write(lv->vg) || !vg_commit(lv->vg))
+ return_0;
+
+ return 1;
+}
+
+
static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
void *handle __attribute__((unused)))
{
@@ -869,9 +896,8 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
if (!(lv->vg->status & LVM_WRITE) &&
(arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
arg_count(cmd, readahead_ARG) || arg_count(cmd, persistent_ARG) ||
- arg_count(cmd, discards_ARG) ||
- arg_count(cmd, zero_ARG) ||
- arg_count(cmd, alloc_ARG))) {
+ arg_count(cmd, discards_ARG) || arg_count(cmd, zero_ARG) ||
+ arg_count(cmd, alloc_ARG) || arg_count(cmd, profile_ARG))) {
log_error("Only -a permitted with read-only volume "
"group \"%s\"", lv->vg->name);
return EINVALID_CMD_LINE;
@@ -880,7 +906,7 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
if (lv_is_origin(lv) && !lv_is_thin_volume(lv) &&
(arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
arg_count(cmd, readahead_ARG) || arg_count(cmd, persistent_ARG) ||
- arg_count(cmd, alloc_ARG))) {
+ arg_count(cmd, alloc_ARG) || arg_count(cmd, profile_ARG))) {
log_error("Can't change logical volume \"%s\" under snapshot",
lv->name);
return ECMD_FAILED;
@@ -1023,6 +1049,14 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
docmds++;
}
+ /* change configuration profile */
+ if (arg_count(cmd, profile_ARG) || arg_count(cmd, detachprofile_ARG)) {
+ if (!archive(lv->vg))
+ return_ECMD_FAILED;
+ doit += lvchange_profile(lv);
+ docmds++;
+ }
+
if (doit)
log_print_unless_silent("Logical volume \"%s\" changed.", lv->name);
@@ -1070,7 +1104,9 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
arg_count(cmd, readahead_ARG) ||
arg_count(cmd, persistent_ARG) ||
arg_count(cmd, addtag_ARG) ||
- arg_count(cmd, deltag_ARG);
+ arg_count(cmd, deltag_ARG) ||
+ arg_count(cmd, profile_ARG) ||
+ arg_count(cmd, detachprofile_ARG);
int update_partial_unsafe =
arg_count(cmd, resync_ARG) ||
arg_count(cmd, alloc_ARG) ||
@@ -1090,6 +1126,11 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
+ if (arg_count(cmd, profile_ARG) && arg_count(cmd, detachprofile_ARG)) {
+ log_error("Only one of --profile and --detachprofile permitted.");
+ return EINVALID_CMD_LINE;
+ }
+
if (arg_count(cmd, activate_ARG) && arg_count(cmd, refresh_ARG)) {
log_error("Only one of -a and --refresh permitted.");
return EINVALID_CMD_LINE;
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 6831597..e55c404 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -419,6 +419,30 @@ static int _vgchange_metadata_copies(struct cmd_context *cmd,
return 1;
}
+static int _vgchange_profile(struct cmd_context *cmd,
+ struct volume_group *vg)
+{
+ const char *old_profile_name, *new_profile_name;
+ struct profile *new_profile;
+
+ old_profile_name = vg->profile ? vg->profile->name : "(no profile)";
+
+ if (arg_count(cmd, detachprofile_ARG)) {
+ new_profile_name = "(no profile)";
+ vg->profile = NULL;
+ } else {
+ new_profile_name = arg_str_value(cmd, profile_ARG, NULL);
+ if (!(new_profile = add_profile(cmd, new_profile_name)))
+ return_0;
+ vg->profile = new_profile;
+ }
+
+ log_verbose("Changing configuration profile for VG %s: %s -> %s.",
+ vg->name, old_profile_name, new_profile_name);
+
+ return 1;
+}
+
static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
void *handle __attribute__((unused)))
@@ -439,6 +463,8 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
{ alloc_ARG, &_vgchange_alloc },
{ clustered_ARG, &_vgchange_clustered },
{ vgmetadatacopies_ARG, &_vgchange_metadata_copies },
+ { profile_ARG, &_vgchange_profile},
+ { detachprofile_ARG, &_vgchange_profile},
{ -1, NULL },
};
@@ -511,7 +537,9 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
/* Update commands that can be combined */
int update_partial_safe =
arg_count(cmd, deltag_ARG) ||
- arg_count(cmd, addtag_ARG);
+ arg_count(cmd, addtag_ARG) ||
+ arg_count(cmd, profile_ARG) ||
+ arg_count(cmd, detachprofile_ARG);
int update_partial_unsafe =
arg_count(cmd, logicalvolume_ARG) ||
arg_count(cmd, maxphysicalvolumes_ARG) ||
@@ -535,6 +563,11 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
+ if (arg_count(cmd, profile_ARG) && arg_count(cmd, detachprofile_ARG)) {
+ log_error("Only one of --profile and --detachprofile permitted.");
+ return EINVALID_CMD_LINE;
+ }
+
if (arg_count(cmd, activate_ARG) && arg_count(cmd, refresh_ARG)) {
log_error("Only one of -a and --refresh permitted.");
return EINVALID_CMD_LINE;
10 years, 10 months
master - metadata: add support for storing profile name in metadata (during vgcreate/lvcreate)
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e21e38cf740b5b...
Commit: e21e38cf740b5b174e59fe400663bf6847f2f547
Parent: d6a91da4be08aa59bfabd626bdb599030db6e8f1
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:32:09 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:09 2013 +0200
metadata: add support for storing profile name in metadata (during vgcreate/lvcreate)
If "vgcreate/lvcreate --profile <profile_name>" is used, the profile
name is automatically stored in metadata for making it possible to
load it automatically next time the VG/LV is used.
---
lib/format_text/export.c | 7 +++++++
lib/format_text/format-text.c | 2 +-
lib/metadata/lv_manip.c | 3 +++
lib/metadata/metadata-exported.h | 1 +
tools/vgcreate.c | 3 +++
5 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index b6aac45..73030e4 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -418,6 +418,10 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
outf(f, "allocation_policy = \"%s\"",
get_alloc_string(vg->alloc));
}
+
+ if (vg->profile)
+ outf(f, "profile = \"%s\"", vg->profile->name);
+
outf(f, "metadata_copies = %u", vg->mda_copies);
return 1;
@@ -623,6 +627,9 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv)
outf(f, "allocation_policy = \"%s\"",
get_alloc_string(lv->alloc));
+ if (lv->profile)
+ outf(f, "profile = \"%s\"", lv->profile->name);
+
switch (lv->read_ahead) {
case DM_READ_AHEAD_NONE:
outfc(f, "# None", "read_ahead = -1");
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index a5b9b6c..b210603 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -2411,7 +2411,7 @@ struct format_type *create_text_format(struct cmd_context *cmd)
fmt->orphan_vg_name = ORPHAN_VG_NAME(FMT_TEXT_NAME);
fmt->features = FMT_SEGMENTS | FMT_MDAS | FMT_TAGS | FMT_PRECOMMIT |
FMT_UNLIMITED_VOLS | FMT_RESIZE_PV |
- FMT_UNLIMITED_STRIPESIZE | FMT_BAS;
+ FMT_UNLIMITED_STRIPESIZE | FMT_BAS | FMT_CONFIG_PROFILE;
if (!(mda_lists = dm_malloc(sizeof(struct mda_lists)))) {
log_error("Failed to allocate dir_list");
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c9af654..76660ae 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4651,6 +4651,9 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
status, lp->alloc, vg)))
return_NULL;
+ if (vg->fid->fmt->features & FMT_CONFIG_PROFILE)
+ lv->profile = vg->cmd->profile_params->global_profile;
+
if (lp->read_ahead != lv->read_ahead) {
log_verbose("Setting read ahead sectors");
lv->read_ahead = lp->read_ahead;
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 98216d4..50d9d2c 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -112,6 +112,7 @@
#define FMT_UNLIMITED_STRIPESIZE 0x00000100U /* Unlimited stripe size? */
#define FMT_RESTRICTED_READAHEAD 0x00000200U /* Readahead restricted to 2-120? */
#define FMT_BAS 0x000000400U /* Supports bootloader areas? */
+#define FMT_CONFIG_PROFILE 0x000000800U /* Supports configuration profiles? */
/* Mirror conversion type flags */
#define MIRROR_BY_SEG 0x00000001U /* segment-by-segment mirror */
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
index 9be9416..45f4c04 100644
--- a/tools/vgcreate.c
+++ b/tools/vgcreate.c
@@ -62,6 +62,9 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
+ if (vg->fid->fmt->features & FMT_CONFIG_PROFILE)
+ vg->profile = vg->cmd->profile_params->global_profile;
+
if (!vg_set_extent_size(vg, vp_new.extent_size) ||
!vg_set_max_lv(vg, vp_new.max_lv) ||
!vg_set_max_pv(vg, vp_new.max_pv) ||
10 years, 10 months
master - config: add profile arg to find_config_tree_bool
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d6a91da4be08aa...
Commit: d6a91da4be08aa59bfabd626bdb599030db6e8f1
Parent: aeffa4cb5bbb707d7d42eea6d2504a10ed0b798f
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:31:53 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:09 2013 +0200
config: add profile arg to find_config_tree_bool
---
lib/activate/dev_manager.c | 2 +-
lib/commands/toolcontext.c | 64 ++++++++++++++++++++++----------------------
lib/config/config.c | 16 +++++++++--
lib/config/config.h | 2 +-
lib/display/display.c | 2 +-
lib/locking/file_locking.c | 2 +-
lib/locking/locking.c | 6 ++--
lib/metadata/lv_manip.c | 8 +++---
lib/metadata/metadata.c | 6 ++--
lib/metadata/pv_manip.c | 2 +-
lib/mm/memlock.c | 2 +-
tools/lvmcmdline.c | 2 +-
tools/pvcreate.c | 2 +-
tools/pvscan.c | 2 +-
tools/reporter.c | 12 ++++----
tools/toollib.c | 6 ++--
16 files changed, 73 insertions(+), 63 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index d07e04a..85bd724 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1342,7 +1342,7 @@ static int _check_udev_fallback(struct cmd_context *cmd)
* variable or udev rules are switched off.
*/
settings->udev_fallback = !settings->udev_rules ? 1 :
- find_config_tree_bool(cmd, activation_verify_udev_operations_CFG);
+ find_config_tree_bool(cmd, activation_verify_udev_operations_CFG, NULL);
/* Do not rely fully on udev if the udev support is known to be incomplete. */
if (!settings->udev_fallback && !_dm_driver_has_stable_udev_support()) {
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index ead77e5..5f99b0b 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -174,7 +174,7 @@ static void _init_logging(struct cmd_context *cmd)
char timebuf[26];
/* Syslog */
- cmd->default_settings.syslog = find_config_tree_bool(cmd, log_syslog_CFG);
+ cmd->default_settings.syslog = find_config_tree_bool(cmd, log_syslog_CFG, NULL);
if (cmd->default_settings.syslog != 1)
fin_syslog();
@@ -191,30 +191,30 @@ static void _init_logging(struct cmd_context *cmd)
* Once set to 1, there is no facility to change it back to 0.
*/
cmd->default_settings.silent = silent_mode() ? :
- find_config_tree_bool(cmd, log_silent_CFG);
+ find_config_tree_bool(cmd, log_silent_CFG, NULL);
init_silent(cmd->default_settings.silent);
/* Verbose level for tty output */
- cmd->default_settings.verbose = find_config_tree_bool(cmd, log_verbose_CFG);
+ cmd->default_settings.verbose = find_config_tree_bool(cmd, log_verbose_CFG, NULL);
init_verbose(cmd->default_settings.verbose + VERBOSE_BASE_LEVEL);
/* Log message formatting */
- init_indent(find_config_tree_bool(cmd, log_indent_CFG));
- init_abort_on_internal_errors(find_config_tree_bool(cmd, global_abort_on_internal_errors_CFG));
+ init_indent(find_config_tree_bool(cmd, log_indent_CFG, NULL));
+ init_abort_on_internal_errors(find_config_tree_bool(cmd, global_abort_on_internal_errors_CFG, NULL));
cmd->default_settings.msg_prefix = find_config_tree_str_allow_empty(cmd, log_prefix_CFG, NULL);
init_msg_prefix(cmd->default_settings.msg_prefix);
- cmd->default_settings.cmd_name = find_config_tree_bool(cmd, log_command_names_CFG);
+ cmd->default_settings.cmd_name = find_config_tree_bool(cmd, log_command_names_CFG, NULL);
init_cmd_name(cmd->default_settings.cmd_name);
/* Test mode */
cmd->default_settings.test =
- find_config_tree_bool(cmd, global_test_CFG);
+ find_config_tree_bool(cmd, global_test_CFG, NULL);
init_test(cmd->default_settings.test);
/* Settings for logging to file */
- if (find_config_tree_bool(cmd, log_overwrite_CFG))
+ if (find_config_tree_bool(cmd, log_overwrite_CFG, NULL))
append = 0;
log_file = find_config_tree_str(cmd, log_file_CFG, NULL);
@@ -229,7 +229,7 @@ static void _init_logging(struct cmd_context *cmd)
if (log_file)
init_log_direct(log_file, append);
- init_log_while_suspended(find_config_tree_bool(cmd, log_activation_CFG));
+ init_log_while_suspended(find_config_tree_bool(cmd, log_activation_CFG, NULL));
cmd->default_settings.debug_classes = _parse_debug_classes(cmd);
log_debug("Setting log debug classes to %d", cmd->default_settings.debug_classes);
@@ -275,7 +275,7 @@ static int _process_config(struct cmd_context *cmd)
int udev_disabled = 0;
char sysfs_dir[PATH_MAX];
- if (!config_def_check(cmd, 0, 0, 0) && find_config_tree_bool(cmd, config_abort_on_errors_CFG)) {
+ if (!config_def_check(cmd, 0, 0, 0) && find_config_tree_bool(cmd, config_abort_on_errors_CFG, NULL)) {
log_error("LVM configuration invalid.");
return 0;
}
@@ -318,10 +318,10 @@ static int _process_config(struct cmd_context *cmd)
dm_set_sysfs_dir(sysfs_dir);
/* activation? */
- cmd->default_settings.activation = find_config_tree_bool(cmd, global_activation_CFG);
+ cmd->default_settings.activation = find_config_tree_bool(cmd, global_activation_CFG, NULL);
set_activation(cmd->default_settings.activation);
- cmd->default_settings.suffix = find_config_tree_bool(cmd, global_suffix_CFG);
+ cmd->default_settings.suffix = find_config_tree_bool(cmd, global_suffix_CFG, NULL);
if (!(cmd->default_settings.unit_factor =
units_to_bytes(find_config_tree_str(cmd, global_units_CFG, NULL),
@@ -350,10 +350,10 @@ static int _process_config(struct cmd_context *cmd)
udev_disabled = _check_disable_udev("manage logical volume symlinks in device directory");
cmd->default_settings.udev_rules = udev_disabled ? 0 :
- find_config_tree_bool(cmd, activation_udev_rules_CFG);
+ find_config_tree_bool(cmd, activation_udev_rules_CFG, NULL);
cmd->default_settings.udev_sync = udev_disabled ? 0 :
- find_config_tree_bool(cmd, activation_udev_sync_CFG);
+ find_config_tree_bool(cmd, activation_udev_sync_CFG, NULL);
/*
* Set udev_fallback lazily on first use since it requires
@@ -363,11 +363,11 @@ static int _process_config(struct cmd_context *cmd)
*/
cmd->default_settings.udev_fallback = udev_disabled ? 1 : -1;
- init_retry_deactivation(find_config_tree_bool(cmd, activation_retry_deactivation_CFG));
+ init_retry_deactivation(find_config_tree_bool(cmd, activation_retry_deactivation_CFG, NULL));
- init_activation_checks(find_config_tree_bool(cmd, activation_checks_CFG));
+ init_activation_checks(find_config_tree_bool(cmd, activation_checks_CFG, NULL));
- cmd->use_linear_target = find_config_tree_bool(cmd, activation_use_linear_target_CFG);
+ cmd->use_linear_target = find_config_tree_bool(cmd, activation_use_linear_target_CFG, NULL);
cmd->stripe_filler = find_config_tree_str(cmd, activation_missing_stripe_filler_CFG, NULL);
@@ -391,14 +391,14 @@ static int _process_config(struct cmd_context *cmd)
}
}
- cmd->si_unit_consistency = find_config_tree_bool(cmd, global_si_unit_consistency_CFG);
+ cmd->si_unit_consistency = find_config_tree_bool(cmd, global_si_unit_consistency_CFG, NULL);
if ((cn = find_config_tree_node(cmd, activation_mlock_filter_CFG, NULL)))
for (cv = cn->v; cv; cv = cv->next)
if ((cv->type != DM_CFG_STRING) || !cv->v.str[0])
log_error("Ignoring invalid activation/mlock_filter entry in config file");
- cmd->metadata_read_only = find_config_tree_bool(cmd, global_metadata_read_only_CFG);
+ cmd->metadata_read_only = find_config_tree_bool(cmd, global_metadata_read_only_CFG, NULL);
pv_min_kb = find_config_tree_int64(cmd, devices_pv_min_size_CFG, NULL);
if (pv_min_kb < PV_MIN_SIZE_KB) {
@@ -410,7 +410,7 @@ static int _process_config(struct cmd_context *cmd)
init_pv_min_size((uint64_t)pv_min_kb * (1024 >> SECTOR_SHIFT));
init_detect_internal_vg_cache_corruption
- (find_config_tree_bool(cmd, global_detect_internal_vg_cache_corruption_CFG));
+ (find_config_tree_bool(cmd, global_detect_internal_vg_cache_corruption_CFG, NULL));
lvmetad_disconnect();
@@ -427,12 +427,12 @@ static int _process_config(struct cmd_context *cmd)
lvmetad_set_token(cn ? cn->v : NULL);
if (find_config_tree_int(cmd, global_locking_type_CFG, NULL) == 3 &&
- find_config_tree_bool(cmd, global_use_lvmetad_CFG)) {
+ find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL)) {
log_warn("WARNING: configuration setting use_lvmetad overridden to 0 due to locking_type 3. "
"Clustered environment not supported by lvmetad yet.");
lvmetad_set_active(0);
} else
- lvmetad_set_active(find_config_tree_bool(cmd, global_use_lvmetad_CFG));
+ lvmetad_set_active(find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL));
lvmetad_init(cmd);
@@ -497,7 +497,7 @@ static int _init_tags(struct cmd_context *cmd, struct dm_config_tree *cft)
return 1;
/* NB hosttags 0 when already 1 intentionally does not delete the tag */
- if (!cmd->hosttags && find_config_tree_bool(cmd, tags_hosttags_CFG)) {
+ if (!cmd->hosttags && find_config_tree_bool(cmd, tags_hosttags_CFG, NULL)) {
/* FIXME Strip out invalid chars: only A-Za-z0-9_+.- */
if (!_set_tag(cmd, cmd->hostname))
return_0;
@@ -730,7 +730,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
device_list_from_udev = 0;
else
device_list_from_udev = udev_is_running() ?
- find_config_tree_bool(cmd, devices_obtain_device_list_from_udev_CFG) : 0;
+ find_config_tree_bool(cmd, devices_obtain_device_list_from_udev_CFG, NULL) : 0;
init_obtain_device_list_from_udev(device_list_from_udev);
@@ -821,7 +821,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
* Listed first because it's very efficient at eliminating
* unavailable devices.
*/
- if (find_config_tree_bool(cmd, devices_sysfs_scan_CFG)) {
+ if (find_config_tree_bool(cmd, devices_sysfs_scan_CFG, NULL)) {
if ((filters[nr_filt] = sysfs_filter_create()))
nr_filt++;
}
@@ -845,14 +845,14 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
nr_filt++;
/* md component filter. Optional, non-critical. */
- if (find_config_tree_bool(cmd, devices_md_component_detection_CFG)) {
+ if (find_config_tree_bool(cmd, devices_md_component_detection_CFG, NULL)) {
init_md_filtering(1);
if ((filters[nr_filt] = md_filter_create(cmd->dev_types)))
nr_filt++;
}
/* mpath component filter. Optional, non-critical. */
- if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG)) {
+ if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG, NULL)) {
if ((filters[nr_filt] = mpath_filter_create(cmd->dev_types)))
nr_filt++;
}
@@ -885,7 +885,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
if (!(f3 = _init_filter_components(cmd)))
goto_bad;
- init_ignore_suspended_devices(find_config_tree_bool(cmd, devices_ignore_suspended_devices_CFG));
+ init_ignore_suspended_devices(find_config_tree_bool(cmd, devices_ignore_suspended_devices_CFG, NULL));
/*
* If 'cache_dir' or 'cache_file_prefix' is set, ignore 'cache'.
@@ -922,7 +922,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
}
/* Should we ever dump persistent filter state? */
- if (find_config_tree_bool(cmd, devices_write_cache_state_CFG))
+ if (find_config_tree_bool(cmd, devices_write_cache_state_CFG, NULL))
cmd->dump_filter = 1;
if (!*cmd->system_dir)
@@ -933,7 +933,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
* than the config file and this is not a long-lived process. Also avoid
* it when lvmetad is enabled.
*/
- if (!find_config_tree_bool(cmd, global_use_lvmetad_CFG) &&
+ if (!find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL) &&
load_persistent_cache && !cmd->is_long_lived &&
!stat(dev_cache, &st) &&
(st.st_ctime > config_file_timestamp(cmd->cft)) &&
@@ -1253,7 +1253,7 @@ static int _init_backup(struct cmd_context *cmd)
/* set up archiving */
cmd->default_settings.archive =
- find_config_tree_bool(cmd, backup_archive_CFG);
+ find_config_tree_bool(cmd, backup_archive_CFG, NULL);
days = (uint32_t) find_config_tree_int(cmd, backup_retain_days_CFG, NULL);
@@ -1277,7 +1277,7 @@ static int _init_backup(struct cmd_context *cmd)
}
/* set up the backup */
- cmd->default_settings.backup = find_config_tree_bool(cmd, backup_backup_CFG);
+ cmd->default_settings.backup = find_config_tree_bool(cmd, backup_backup_CFG, NULL);
if (dm_snprintf
(default_dir, sizeof(default_dir), "%s/%s", cmd->system_dir,
diff --git a/lib/config/config.c b/lib/config/config.c
index 28229f4..6398eb0 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -710,7 +710,7 @@ int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_
def->flags &= ~(CFG_USED | CFG_VALID);
}
- if (!force && !find_config_tree_bool(cmd, config_checks_CFG)) {
+ if (!force && !find_config_tree_bool(cmd, config_checks_CFG, NULL)) {
if (cmd->cft_def_hash) {
dm_hash_destroy(cmd->cft_def_hash);
cmd->cft_def_hash = NULL;
@@ -907,15 +907,25 @@ float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *pr
return f;
}
-int find_config_tree_bool(struct cmd_context *cmd, int id)
+int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
const char *path = cfg_def_get_path(item);
+ int profile_applied = 0;
+ int b;
if (item->type != CFG_TYPE_BOOL)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path);
- return dm_config_tree_find_bool(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_BOOL));
+ if (profile && !cmd->profile_params->global_profile)
+ profile_applied = override_config_tree_from_profile(cmd, profile);
+
+ b = dm_config_tree_find_bool(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_BOOL));
+
+ if (profile_applied)
+ remove_config_tree_by_source(cmd, CONFIG_PROFILE);
+
+ return b;
}
/* Insert cn2 after cn1 */
diff --git a/lib/config/config.h b/lib/config/config.h
index ece4613..fe4c31d 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -170,6 +170,6 @@ const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, st
int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile);
int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile);
float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile);
-int find_config_tree_bool(struct cmd_context *cmd, int id);
+int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profile);
#endif
diff --git a/lib/display/display.c b/lib/display/display.c
index 26bc384..121a85e 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -526,7 +526,7 @@ int lvdisplay_full(struct cmd_context *cmd,
log_print("--- Logical volume ---");
- lvm1compat = find_config_tree_bool(cmd, global_lvdisplay_shows_full_device_path_CFG);
+ lvm1compat = find_config_tree_bool(cmd, global_lvdisplay_shows_full_device_path_CFG, NULL);
if (lvm1compat)
/* /dev/vgname/lvname doen't actually exist for internal devices */
diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c
index 9cfd8eb..5e49bc4 100644
--- a/lib/locking/file_locking.c
+++ b/lib/locking/file_locking.c
@@ -355,7 +355,7 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd,
strcpy(_lock_dir, locking_dir);
_prioritise_write_locks =
- find_config_tree_bool(cmd, global_prioritise_write_locks_CFG);
+ find_config_tree_bool(cmd, global_prioritise_write_locks_CFG, NULL);
(void) dm_prepare_selinux_context(_lock_dir, S_IFDIR);
r = dm_create_dir(_lock_dir);
diff --git a/lib/locking/locking.c b/lib/locking/locking.c
index 7d9db60..cdd6ac4 100644
--- a/lib/locking/locking.c
+++ b/lib/locking/locking.c
@@ -227,7 +227,7 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
if (type < 0)
type = find_config_tree_int(cmd, global_locking_type_CFG, NULL);
- _blocking_supported = find_config_tree_bool(cmd, global_wait_for_locks_CFG);
+ _blocking_supported = find_config_tree_bool(cmd, global_wait_for_locks_CFG, NULL);
switch (type) {
case 0:
@@ -254,7 +254,7 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
if (init_external_locking(&_locking, cmd, suppress_messages))
return 1;
}
- if (!find_config_tree_bool(cmd, global_fallback_to_clustered_locking_CFG)) {
+ if (!find_config_tree_bool(cmd, global_fallback_to_clustered_locking_CFG, NULL)) {
log_error_suppress(suppress_messages, "External locking initialisation failed.");
break;
}
@@ -287,7 +287,7 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
}
if ((type == 2 || type == 3) &&
- find_config_tree_bool(cmd, global_fallback_to_local_locking_CFG)) {
+ find_config_tree_bool(cmd, global_fallback_to_local_locking_CFG, NULL)) {
log_warn_suppress(suppress_messages, "WARNING: Falling back to local file-based locking.");
log_warn_suppress(suppress_messages,
"Volume Groups with the clustered attribute will "
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index e74b6f1..c9af654 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1015,7 +1015,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
* a correct area_multiple.
*/
ah->area_multiple = _calc_area_multiple(segtype, area_count + parity_count, stripes);
- ah->mirror_logs_separate = find_config_tree_bool(cmd, allocation_mirror_logs_require_separate_pvs_CFG);
+ ah->mirror_logs_separate = find_config_tree_bool(cmd, allocation_mirror_logs_require_separate_pvs_CFG, NULL);
if (segtype_is_raid(segtype)) {
if (metadata_area_count) {
@@ -1042,7 +1042,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
ah->log_len = ah->region_size;
ah->region_size = 0;
ah->mirror_logs_separate =
- find_config_tree_bool(cmd, allocation_thin_pool_metadata_require_separate_pvs_CFG);
+ find_config_tree_bool(cmd, allocation_thin_pool_metadata_require_separate_pvs_CFG, NULL);
} else {
ah->log_area_count = metadata_area_count;
ah->log_len = !metadata_area_count ? 0 :
@@ -1057,7 +1057,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
ah->cling_tag_list_cn = find_config_tree_node(cmd, allocation_cling_tag_list_CFG, NULL);
- ah->maximise_cling = find_config_tree_bool(cmd, allocation_maximise_cling_CFG);
+ ah->maximise_cling = find_config_tree_bool(cmd, allocation_maximise_cling_CFG, NULL);
return ah;
}
@@ -3481,7 +3481,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
}
/* FIXME Ensure not referred to by another existing LVs */
- ask_discard = find_config_tree_bool(cmd, devices_issue_discards_CFG);
+ ask_discard = find_config_tree_bool(cmd, devices_issue_discards_CFG, NULL);
if (lv_info(cmd, lv, 0, &info, 1, 0)) {
if (!lv_check_not_in_use(cmd, lv, &info))
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 0dfb23b..e12e1b0 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -83,7 +83,7 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignm
/*
* Align to stripe-width of underlying md device if present
*/
- if (find_config_tree_bool(pv->fmt->cmd, devices_md_chunk_alignment_CFG)) {
+ if (find_config_tree_bool(pv->fmt->cmd, devices_md_chunk_alignment_CFG, NULL)) {
temp_pe_align = dev_md_stripe_width(pv->fmt->cmd->dev_types, pv->dev);
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
pv->pe_align = temp_pe_align;
@@ -96,7 +96,7 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignm
* - optimal_io_size - the device's preferred unit of receiving I/O
* (e.g. MD's stripe width)
*/
- if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_detection_CFG)) {
+ if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_detection_CFG, NULL)) {
temp_pe_align = dev_minimum_io_size(pv->fmt->cmd->dev_types, pv->dev);
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
pv->pe_align = temp_pe_align;
@@ -128,7 +128,7 @@ unsigned long set_pe_align_offset(struct physical_volume *pv,
if (!pv->dev)
goto out;
- if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_offset_detection_CFG)) {
+ if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_offset_detection_CFG, NULL)) {
int align_offset = dev_alignment_offset(pv->fmt->cmd->dev_types, pv->dev);
/* must handle a -1 alignment_offset; means dev is misaligned */
if (align_offset < 0)
diff --git a/lib/metadata/pv_manip.c b/lib/metadata/pv_manip.c
index dea49f8..2f4f51e 100644
--- a/lib/metadata/pv_manip.c
+++ b/lib/metadata/pv_manip.c
@@ -203,7 +203,7 @@ int discard_pv_segment(struct pv_segment *peg, uint32_t discard_area_reduction)
* Only issue discards if enabled in lvm.conf and both
* the device and kernel (>= 2.6.35) supports discards.
*/
- if (!find_config_tree_bool(peg->pv->fmt->cmd, devices_issue_discards_CFG))
+ if (!find_config_tree_bool(peg->pv->fmt->cmd, devices_issue_discards_CFG, NULL))
return 1;
/* Missing PV? */
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 594687e..f32424a2 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -320,7 +320,7 @@ static void _lock_mem(struct cmd_context *cmd)
* Note: assuming _memlock_count_daemon is updated before _memlock_count
*/
_use_mlockall = _memlock_count_daemon ? 1 :
- find_config_tree_bool(cmd, activation_use_mlockall_CFG);
+ find_config_tree_bool(cmd, activation_use_mlockall_CFG, NULL);
if (!_use_mlockall) {
if (!*_procselfmaps &&
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index c50ea90..6efa29a 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1467,7 +1467,7 @@ static int _lvm1_fallback(struct cmd_context *cmd)
char vsn[80];
int dm_present;
- if (!find_config_tree_bool(cmd, global_fallback_to_lvm1_CFG) ||
+ if (!find_config_tree_bool(cmd, global_fallback_to_lvm1_CFG, NULL) ||
strncmp(cmd->kernel_vsn, "2.4.", 4))
return 0;
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
index d3703b4..7570c52 100644
--- a/tools/pvcreate.c
+++ b/tools/pvcreate.c
@@ -38,7 +38,7 @@ static int pvcreate_restore_params_validate(struct cmd_context *cmd,
if (!arg_count(cmd, restorefile_ARG) && arg_count(cmd, uuidstr_ARG)) {
if (!arg_count(cmd, norestorefile_ARG) &&
- find_config_tree_bool(cmd, devices_require_restorefile_with_uuid_CFG)) {
+ find_config_tree_bool(cmd, devices_require_restorefile_with_uuid_CFG, NULL)) {
log_error("--restorefile is required with --uuid");
return 0;
}
diff --git a/tools/pvscan.c b/tools/pvscan.c
index f4d104a..665e416 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -149,7 +149,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
*/
/* TODO: Remove this once lvmetad + cluster supported! */
if (find_config_tree_int(cmd, global_locking_type_CFG, NULL) == 3 ||
- !find_config_tree_bool(cmd, global_use_lvmetad_CFG)) {
+ !find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL)) {
log_debug_lvmetad("_pvscan_lvmetad: immediate return");
return ret;
}
diff --git a/tools/reporter.c b/tools/reporter.c
index 53a7883..a6941e3 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -222,13 +222,13 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
int columns_as_rows;
unsigned args_are_pvs;
- aligned = find_config_tree_bool(cmd, report_aligned_CFG);
- buffered = find_config_tree_bool(cmd, report_buffered_CFG);
- headings = find_config_tree_bool(cmd, report_headings_CFG);
+ aligned = find_config_tree_bool(cmd, report_aligned_CFG, NULL);
+ buffered = find_config_tree_bool(cmd, report_buffered_CFG, NULL);
+ headings = find_config_tree_bool(cmd, report_headings_CFG, NULL);
separator = find_config_tree_str(cmd, report_separator_CFG, NULL);
- field_prefixes = find_config_tree_bool(cmd, report_prefixes_CFG);
- quoted = find_config_tree_bool(cmd, report_quoted_CFG);
- columns_as_rows = find_config_tree_bool(cmd, report_colums_as_rows_CFG);
+ field_prefixes = find_config_tree_bool(cmd, report_prefixes_CFG, NULL);
+ quoted = find_config_tree_bool(cmd, report_quoted_CFG, NULL);
+ columns_as_rows = find_config_tree_bool(cmd, report_colums_as_rows_CFG, NULL);
args_are_pvs = (report_type == PVS ||
report_type == LABEL ||
diff --git a/tools/toollib.c b/tools/toollib.c
index 879e7f9..7f57604 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1442,7 +1442,7 @@ int pvcreate_params_validate(struct cmd_context *cmd,
pp->metadataignore = arg_int_value(cmd, metadataignore_ARG,
DEFAULT_PVMETADATAIGNORE);
else
- pp->metadataignore = find_config_tree_bool(cmd, metadata_pvmetadataignore_CFG);
+ pp->metadataignore = find_config_tree_bool(cmd, metadata_pvmetadataignore_CFG, NULL);
if (arg_count(cmd, pvmetadatacopies_ARG) &&
!arg_int_value(cmd, pvmetadatacopies_ARG, -1) &&
@@ -1531,7 +1531,7 @@ int get_activation_monitoring_mode(struct cmd_context *cmd,
DEFAULT_DMEVENTD_MONITOR);
else if (is_static() || arg_count(cmd, ignoremonitoring_ARG) ||
arg_count(cmd, sysinit_ARG) ||
- !find_config_tree_bool(cmd, activation_monitoring_CFG))
+ !find_config_tree_bool(cmd, activation_monitoring_CFG, NULL))
*monitoring_mode = DMEVENTD_MONITOR_IGNORE;
return 1;
@@ -1551,7 +1551,7 @@ int get_pool_params(struct cmd_context *cmd, int *passed_args,
*zero = strcmp(arg_str_value(cmd, zero_ARG, "y"), "n");
log_very_verbose("Setting pool zeroing: %u", *zero);
} else
- *zero = find_config_tree_bool(cmd, allocation_thin_pool_zero_CFG);
+ *zero = find_config_tree_bool(cmd, allocation_thin_pool_zero_CFG, NULL);
if (arg_count(cmd, discards_ARG)) {
*passed_args |= PASS_ARG_DISCARDS;
10 years, 10 months