Skip to contentSkip to conversation

Ensure --metadatacopies parameter gets interpreted based on command.

PATCH New Dave Wysochanski 1 participant 1 message Jun 23, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Ensure --metadatacopies parameter gets interpreted based on command.

Now that we have both --pvmetadatacopies and --vgmetadatacopies, we need to make sure --metadatacopies gets interpreted correctly.

For pv commands, --metadatacopies should imply --pvmetadatacopies, and for vg commands, --vgmetadatacopies.

Note: this will change the behavior of vgcreate with --metadatacopies to be a synonym for --vgmetadatacopies. Previously, --metadatacopies would apply to any PVs given with vgcreate that needed an implicit pvcreate.

---
 tools/lvmcmdline.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
tools/lvmcmdline.c +7 -2
index 6a5479d..45762b5 100644
@@ -827,8 +827,13 @@ static int _get_settings(struct cmd_context *cmd)
 	if (!_merge_synonym(cmd, resizable_ARG, resizeable_ARG) ||
 	    !_merge_synonym(cmd, allocation_ARG, allocatable_ARG) ||
 	    !_merge_synonym(cmd, allocation_ARG, resizeable_ARG) ||
-	    !_merge_synonym(cmd, virtualoriginsize_ARG, virtualsize_ARG) ||
-	    !_merge_synonym(cmd, metadatacopies_ARG, pvmetadatacopies_ARG))
+	    !_merge_synonym(cmd, virtualoriginsize_ARG, virtualsize_ARG))
+		return EINVALID_CMD_LINE;
+
+	if ((!strncmp(cmd->command->name, "pv", 2) &&
+	    !_merge_synonym(cmd, metadatacopies_ARG, pvmetadatacopies_ARG)) ||
+	    (!strncmp(cmd->command->name, "vg", 2) &&
+	     !_merge_synonym(cmd, metadatacopies_ARG, vgmetadatacopies_ARG)))
 		return EINVALID_CMD_LINE;
 
 	/* Zero indicates success */
Signature · 1 line
1.6.0.6