mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
conf: add metadata/check_pv_device_sizes
This commit is contained in:
parent
c0912af310
commit
136fd8f2f6
@ -1,5 +1,6 @@
|
||||
Version 2.02.141 -
|
||||
====================================
|
||||
Add metadata/check_pv_device_sizes switch to lvm.conf for device size checks.
|
||||
Warn if device size is less than corresponding PV size in metadata.
|
||||
Cache device sizes internally.
|
||||
Restore support for command breaking in process_each_lv_in_vg() (2.02.118).
|
||||
|
@ -1415,6 +1415,17 @@ activation {
|
||||
# This configuration section has an automatic default value.
|
||||
# metadata {
|
||||
|
||||
# Configuration option metadata/check_pv_device_sizes.
|
||||
# Check device sizes are not smaller than corresponding PV sizes.
|
||||
# If device size is less than corresponding PV size found in metadata,
|
||||
# there is always a risk of data loss. If this option is set, then LVM
|
||||
# issues a warning message each time it finds that the device size is
|
||||
# less than corresponding PV size. You should not disable this unless
|
||||
# you are absolutely sure about what you are doing!
|
||||
# This configuration option is advanced.
|
||||
# This configuration option has an automatic default value.
|
||||
# check_pv_device_sizes = 1
|
||||
|
||||
# Configuration option metadata/pvmetadatacopies.
|
||||
# Number of copies of metadata to store on each PV.
|
||||
# The --pvmetadatacopies option overrides this setting.
|
||||
|
@ -670,6 +670,8 @@ static int _process_config(struct cmd_context *cmd)
|
||||
/* LVM stores sizes internally in units of 512-byte sectors. */
|
||||
init_pv_min_size((uint64_t)pv_min_kb * (1024 >> SECTOR_SHIFT));
|
||||
|
||||
cmd->check_pv_dev_sizes = find_config_tree_bool(cmd, metadata_check_pv_device_sizes_CFG, NULL);
|
||||
|
||||
if (!process_profilable_config(cmd))
|
||||
return_0;
|
||||
|
||||
|
@ -113,6 +113,7 @@ struct cmd_context {
|
||||
* Switches.
|
||||
*/
|
||||
unsigned is_long_lived:1; /* optimises persistent_filter handling */
|
||||
unsigned check_pv_dev_sizes:1;
|
||||
unsigned handles_missing_pvs:1;
|
||||
unsigned handles_unknown_segments:1;
|
||||
unsigned use_linear_target:1;
|
||||
|
@ -1352,6 +1352,14 @@ cfg_array(activation_auto_lock_start_list_CFG, "auto_lock_start_list", activatio
|
||||
"Locking is auto-started only for VGs selected by this list.\n"
|
||||
"The rules are the same as those for auto_activation_volume_list.\n")
|
||||
|
||||
cfg(metadata_check_pv_device_sizes_CFG, "check_pv_device_sizes", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 1, vsn(2, 2, 141), NULL, 0, NULL,
|
||||
"Check device sizes are not smaller than corresponding PV sizes.\n"
|
||||
"If device size is less than corresponding PV size found in metadata,\n"
|
||||
"there is always a risk of data loss. If this option is set, then LVM\n"
|
||||
"issues a warning message each time it finds that the device size is\n"
|
||||
"less than corresponding PV size. You should not disable this unless\n"
|
||||
"you are absolutely sure about what you are doing!\n")
|
||||
|
||||
cfg(metadata_pvmetadatacopies_CFG, "pvmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_PVMETADATACOPIES, vsn(1, 0, 0), NULL, 0, NULL,
|
||||
"Number of copies of metadata to store on each PV.\n"
|
||||
"The --pvmetadatacopies option overrides this setting.\n"
|
||||
|
@ -672,7 +672,8 @@ static int _check_pv_dev_sizes(struct volume_group *vg)
|
||||
uint64_t dev_size, size;
|
||||
int r = 1;
|
||||
|
||||
if (is_orphan_vg(vg->name))
|
||||
if (!vg->cmd->check_pv_dev_sizes ||
|
||||
is_orphan_vg(vg->name))
|
||||
return 1;
|
||||
|
||||
dm_list_iterate_items(pvl, &vg->pvs) {
|
||||
|
Loading…
Reference in New Issue
Block a user