]> sourceware.org Git - lvm2.git/commitdiff
Fix for bug 612311: Split of linear provides no error msg
authorJonathan Earl Brassow <jbrassow@redhat.com>
Tue, 13 Jul 2010 21:53:07 +0000 (21:53 +0000)
committerJonathan Earl Brassow <jbrassow@redhat.com>
Tue, 13 Jul 2010 21:53:07 +0000 (21:53 +0000)
An unhandled condition allowed the command to terminate
cleanly without a warning.  Added a check for the
'--splitmirrors' argument to allow execution to the lower
level function that has the check to see if the user is
trying to split a linear device.  You should now see a
message if you try to use --splitmirrors on a linear device.

tools/lvconvert.c

index ffdbd07f3c8795a8b6dcc9286244b9bd09b50f30..77ddce80948ef7069d048fe59decbb1dad8d89d6 100644 (file)
@@ -861,7 +861,8 @@ static int _lvconvert_mirrors_parse_params(struct cmd_context *cmd,
        else if (lp->mirrors_sign == SIGN_PLUS)
                lp->mirrors = *old_mimage_count + lp->mirrors;
        else if (lp->mirrors_sign == SIGN_MINUS)
-               lp->mirrors = *old_mimage_count - lp->mirrors;
+               lp->mirrors = (*old_mimage_count > lp->mirrors) ?
+                       *old_mimage_count - lp->mirrors: 0;
        else
                lp->mirrors += 1;
 
@@ -876,8 +877,8 @@ static int _lvconvert_mirrors_parse_params(struct cmd_context *cmd,
 
        /* Did the user try to subtract more legs than available? */
        if (lp->mirrors < 1) {
-               log_error("Logical volume %s only has %" PRIu32 " mirrors.",
-                         lv->name, *old_mimage_count);
+               log_error("Unable to reduce images by specified amount - only %d in %s",
+                         *old_mimage_count, lv->name);
                return 0;
        }
 
@@ -1561,7 +1562,9 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
                        stack;
                        return ECMD_FAILED;
                }
-       } else if (arg_count(cmd, mirrors_ARG) || (lv->status & MIRRORED)) {
+       } else if (arg_count(cmd, mirrors_ARG) ||
+                  arg_count(cmd, splitmirrors_ARG) ||
+                  (lv->status & MIRRORED)) {
                if (!archive(lv->vg)) {
                        stack;
                        return ECMD_FAILED;
This page took 0.042321 seconds and 5 git commands to generate.