Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:GA
lvm2.5953
bug-999878_conf-add-metadata-check_pv_device_si...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bug-999878_conf-add-metadata-check_pv_device_sizes.patch of Package lvm2.5953
From 90c6e1dfa19226252587d03abf63da40b1a99109 Mon Sep 17 00:00:00 2001 From: Eric Ren <zren@suse.com> Date: Tue, 25 Apr 2017 19:44:55 +0800 Subject: [PATCH 2/2] [PATCH 2/2] conf: add metadata/check_pv_device_sizes Upstream commit: 136fd8f2f642c82b132ded4b9a95b05e822e9117 Backport-by: Eric Ren <zren@suse.com> --- WHATS_NEW | 1 + conf/example.conf.in | 11 +++++++++++ lib/commands/toolcontext.c | 2 ++ lib/commands/toolcontext.h | 1 + lib/config/config_settings.h | 8 ++++++++ lib/metadata/metadata.c | 3 ++- 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index eb0eabe..707f0d5 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -2,6 +2,7 @@ News for backported patches ============================== Fix lvm2-{activation,clvmd,cmirrord,monitor} service to exec before mounting. Warn if device size is less than corresponding PV size in metadata. + Add metadata/check_pv_device_sizes switch to lvm.conf for device size checks. Version 2.02.120 - 15th May 2015 ================================ diff --git a/conf/example.conf.in b/conf/example.conf.in index 6919b0c..e7de210 100644 --- a/conf/example.conf.in +++ b/conf/example.conf.in @@ -1316,6 +1316,17 @@ activation { # Configuration section metadata. # 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. # Possible options are: 0, 1, 2. diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index 47aa209..b688c3b 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -615,6 +615,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; diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h index 28f5a2c..afe033f 100644 --- a/lib/commands/toolcontext.h +++ b/lib/commands/toolcontext.h @@ -83,6 +83,7 @@ struct cmd_context { struct arg_values *arg_values; struct dm_list arg_value_groups; 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; diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h index 4b37a20..557b424 100644 --- a/lib/config/config_settings.h +++ b/lib/config/config_settings.h @@ -1261,6 +1261,14 @@ cfg(activation_mode_CFG, "activation_mode", activation_CFG_SECTION, 0, CFG_TYPE_ "sometimes assist with data recovery.\n" "The '--activationmode' option overrides this setting.\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" "Possible options are: 0, 1, 2.\n" diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index c4e4491..8f80991 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -656,7 +656,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) { -- 2.10.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor