1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-19 14:04:17 +03:00
lvm2/lib/config/config_settings.h

2206 lines
136 KiB
C
Raw Normal View History

/*
* Copyright (C) 2013-2018 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 Lesser General Public License v.2.1.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* MACROS:
config: add CFG_DEFAULT_RUN_TIME for config options with runtime defaults Previously, we declared a default value as undefined ("NULL") for settings which require runtime context to be set first (e.g. settings for paths that rely on SYSTEM_DIR environment variable or they depend on any other setting in some way). If we want to output default values as they are really used in runtime, we should make it possible to define a default value as function which is evaluated, not just providing a firm constant value as it was before. This patch defines simple prototypes for such functions. Also, there's new helper macros "cfg_runtime" and "cfg_array_runtime" - they provide exactly the same functionality as the original "cfg" and "cfg_array" macros when defining the configuration settings in config_settings.h, but they don't set the constant default value. Instead, they automatically link the configuration setting definition with one of these functions: typedef int (*t_fn_CFG_TYPE_BOOL) (struct cmd_context *cmd, struct profile *profile); typedef int (*t_fn_CFG_TYPE_INT) (struct cmd_context *cmd, struct profile *profile); typedef float (*t_fn_CFG_TYPE_FLOAT) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_STRING) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_ARRAY) (struct cmd_context *cmd, struct profile *profile); (The new macros actually set the CFG_DEFAULT_RUNTIME flag properly and set the default value link to the function accordingly). Then such configuration setting requires a function of selected type to be defined. This function has a predefined name: get_default_<id> ...where the <id> is the id of the setting as defined in config_settings.h. For example "backup_archive_dir_CFG" if defined as a setting with default value evaluated in runtime with "cfg_runtime" will automatically have "get_default_backup_archive_dir_CFG" function linked to this setting to get the default value.
2014-03-03 12:34:11 +01:00
* - define a configuration section:
* cfg_section(id, name, parent, flags, since_version, deprecated_since_version, deprecation_comment, comment)
*
config: add CFG_DEFAULT_RUN_TIME for config options with runtime defaults Previously, we declared a default value as undefined ("NULL") for settings which require runtime context to be set first (e.g. settings for paths that rely on SYSTEM_DIR environment variable or they depend on any other setting in some way). If we want to output default values as they are really used in runtime, we should make it possible to define a default value as function which is evaluated, not just providing a firm constant value as it was before. This patch defines simple prototypes for such functions. Also, there's new helper macros "cfg_runtime" and "cfg_array_runtime" - they provide exactly the same functionality as the original "cfg" and "cfg_array" macros when defining the configuration settings in config_settings.h, but they don't set the constant default value. Instead, they automatically link the configuration setting definition with one of these functions: typedef int (*t_fn_CFG_TYPE_BOOL) (struct cmd_context *cmd, struct profile *profile); typedef int (*t_fn_CFG_TYPE_INT) (struct cmd_context *cmd, struct profile *profile); typedef float (*t_fn_CFG_TYPE_FLOAT) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_STRING) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_ARRAY) (struct cmd_context *cmd, struct profile *profile); (The new macros actually set the CFG_DEFAULT_RUNTIME flag properly and set the default value link to the function accordingly). Then such configuration setting requires a function of selected type to be defined. This function has a predefined name: get_default_<id> ...where the <id> is the id of the setting as defined in config_settings.h. For example "backup_archive_dir_CFG" if defined as a setting with default value evaluated in runtime with "cfg_runtime" will automatically have "get_default_backup_archive_dir_CFG" function linked to this setting to get the default value.
2014-03-03 12:34:11 +01:00
* - define a configuration setting of simple type:
* cfg(id, name, parent, flags, type, default_value, since_version, unconfigured_default_value, deprecated_since_version, deprecation_comment, comment)
config: add CFG_DEFAULT_RUN_TIME for config options with runtime defaults Previously, we declared a default value as undefined ("NULL") for settings which require runtime context to be set first (e.g. settings for paths that rely on SYSTEM_DIR environment variable or they depend on any other setting in some way). If we want to output default values as they are really used in runtime, we should make it possible to define a default value as function which is evaluated, not just providing a firm constant value as it was before. This patch defines simple prototypes for such functions. Also, there's new helper macros "cfg_runtime" and "cfg_array_runtime" - they provide exactly the same functionality as the original "cfg" and "cfg_array" macros when defining the configuration settings in config_settings.h, but they don't set the constant default value. Instead, they automatically link the configuration setting definition with one of these functions: typedef int (*t_fn_CFG_TYPE_BOOL) (struct cmd_context *cmd, struct profile *profile); typedef int (*t_fn_CFG_TYPE_INT) (struct cmd_context *cmd, struct profile *profile); typedef float (*t_fn_CFG_TYPE_FLOAT) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_STRING) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_ARRAY) (struct cmd_context *cmd, struct profile *profile); (The new macros actually set the CFG_DEFAULT_RUNTIME flag properly and set the default value link to the function accordingly). Then such configuration setting requires a function of selected type to be defined. This function has a predefined name: get_default_<id> ...where the <id> is the id of the setting as defined in config_settings.h. For example "backup_archive_dir_CFG" if defined as a setting with default value evaluated in runtime with "cfg_runtime" will automatically have "get_default_backup_archive_dir_CFG" function linked to this setting to get the default value.
2014-03-03 12:34:11 +01:00
*
* - define a configuration array of one or more types:
* cfg_array(id, name, parent, flags, types, default_value, since_version, unconfigured_default_value, deprecated_since_version, deprecation_comment, comment)
*
2016-08-15 10:38:38 +02:00
* - define a configuration setting where the default value is evaluated in runtime
* cfg_runtime(id, name, parent, flags, type, since_version, deprecated_since_version, deprecation_comment, comment)
* (for each cfg_runtime, you need to define 'get_default_<name>(struct cmd_context *cmd, struct profile *profile)' function
* to get the default value in runtime - usually, these functions are placed in config.[ch] file)
*
*
config: add CFG_DEFAULT_RUN_TIME for config options with runtime defaults Previously, we declared a default value as undefined ("NULL") for settings which require runtime context to be set first (e.g. settings for paths that rely on SYSTEM_DIR environment variable or they depend on any other setting in some way). If we want to output default values as they are really used in runtime, we should make it possible to define a default value as function which is evaluated, not just providing a firm constant value as it was before. This patch defines simple prototypes for such functions. Also, there's new helper macros "cfg_runtime" and "cfg_array_runtime" - they provide exactly the same functionality as the original "cfg" and "cfg_array" macros when defining the configuration settings in config_settings.h, but they don't set the constant default value. Instead, they automatically link the configuration setting definition with one of these functions: typedef int (*t_fn_CFG_TYPE_BOOL) (struct cmd_context *cmd, struct profile *profile); typedef int (*t_fn_CFG_TYPE_INT) (struct cmd_context *cmd, struct profile *profile); typedef float (*t_fn_CFG_TYPE_FLOAT) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_STRING) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_ARRAY) (struct cmd_context *cmd, struct profile *profile); (The new macros actually set the CFG_DEFAULT_RUNTIME flag properly and set the default value link to the function accordingly). Then such configuration setting requires a function of selected type to be defined. This function has a predefined name: get_default_<id> ...where the <id> is the id of the setting as defined in config_settings.h. For example "backup_archive_dir_CFG" if defined as a setting with default value evaluated in runtime with "cfg_runtime" will automatically have "get_default_backup_archive_dir_CFG" function linked to this setting to get the default value.
2014-03-03 12:34:11 +01:00
* If default value can't be assigned statically because it depends on some
* run-time checks or if it depends on other settings already defined,
* the configuration setting or array can be defined with the
* "{cfg|cfg_array}_runtime" macro. In this case the default value
* is evaluated by automatically calling "get_default_<id>" function.
* See config.h and "function types to evaluate default value at runtime".
*
config: add CFG_DEFAULT_RUN_TIME for config options with runtime defaults Previously, we declared a default value as undefined ("NULL") for settings which require runtime context to be set first (e.g. settings for paths that rely on SYSTEM_DIR environment variable or they depend on any other setting in some way). If we want to output default values as they are really used in runtime, we should make it possible to define a default value as function which is evaluated, not just providing a firm constant value as it was before. This patch defines simple prototypes for such functions. Also, there's new helper macros "cfg_runtime" and "cfg_array_runtime" - they provide exactly the same functionality as the original "cfg" and "cfg_array" macros when defining the configuration settings in config_settings.h, but they don't set the constant default value. Instead, they automatically link the configuration setting definition with one of these functions: typedef int (*t_fn_CFG_TYPE_BOOL) (struct cmd_context *cmd, struct profile *profile); typedef int (*t_fn_CFG_TYPE_INT) (struct cmd_context *cmd, struct profile *profile); typedef float (*t_fn_CFG_TYPE_FLOAT) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_STRING) (struct cmd_context *cmd, struct profile *profile); typedef const char* (*t_fn_CFG_TYPE_ARRAY) (struct cmd_context *cmd, struct profile *profile); (The new macros actually set the CFG_DEFAULT_RUNTIME flag properly and set the default value link to the function accordingly). Then such configuration setting requires a function of selected type to be defined. This function has a predefined name: get_default_<id> ...where the <id> is the id of the setting as defined in config_settings.h. For example "backup_archive_dir_CFG" if defined as a setting with default value evaluated in runtime with "cfg_runtime" will automatically have "get_default_backup_archive_dir_CFG" function linked to this setting to get the default value.
2014-03-03 12:34:11 +01:00
*
* VARIABLES:
2015-04-30 14:43:08 +02:00
*
* id: Unique identifier.
*
* name: Configuration node name.
*
* parent: Id of parent configuration node.
*
* flags: Configuration item flags:
* CFG_NAME_VARIABLE - configuration node name is variable
* CFG_ALLOW_EMPTY - node value can be emtpy
* CFG_ADVANCED - this node belongs to advanced config set
* CFG_UNSUPPORTED - this node is not officially supported and it's used primarily by developers
* CFG_PROFILABLE - this node is customizable by a profile
* CFG_PROFILABLE_METADATA - profilable and attachable to VG/LV metadata
* CFG_DEFAULT_UNDEFINED - node's default value is undefined (depends on other system/kernel values outside of lvm)
* CFG_DEFAULT_COMMENTED - node's default value is commented out on output
2015-04-30 14:43:08 +02:00
* CFG_DISABLED - configuration is disabled (defaults always used)
* CFG_FORMAT_INT_OCTAL - print integer number in octal form (also prefixed by "0")
* CFG_SECTION_NO_CHECK - do not check content of the section at all - use with care!!!
* CFG_DISALLOW_INTERACTIVE - disallow configuration node for use in interactive environment (e.g. cmds run in lvm shell)
2015-04-30 14:43:08 +02:00
*
* type: Allowed type for the value of simple configuation setting, one of:
* CFG_TYPE_BOOL
* CFG_TYPE_INT
* CFG_TYPE_FLOAT
* CFG_TYPE_STRING
*
* types: Allowed types for the values of array configuration setting
* (use logical "OR" to define more than one allowed type,
* e.g. CFG_TYPE_STRING | CFG_TYPE_INT).
*
* default_value: Default value of type 'type' for the configuration node,
* if this is an array with several 'types' defined then
* default value is a string where each string representation
* of each value is prefixed by '#X' where X is one of:
* 'B' for boolean value
* 'I' for integer value
* 'F' for float value
* 'S' for string value
* '#' for the '#' character itself
* For example, "#Sfd#I16" means default value [ "fd", 16 ].
*
* since_version: The version this configuration node first appeared in (be sure
* that parent nodes are consistent with versioning, no check done
* if parent node is older or the same age as any child node!)
* Use "vsn" macro to translate the "major.minor.release" version
* into a single number that is being stored internally in memory.
* (see also lvmconfig ... --withversions)
*
* unconfigured_default_value: Unconfigured default value used as a default value which is
* in "@...@" form and which is then substituted with concrete value
2015-04-30 14:43:08 +02:00
* while running configure.
* (see also 'lvmconfig --type default --unconfigured')
*
* deprecated_since_version: The version since this configuration node is deprecated.
*
* deprecation_comment: Comment about deprecation reason and related info (e.g. which
* configuration is used now instead).
*
2015-04-30 14:43:08 +02:00
* comment: Comment used in configuration dumps. The very first line is the
* summarizing comment.
* (see also lvmconfig ... --withcomments and --withsummary)
*
*
* Difference between CFG_DEFAULT_COMMENTED and CFG_DEFAULT_UNDEFINED:
*
* UNDEFINED is used if default value is NULL or the value
* depends on other system/kernel values outside of lvm.
* The most common case is when dm-thin or dm-cache have
* built-in default settings in the kernel, and lvm will use
* those built-in default values unless the corresponding lvm
* config setting is set.
*
* COMMENTED is used to comment out the default setting in
* lvm.conf. The effect is that if the LVM version is
* upgraded, and the new version of LVM has new built-in
* default values, the new defaults are used by LVM unless
* the previous default value was set (uncommented) in lvm.conf.
*/
#include "lib/config/defaults.h"
cfg_section(root_CFG_SECTION, "(root)", root_CFG_SECTION, 0, vsn(0, 0, 0), 0, NULL, NULL)
#define CFG_PREAMBLE_GENERAL \
"# This is an example configuration file for the LVM2 system.\n" \
"# It contains the default settings that would be used if there was no\n" \
"# @DEFAULT_SYS_DIR@/lvm.conf file.\n" \
"#\n" \
"# Refer to 'man lvm.conf' for further information including the file layout.\n" \
"#\n" \
"# Refer to 'man lvm.conf' for information about how settings configured in\n" \
"# this file are combined with built-in values and command line options to\n" \
"# arrive at the final values used by LVM.\n" \
"#\n" \
"# Refer to 'man lvmconfig' for information about displaying the built-in\n" \
"# and configured values used by LVM.\n" \
"#\n" \
"# If a default value is set in this file (not commented out), then a\n" \
"# new version of LVM using this file will continue using that value,\n" \
"# even if the new version of LVM changes the built-in default value.\n" \
"#\n" \
"# To put this file in a different directory and override @DEFAULT_SYS_DIR@ set\n" \
"# the environment variable LVM_SYSTEM_DIR before running the tools.\n" \
"#\n" \
"# N.B. Take care that each setting only appears once if uncommenting\n" \
"# example settings in this file.\n\n"
cfg_section(config_CFG_SECTION, "config", root_CFG_SECTION, 0, vsn(2, 2, 99), 0, NULL,
"How LVM configuration settings are handled.\n")
cfg_section(devices_CFG_SECTION, "devices", root_CFG_SECTION, 0, vsn(1, 0, 0), 0, NULL,
"How LVM uses block devices.\n")
cfg_section(allocation_CFG_SECTION, "allocation", root_CFG_SECTION, CFG_PROFILABLE, vsn(2, 2, 77), 0, NULL,
"How LVM selects space and applies properties to LVs.\n")
cfg_section(log_CFG_SECTION, "log", root_CFG_SECTION, CFG_PROFILABLE, vsn(1, 0, 0), 0, NULL,
"How LVM log information is reported.\n")
cfg_section(backup_CFG_SECTION, "backup", root_CFG_SECTION, 0, vsn(1, 0, 0), 0, NULL,
"How LVM metadata is backed up and archived.\n"
"In LVM, a 'backup' is a copy of the metadata for the current system,\n"
"and an 'archive' contains old metadata configurations. They are\n"
"stored in a human readable text format.\n")
cfg_section(shell_CFG_SECTION, "shell", root_CFG_SECTION, 0, vsn(1, 0, 0), 0, NULL,
"Settings for running LVM in shell (readline) mode.\n")
cfg_section(global_CFG_SECTION, "global", root_CFG_SECTION, CFG_PROFILABLE, vsn(1, 0, 0), 0, NULL,
"Miscellaneous global LVM settings.\n")
cfg_section(activation_CFG_SECTION, "activation", root_CFG_SECTION, CFG_PROFILABLE, vsn(1, 0, 0), 0, NULL, NULL)
cfg_section(metadata_CFG_SECTION, "metadata", root_CFG_SECTION, CFG_DEFAULT_COMMENTED, vsn(1, 0, 0), 0, NULL, NULL)
cfg_section(report_CFG_SECTION, "report", root_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, vsn(1, 0, 0), 0, NULL,
"LVM report command output formatting.\n")
cfg_section(dmeventd_CFG_SECTION, "dmeventd", root_CFG_SECTION, 0, vsn(1, 2, 3), 0, NULL,
"Settings for the LVM event daemon.\n")
cfg_section(tags_CFG_SECTION, "tags", root_CFG_SECTION, CFG_DEFAULT_COMMENTED, vsn(1, 0, 18), 0, NULL,
"Host tag settings.\n")
cfg_section(local_CFG_SECTION, "local", root_CFG_SECTION, 0, vsn(2, 2, 117), 0, NULL,
"LVM settings that are specific to the local host.\n")
#define CFG_PREAMBLE_LOCAL \
"# This is a local configuration file template for the LVM2 system\n" \
"# which should be installed as @DEFAULT_SYS_DIR@/lvmlocal.conf .\n" \
"#\n" \
"# Refer to 'man lvm.conf' for information about the file layout.\n" \
"#\n" \
"# To put this file in a different directory and override\n" \
"# @DEFAULT_SYS_DIR@ set the environment variable LVM_SYSTEM_DIR before\n" \
"# running the tools.\n" \
"#\n" \
"# The lvmlocal.conf file is normally expected to contain only the\n" \
"# \"local\" section which contains settings that should not be shared or\n" \
"# repeated among different hosts. (But if other sections are present,\n" \
"# they *will* get processed. Settings in this file override equivalent\n" \
"# ones in lvm.conf and are in turn overridden by ones in any enabled\n" \
"# lvm_<tag>.conf files.)\n" \
"#\n" \
"# Please take care that each setting only appears once if uncommenting\n" \
"# example settings in this file and never copy this file between hosts.\n\n"
2021-03-16 09:51:41 -05:00
cfg(config_checks_CFG, "checks", config_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 1, vsn(2, 2, 99), NULL, 0, NULL,
"If enabled, any LVM configuration mismatch is reported.\n"
"This implies checking that the configuration key is understood by\n"
"LVM and that the value of the key is the proper type. If disabled,\n"
"any configuration mismatch is ignored and the default value is used\n"
"without any warning (a message about the configuration key not being\n"
"found is issued in verbose mode only).\n")
2021-03-16 09:51:41 -05:00
cfg(config_abort_on_errors_CFG, "abort_on_errors", config_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 0, vsn(2,2,99), NULL, 0, NULL,
"Abort the LVM process if a configuration mismatch is found.\n")
2021-03-16 09:51:41 -05:00
cfg_runtime(config_profile_dir_CFG, "profile_dir", config_CFG_SECTION, CFG_DEFAULT_COMMENTED | CFG_DISALLOW_INTERACTIVE, CFG_TYPE_STRING, vsn(2, 2, 99), 0, NULL,
2015-04-09 16:35:20 -05:00
"Directory where LVM looks for configuration profiles.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_dir_CFG, "dir", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED | CFG_ADVANCED, CFG_TYPE_STRING, DEFAULT_DEV_DIR, vsn(1, 0, 0), NULL, 0, NULL,
"Directory in which to create volume group device nodes.\n"
"Commands also accept this as a prefix on volume group names.\n")
2021-03-16 09:51:41 -05:00
cfg_array(devices_scan_CFG, "scan", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED | CFG_ADVANCED, CFG_TYPE_STRING, "#S/dev", vsn(1, 0, 0), NULL, 0, NULL,
"Directories containing device nodes to use with LVM.\n")
cfg_array(devices_loopfiles_CFG, "loopfiles", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED | CFG_UNSUPPORTED, CFG_TYPE_STRING, NULL, vsn(1, 2, 0), NULL, vsn(2, 3, 0), NULL, NULL)
2021-03-16 09:51:41 -05:00
cfg(devices_obtain_device_list_from_udev_CFG, "obtain_device_list_from_udev", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV, vsn(2, 2, 85), NULL, 0, NULL,
"Obtain the list of available devices from udev.\n"
"This avoids opening or using any inapplicable non-block devices or\n"
"subdirectories found in the udev directory. Any device node or\n"
"symlink not managed by udev in the udev directory is ignored. This\n"
"setting applies only to the udev-managed device directory; other\n"
"directories will be scanned fully. LVM needs to be compiled with\n"
"udev support for this setting to apply.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_external_device_info_source_CFG, "external_device_info_source", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_EXTERNAL_DEVICE_INFO_SOURCE, vsn(2, 2, 116), NULL, 0, NULL,
devices: rework libudev usage related to config settings: obtain_device_info_from_udev (controls if lvm gets a list of devices from readdir /dev or from libudev) external_device_info_source (controls if lvm asks libudev for device information) . Make the obtain_device_list_from_udev setting affect only the choice of readdir /dev vs libudev. The setting no longer controls if udev is used for device type checks. . Change obtain_device_list_from_udev default to 0. This helps avoid boot timeouts due to slow libudev queries, avoids reported failures from udev_enumerate_scan_devices, and avoids delays from "device not initialized in udev database" errors. Even without errors, for a system booting with 1024 PVs, lvm2-pvscan times improve from about 100 sec to 15 sec, and the pvscan command from about 64 sec to about 4 sec. . For external_device_info_source="none", remove all libudev device info queries, and use only lvm native device info. . For external_device_info_source="udev", first check lvm native device info, then check libudev info. . Remove sleep/retry loop when attempting libudev queries for device info. udev info will simply be skipped if it's not immediately available. . Only set up a libdev connection if it will be used by obtain_device_list_from_udev/external_device_info_source. . For native multipath component detection, use /etc/multipath/wwids. If a device has a wwid matching an entry in the wwids file, then it's considered a multipath component. This is necessary to natively detect multipath components when the mpath device is not set up.
2021-06-08 17:12:09 -05:00
"Enable device information from udev.\n"
"If set to \"udev\", lvm will supplement its own native device information\n"
"with information from libudev. This can potentially improve the detection\n"
"of MD component devices and multipath component devices.\n")
2019-02-26 15:54:30 -06:00
cfg(devices_hints_CFG, "hints", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_HINTS, vsn(2, 3, 2), NULL, 0, NULL,
"Use a local file to remember which devices have PVs on them.\n"
"Some commands will use this as an optimization to reduce device\n"
"scanning, and will only scan the listed PVs. Removing the hint file\n"
"will cause lvm to generate a new one. Disable hints if PVs will\n"
"be copied onto devices using non-lvm commands, like dd.\n"
"#\n"
"Accepted values:\n"
" all\n"
" Use all hints.\n"
" none\n"
" Use no hints.\n"
"#\n")
cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED , CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL, 0, NULL,
"Select which path name to display for a block device.\n"
"If multiple path names exist for a block device, and LVM needs to\n"
"display a name for the device, the path names are matched against\n"
"each item in this list of regular expressions. The first match is\n"
"used. Try to avoid using undescriptive /dev/dm-N names, if present.\n"
"If no preferred name matches, or if preferred_names are not defined,\n"
"the following built-in preferences are applied in order until one\n"
"produces a preferred name:\n"
"Prefer names with path prefixes in the order of:\n"
"/dev/mapper, /dev/disk, /dev/dm-*, /dev/block.\n"
"Prefer the name with the least number of slashes.\n"
"Prefer a name that is a symlink.\n"
"Prefer the path with least value in lexicographical order.\n"
"#\n"
"Example\n"
"preferred_names = [ \"^/dev/mpath/\", \"^/dev/mapper/mpath\", \"^/dev/[hs]d\" ]\n"
"#\n")
device usage based on devices file The LVM devices file lists devices that lvm can use. The default file is /etc/lvm/devices/system.devices, and the lvmdevices(8) command is used to add or remove device entries. If the file does not exist, or if lvm.conf includes use_devicesfile=0, then lvm will not use a devices file. When the devices file is in use, the regex filter is not used, and the filter settings in lvm.conf or on the command line are ignored. LVM records devices in the devices file using hardware-specific IDs, such as the WWID, and attempts to use subsystem-specific IDs for virtual device types. These device IDs are also written in the VG metadata. When no hardware or virtual ID is available, lvm falls back using the unstable device name as the device ID. When devnames are used, lvm performs extra scanning to find devices if their devname changes, e.g. after reboot. When proper device IDs are used, an lvm command will not look at devices outside the devices file, but when devnames are used as a fallback, lvm will scan devices outside the devices file to locate PVs on renamed devices. A config setting search_for_devnames can be used to control the scanning for renamed devname entries. Related to the devices file, the new command option --devices <devnames> allows a list of devices to be specified for the command to use, overriding the devices file. The listed devices act as a sort of devices file in terms of limiting which devices lvm will see and use. Devices that are not listed will appear to be missing to the lvm command. Multiple devices files can be kept in /etc/lvm/devices, which allows lvm to be used with different sets of devices, e.g. system devices do not need to be exposed to a specific application, and the application can use lvm on its own set of devices that are not exposed to the system. The option --devicesfile <filename> is used to select the devices file to use with the command. Without the option set, the default system devices file is used. Setting --devicesfile "" causes lvm to not use a devices file. An existing, empty devices file means lvm will see no devices. The new command vgimportdevices adds PVs from a VG to the devices file and updates the VG metadata to include the device IDs. vgimportdevices -a will import all VGs into the system devices file. LVM commands run by dmeventd not use a devices file by default, and will look at all devices on the system. A devices file can be created for dmeventd (/etc/lvm/devices/dmeventd.devices) If this file exists, lvm commands run by dmeventd will use it. Internal implementaion: - device_ids_read - read the devices file . add struct dev_use (du) to cmd->use_devices for each devices file entry - dev_cache_scan - get /dev entries . add struct device (dev) to dev_cache for each device on the system - device_ids_match - match devices file entries to /dev entries . match each du on cmd->use_devices to a dev in dev_cache, using device ID . on match, set du->dev, dev->id, dev->flags MATCHED_USE_ID - label_scan - read lvm headers and metadata from devices . filters are applied, those that do not need data from the device . filter-deviceid skips devs without MATCHED_USE_ID, i.e. skips /dev entries that are not listed in the devices file . read lvm label from dev . filters are applied, those that use data from the device . read lvm metadata from dev . add info/vginfo structs for PVs/VGs (info is "lvmcache") - device_ids_find_renamed_devs - handle devices with unstable devname ID where devname changed . this step only needed when devs do not have proper device IDs, and their dev names change, e.g. after reboot sdb becomes sdc. . detect incorrect match because PVID in the devices file entry does not match the PVID found when the device was read above . undo incorrect match between du and dev above . search system devices for new location of PVID . update devices file with new devnames for PVIDs on renamed devices . label_scan the renamed devs - continue with command processing
2020-06-23 13:25:41 -05:00
cfg(devices_use_devicesfile_CFG, "use_devicesfile", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_USE_DEVICES_FILE, vsn(2, 3, 12), NULL, 0, NULL,
"Enable or disable the use of a devices file.\n"
"When enabled, lvm will only use devices that\n"
"are lised in the devices file. A devices file will\n"
"be used, regardless of this setting, when the --devicesfile\n"
"option is set to a specific file name.\n")
cfg(devices_devicesfile_CFG, "devicesfile", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_DEVICES_FILE, vsn(2, 3, 12), NULL, 0, NULL,
"The name of the system devices file, listing devices that LVM should use.\n"
"This should not be used to select a non-system devices file.\n"
"The --devicesfile option is intended for alternative devices files.\n")
cfg(devices_search_for_devnames_CFG, "search_for_devnames", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_SEARCH_FOR_DEVNAMES, vsn(2, 3, 12), NULL, 0, NULL,
"Look outside of the devices file for missing devname entries.\n"
"A devname entry is used for a device that does not have a stable\n"
"device id, e.g. wwid, so the unstable device name is used as\n"
"the device id. After reboot, or if the device is reattached,\n"
"the device name may change, in which case lvm will not find\n"
"the expected PV on the device listed in the devices file.\n"
"This setting controls whether lvm will search other devices,\n"
"outside the devices file, to look for the missing PV on a\n"
"renamed device. If \"none\", lvm will not look at other devices,\n"
"and the PV may appear to be missing. If \"auto\", lvm will look\n"
"at other devices, but only those that are likely to have the PV.\n"
"If \"all\", lvm will look at all devices on the system.\n")
cfg_array(devices_filter_CFG, "filter", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, "#Sa|.*|", vsn(1, 0, 0), NULL, 0, NULL,
"Limit the block devices that are used by LVM commands.\n"
"This is a list of regular expressions used to accept or reject block\n"
"device path names. Each regex is delimited by a vertical bar '|'\n"
"(or any character) and is preceded by 'a' to accept the path, or\n"
"by 'r' to reject the path. The first regex in the list to match the\n"
"path is used, producing the 'a' or 'r' result for the device.\n"
"When multiple path names exist for a block device, if any path name\n"
"matches an 'a' pattern before an 'r' pattern, then the device is\n"
"accepted. If all the path names match an 'r' pattern first, then the\n"
"device is rejected. Unmatching path names do not affect the accept\n"
"or reject decision. If no path names for a device match a pattern,\n"
"then the device is accepted. Be careful mixing 'a' and 'r' patterns,\n"
"as the combination might produce unexpected results (test changes.)\n"
"Run vgscan after changing the filter to regenerate the cache.\n"
"#\n"
"Example\n"
"Accept every block device:\n"
"filter = [ \"a|.*|\" ]\n"
"Reject the cdrom drive:\n"
"filter = [ \"r|/dev/cdrom|\" ]\n"
"Work with just loopback devices, e.g. for testing:\n"
"filter = [ \"a|loop|\", \"r|.*|\" ]\n"
"Accept all loop devices and ide drives except hdc:\n"
"filter = [ \"a|loop|\", \"r|/dev/hdc|\", \"a|/dev/ide|\", \"r|.*|\" ]\n"
"Use anchors to be very specific:\n"
"filter = [ \"a|^/dev/hda8$|\", \"r|.*|\" ]\n"
"#\n")
cfg_array(devices_global_filter_CFG, "global_filter", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, "#Sa|.*|", vsn(2, 2, 98), NULL, 0, NULL,
"Limit the block devices that are used by LVM system components.\n"
"Because devices/filter may be overridden from the command line, it is\n"
"not suitable for system-wide device filtering, e.g. udev.\n"
"Use global_filter to hide devices from these LVM system components.\n"
"The syntax is the same as devices/filter. Devices rejected by\n"
"global_filter are not opened by LVM.\n")
cfg_runtime(devices_cache_CFG, "cache", devices_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 0, 0), vsn(1, 2, 19), NULL,
NULL)
cfg_runtime(devices_cache_dir_CFG, "cache_dir", devices_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 2, 19), vsn(2, 3, 0), NULL,
NULL)
cfg(devices_cache_file_prefix_CFG, "cache_file_prefix", devices_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, DEFAULT_CACHE_FILE_PREFIX, vsn(1, 2, 19), NULL, vsn(2, 3, 0), NULL,
NULL)
cfg(devices_write_cache_state_CFG, "write_cache_state", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(1, 0, 0), NULL, vsn(2, 3, 0), NULL,
NULL)
cfg_array(devices_types_CFG, "types", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED | CFG_ADVANCED, CFG_TYPE_INT | CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
"List of additional acceptable block device types.\n"
"These are of device type names from /proc/devices, followed by the\n"
"maximum number of partitions.\n"
"#\n"
"Example\n"
"types = [ \"fd\", 16 ]\n"
"#\n")
2021-03-16 09:51:41 -05:00
cfg(devices_sysfs_scan_CFG, "sysfs_scan", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_SYSFS_SCAN, vsn(1, 0, 8), NULL, 0, NULL,
"Restrict device scanning to block devices appearing in sysfs.\n"
"This is a quick way of filtering out block devices that are not\n"
"present on the system. sysfs must be part of the kernel and mounted.)\n")
2021-03-16 09:51:41 -05:00
cfg(devices_scan_lvs_CFG, "scan_lvs", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_SCAN_LVS, vsn(2, 2, 182), NULL, 0, NULL,
2019-03-06 13:33:07 -06:00
"Scan LVM LVs for layered PVs, allowing LVs to be used as PVs.\n"
"When 1, LVM will detect PVs layered on LVs, and caution must be\n"
"taken to avoid a host accessing a layered VG that may not belong\n"
"to it, e.g. from a guest image. This generally requires excluding\n"
"the LVs with device filters. Also, when this setting is enabled,\n"
"every LVM command will scan every active LV on the system (unless\n"
"filtered), which can cause performance problems on systems with\n"
"many active LVs. When this setting is 0, LVM will not detect or\n"
"use PVs that exist on LVs, and will not allow a PV to be created on\n"
"an LV. The LVs are ignored using a built in device filter that\n"
"identifies and excludes LVs.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_multipath_component_detection_CFG, "multipath_component_detection", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_MULTIPATH_COMPONENT_DETECTION, vsn(2, 2, 89), NULL, 0, NULL,
"Ignore devices that are components of DM multipath devices.\n")
devices: rework libudev usage related to config settings: obtain_device_info_from_udev (controls if lvm gets a list of devices from readdir /dev or from libudev) external_device_info_source (controls if lvm asks libudev for device information) . Make the obtain_device_list_from_udev setting affect only the choice of readdir /dev vs libudev. The setting no longer controls if udev is used for device type checks. . Change obtain_device_list_from_udev default to 0. This helps avoid boot timeouts due to slow libudev queries, avoids reported failures from udev_enumerate_scan_devices, and avoids delays from "device not initialized in udev database" errors. Even without errors, for a system booting with 1024 PVs, lvm2-pvscan times improve from about 100 sec to 15 sec, and the pvscan command from about 64 sec to about 4 sec. . For external_device_info_source="none", remove all libudev device info queries, and use only lvm native device info. . For external_device_info_source="udev", first check lvm native device info, then check libudev info. . Remove sleep/retry loop when attempting libudev queries for device info. udev info will simply be skipped if it's not immediately available. . Only set up a libdev connection if it will be used by obtain_device_list_from_udev/external_device_info_source. . For native multipath component detection, use /etc/multipath/wwids. If a device has a wwid matching an entry in the wwids file, then it's considered a multipath component. This is necessary to natively detect multipath components when the mpath device is not set up.
2021-06-08 17:12:09 -05:00
cfg(devices_multipath_wwids_file_CFG, "multipath_wwids_file", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED | CFG_ALLOW_EMPTY, CFG_TYPE_STRING, DEFAULT_WWIDS_FILE, vsn(2, 3, 13), NULL, 0, NULL,
"The path to the multipath wwids file used for multipath component detection.\n"
"Set this to an empty string to disable the use of the multipath wwids file.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_md_component_detection_CFG, "md_component_detection", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_MD_COMPONENT_DETECTION, vsn(1, 0, 18), NULL, 0, NULL,
"Enable detection and exclusion of MD component devices.\n"
"An MD component device is a block device that MD uses as part\n"
"of a software RAID virtual device. When an LVM PV is created\n"
"on an MD device, LVM must only use the top level MD device as\n"
"the PV, and should ignore the underlying component devices.\n"
"In cases where the MD superblock is located at the end of the\n"
"component devices, it is more difficult for LVM to consistently\n"
"identify an MD component, see the md_component_checks setting.\n")
cfg(devices_md_component_checks_CFG, "md_component_checks", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_MD_COMPONENT_CHECKS, vsn(2, 3, 2), NULL, 0, NULL,
"The checks LVM should use to detect MD component devices.\n"
"MD component devices are block devices used by MD software RAID.\n"
"#\n"
"Accepted values:\n"
" auto\n"
" LVM will skip scanning the end of devices when it has other\n"
" indications that the device is not an MD component.\n"
" start\n"
" LVM will only scan the start of devices for MD superblocks.\n"
" This does not incur extra I/O by LVM.\n"
" full\n"
" LVM will scan the start and end of devices for MD superblocks.\n"
" This requires an extra read at the end of devices.\n"
"#\n")
2021-03-16 09:51:41 -05:00
cfg(devices_fw_raid_component_detection_CFG, "fw_raid_component_detection", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_FW_RAID_COMPONENT_DETECTION, vsn(2, 2, 112), NULL, 0, NULL,
"Ignore devices that are components of firmware RAID devices.\n"
"LVM must use an external_device_info_source other than none for this\n"
"detection to execute.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_md_chunk_alignment_CFG, "md_chunk_alignment", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_MD_CHUNK_ALIGNMENT, vsn(2, 2, 48), NULL, 0, NULL,
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-13 15:00:11 -06:00
"Align the start of a PV data area with md device's stripe-width.\n"
"This applies if a PV is placed directly on an md device.\n"
2020-10-03 11:52:37 +00:00
"default_data_alignment will be overridden if it is not aligned\n"
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-13 15:00:11 -06:00
"with the value detected for this setting.\n"
2020-10-03 11:52:37 +00:00
"This setting is overridden by data_alignment_detection,\n"
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-13 15:00:11 -06:00
"data_alignment, and the --dataalignment option.\n")
cfg(devices_default_data_alignment_CFG, "default_data_alignment", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, FIRST_PE_AT_ONE_MB_IN_MB, vsn(2, 2, 75), NULL, 0, NULL,
"Align the start of a PV data area with this number of MiB.\n"
"Set to 1 for 1MiB, 2 for 2MiB, etc. Set to 0 to disable.\n"
2020-10-03 11:52:37 +00:00
"This setting is overridden by data_alignment and the --dataalignment\n"
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-13 15:00:11 -06:00
"option.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_data_alignment_detection_CFG, "data_alignment_detection", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_DATA_ALIGNMENT_DETECTION, vsn(2, 2, 51), NULL, 0, NULL,
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-13 15:00:11 -06:00
"Align the start of a PV data area with sysfs io properties.\n"
"The start of a PV data area will be a multiple of minimum_io_size or\n"
"optimal_io_size exposed in sysfs. minimum_io_size is the smallest\n"
"request the device can perform without incurring a read-modify-write\n"
"penalty, e.g. MD chunk size. optimal_io_size is the device's\n"
"preferred unit of receiving I/O, e.g. MD stripe width.\n"
"minimum_io_size is used if optimal_io_size is undefined (0).\n"
"If md_chunk_alignment is enabled, that detects the optimal_io_size.\n"
2020-10-03 11:52:37 +00:00
"default_data_alignment and md_chunk_alignment will be overridden\n"
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-13 15:00:11 -06:00
"if they are not aligned with the value detected for this setting.\n"
2020-10-03 11:52:37 +00:00
"This setting is overridden by data_alignment and the --dataalignment\n"
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-13 15:00:11 -06:00
"option.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_data_alignment_CFG, "data_alignment", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, 0, vsn(2, 2, 45), NULL, 0, NULL,
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-13 15:00:11 -06:00
"Align the start of a PV data area with this number of KiB.\n"
"When non-zero, this setting overrides default_data_alignment.\n"
"Set to 0 to disable, in which case default_data_alignment\n"
"is used to align the first PE in units of MiB.\n"
2020-10-03 11:52:37 +00:00
"This setting is overridden by the --dataalignment option.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_data_alignment_offset_detection_CFG, "data_alignment_offset_detection", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION, vsn(2, 2, 50), NULL, 0, NULL,
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-13 15:00:11 -06:00
"Shift the start of an aligned PV data area based on sysfs information.\n"
"After a PV data area is aligned, it will be shifted by the\n"
"alignment_offset exposed in sysfs. This offset is often 0, but may\n"
"be non-zero. Certain 4KiB sector drives that compensate for windows\n"
"partitioning will have an alignment_offset of 3584 bytes (sector 7\n"
"is the lowest aligned logical block, the 4KiB sectors start at\n"
"LBA -1, and consequently sector 63 is aligned on a 4KiB boundary).\n"
2020-10-03 11:52:37 +00:00
"This setting is overridden by the --dataalignmentoffset option.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_ignore_suspended_devices_CFG, "ignore_suspended_devices", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_IGNORE_SUSPENDED_DEVICES, vsn(1, 2, 19), NULL, 0, NULL,
"Ignore DM devices that have I/O suspended while scanning devices.\n"
"Otherwise, LVM waits for a suspended device to become accessible.\n"
"This should only be needed in recovery situations.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_ignore_lvm_mirrors_CFG, "ignore_lvm_mirrors", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_IGNORE_LVM_MIRRORS, vsn(2, 2, 104), NULL, 0, NULL,
"Do not scan 'mirror' LVs to avoid possible deadlocks.\n"
"This avoids possible deadlocks when using the 'mirror' segment type.\n"
"This setting determines whether LVs using the 'mirror' segment type\n"
"are scanned for LVM labels. This affects the ability of mirrors to\n"
"be used as physical volumes. If this setting is enabled, it is\n"
"impossible to create VGs on top of mirror LVs, i.e. to stack VGs on\n"
"mirror LVs. If this setting is disabled, allowing mirror LVs to be\n"
"scanned, it may cause LVM processes and I/O to the mirror to become\n"
"blocked. This is due to the way that the mirror segment type handles\n"
"failures. In order for the hang to occur, an LVM command must be run\n"
"just after a failure and before the automatic LVM repair process\n"
"takes place, or there must be failures in multiple mirrors in the\n"
"same VG at the same time with write failures occurring moments before\n"
"a scan of the mirror's labels. The 'mirror' scanning problems do not\n"
"apply to LVM RAID types like 'raid1' which handle failures in a\n"
"different way, making them a better choice for VG stacking.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_disable_after_error_count_CFG, "disable_after_error_count", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, 0, vsn(2, 2, 75), NULL, vsn(2, 3, 0), NULL,
NULL)
2021-03-16 09:51:41 -05:00
cfg(devices_require_restorefile_with_uuid_CFG, "require_restorefile_with_uuid", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_REQUIRE_RESTOREFILE_WITH_UUID, vsn(2, 2, 73), NULL, 0, NULL,
"Allow use of pvcreate --uuid without requiring --restorefile.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_pv_min_size_CFG, "pv_min_size", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_PV_MIN_SIZE_KB, vsn(2, 2, 85), NULL, 0, NULL,
"Minimum size in KiB of block devices which can be used as PVs.\n"
"In a clustered environment all nodes must use the same value.\n"
"Any value smaller than 512KiB is ignored. The previous built-in\n"
"value was 512.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_issue_discards_CFG, "issue_discards", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_ISSUE_DISCARDS, vsn(2, 2, 85), NULL, 0, NULL,
"Issue discards to PVs that are no longer used by an LV.\n"
"Discards are sent to an LV's underlying physical volumes when the LV\n"
"is no longer using the physical volumes' space, e.g. lvremove,\n"
"lvreduce. Discards inform the storage that a region is no longer\n"
"used. Storage that supports discards advertise the protocol-specific\n"
"way discards should be issued by the kernel (TRIM, UNMAP, or\n"
"WRITE SAME with UNMAP bit set). Not all storage will support or\n"
"benefit from discards, but SSDs and thinly provisioned LUNs\n"
"generally do. If enabled, discards will only be issued if both the\n"
"storage and kernel provide support.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_allow_changes_with_duplicate_pvs_CFG, "allow_changes_with_duplicate_pvs", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_ALLOW_CHANGES_WITH_DUPLICATE_PVS, vsn(2, 2, 153), NULL, 0, NULL,
"Allow VG modification while a PV appears on multiple devices.\n"
"When a PV appears on multiple devices, LVM attempts to choose the\n"
"best device to use for the PV. If the devices represent the same\n"
"underlying storage, the choice has minimal consequence. If the\n"
"devices represent different underlying storage, the wrong choice\n"
"can result in data loss if the VG is modified. Disabling this\n"
"setting is the safest option because it prevents modifying a VG\n"
"or activating LVs in it while a PV appears on multiple devices.\n"
"Enabling this setting allows the VG to be used as usual even with\n"
"uncertain devices.\n")
2021-03-16 09:51:41 -05:00
cfg(devices_allow_mixed_block_sizes_CFG, "allow_mixed_block_sizes", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 0, vsn(2, 3, 6), NULL, 0, NULL,
"Allow PVs in the same VG with different logical block sizes.\n"
"When allowed, the user is responsible to ensure that an LV is\n"
"using PVs with matching block sizes when necessary.\n")
cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 77), NULL, 0, NULL,
"Advise LVM which PVs to use when searching for new space.\n"
"When searching for free space to extend an LV, the 'cling' allocation\n"
"policy will choose space on the same PVs as the last segment of the\n"
"existing LV. If there is insufficient space and a list of tags is\n"
"defined here, it will check whether any of them are attached to the\n"
"PVs concerned and then seek to match those PV tags between existing\n"
"extents and new extents.\n"
"#\n"
"Example\n"
"Use the special tag \"@*\" as a wildcard to match any PV tag:\n"
"cling_tag_list = [ \"@*\" ]\n"
"LVs are mirrored between two sites within a single VG, and\n"
"PVs are tagged with either @site1 or @site2 to indicate where\n"
"they are situated:\n"
"cling_tag_list = [ \"@site1\", \"@site2\" ]\n"
"#\n")
2021-03-16 09:51:41 -05:00
cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_MAXIMISE_CLING, vsn(2, 2, 85), NULL, 0, NULL,
"Use a previous allocation algorithm.\n"
"Changes made in version 2.02.85 extended the reach of the 'cling'\n"
"policies to detect more situations where data can be grouped onto\n"
"the same disks. This setting can be used to disable the changes\n"