]> sourceware.org Git - lvm2.git/commitdiff
Ensure --metadatacopies parameter gets interpreted based on command.
authorDave Wysochanski <dwysocha@redhat.com>
Mon, 28 Jun 2010 20:39:39 +0000 (20:39 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Mon, 28 Jun 2010 20:39:39 +0000 (20:39 +0000)
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.  As a result, one small change is needed to one of the nightly
tests - t-vgcreate-usage.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
test/t-vgcreate-usage.sh
tools/lvmcmdline.c

index ffdad537822dd1dd35127c9ff533e024dbd1e2be..0253cc3fecf86e4d423290afea275a00b4b14d63 100755 (executable)
@@ -115,7 +115,7 @@ do
     vgremove -f $vg
     pvremove -f $dev1
 done
-not vgcreate -c n --metadatacopies 0 $vg $dev1
+not vgcreate -c n --pvmetadatacopies 0 $vg $dev1
 pvcreate --metadatacopies 1 $dev2
 vgcreate -c n --pvmetadatacopies 0 $vg $dev1 $dev2
 check_pv_field_ $dev1 pv_mda_count 0
index 6a5479d6c389b36672e98f3f05edd12e5703d9c3..45762b50d026f7d6b8e65b591514410cba0aa019 100644 (file)
@@ -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 */
This page took 0.043668 seconds and 5 git commands to generate.