Skip to contentSkip to conversation

stable-2.02 - Revert "Revert "vgcreate/vgextend: restrict PVs with mixed block sizes""

PATCH David Teigland 1 participant 1 message Oct 24, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c2853147639ca31f16539a4e6316ef3320811497
Commit:        c2853147639ca31f16539a4e6316ef3320811497
Parent:        4e99308b7cab21fd79d1290a5aa47aee4ee4a76e
Author:        David Teigland <[email protected]>
AuthorDate:    Thu Oct 24 10:01:12 2019 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Thu Oct 24 10:01:12 2019 -0500

Revert "Revert "vgcreate/vgextend: restrict PVs with mixed block sizes""

This reverts commit c37aa7881d840c429b858ee0068f0151e46ce0d9.

Put back the setting again, but the next commit will just turn off the new behavior by default.

---
 lib/commands/toolcontext.h       |    1 +
 lib/config/config_settings.h     |    5 ++++
 lib/metadata/metadata-exported.h |    1 +
 lib/metadata/metadata.c          |   44 +++++++++++++++++++++++++++++++++++
 tools/lvmcmdline.c               |    2 +
 tools/toollib.c                  |   47 ++++++++++++++++++++++++++++++++++++++
 tools/vgcreate.c                 |    2 +
 7 files changed, 102 insertions(+), 0 deletions(-)
lib/commands/toolcontext.h +1 -0
index 4b2a079..497f4bd 100644
@@ -155,6 +155,7 @@ struct cmd_context {
 	unsigned include_shared_vgs:1;		/* report/display cmds can reveal lockd VGs */
 	unsigned include_active_foreign_vgs:1;	/* cmd should process foreign VGs with active LVs */
 	unsigned vg_read_print_access_error:1;	/* print access errors from vg_read */
+	unsigned allow_mixed_block_sizes:1;
 	unsigned force_access_clustered:1;
 	unsigned lockd_gl_disable:1;
 	unsigned lockd_vg_disable:1;
lib/config/config_settings.h +5 -0
index 0e81252..7981d5d 100644
@@ -470,6 +470,11 @@ cfg(devices_allow_changes_with_duplicate_pvs_CFG, "allow_changes_with_duplicate_
 	"Enabling this setting allows the VG to be used as usual even with\n"
 	"uncertain devices.\n")
 
+cfg(devices_allow_mixed_block_sizes_CFG, "allow_mixed_block_sizes", devices_CFG_SECTION, 0, 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"
lib/metadata/metadata-exported.h +1 -0
index 75caba1..9c24132 100644
@@ -591,6 +591,7 @@ struct pvcreate_params {
 	unsigned is_remove : 1;         /* is removing PVs, not creating */
 	unsigned preserve_existing : 1;
 	unsigned check_failed : 1;
+	unsigned check_consistent_block_size : 1;
 };
 
 struct lvresize_params {
lib/metadata/metadata.c +44 -0

62 lines not on this page · raw message

tools/lvmcmdline.c +2 -0
index 6a1ab11..9c39f48 100644
@@ -2306,6 +2306,8 @@ static int _get_current_settings(struct cmd_context *cmd)
 	if (cmd->cname->flags & CAN_USE_ONE_SCAN)
 		cmd->can_use_one_scan = 1;
 
+	cmd->allow_mixed_block_sizes = find_config_tree_bool(cmd, devices_allow_mixed_block_sizes_CFG, NULL);
+
 	cmd->partial_activation = 0;
 	cmd->degraded_activation = 0;
 	activation_mode = find_config_tree_str(cmd, activation_mode_CFG, NULL);
tools/toollib.c +47 -0

59 lines not on this page · raw message

tools/vgcreate.c +2 -0
index 4356d99..7add53b 100644
@@ -48,6 +48,8 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
 	/* Don't create a new PV on top of an existing PV like pvcreate does. */
 	pp.preserve_existing = 1;
 
+	pp.check_consistent_block_size = 1;
+
 	if (!vgcreate_params_set_defaults(cmd, &vp_def, NULL))
 		return EINVALID_CMD_LINE;
 	vp_def.vg_name = vg_name;