]> sourceware.org Git - lvm2.git/commitdiff
lvconvert: fix return codes
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 11 Jul 2014 10:24:32 +0000 (12:24 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 11 Jul 2014 10:49:02 +0000 (12:49 +0200)
Error codes in some function are directly used
as command result - thus return 0 is not error code,
but success - switch to proper ECMD_FAILED.

WHATS_NEW
tools/lvconvert.c

index 77cc2d7c7ba6c3e971f0196f5358fb6840fb8361..dcaaf23b3a83dfd9152639734c8fdd832f066a3e 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.108 -
 =================================
+  Return proper error codes for some failing lvconvert funtions.
   Add initial code to use cache tools (cache_check|dump|repair|restore).
   Add "degraded" activation mode and make it the default.
   Add separate lv_active_{locally,remotely,exclusively} LV reporting fields.
index 2a2a398cedc8b382711f49014a37388db654c69e..62a9d4e7ddbf120692edb39b5442cc509308c5dc 100644 (file)
@@ -894,7 +894,7 @@ int lvconvert_poll(struct cmd_context *cmd, struct logical_volume *lv,
 
        if (dm_snprintf(lv_full_name, sizeof(lv_full_name), "%s/%s", lv->vg->name, lv->name) < 0) {
                log_error(INTERNAL_ERROR "Name \"%s/%s\" is too long.", lv->vg->name, lv->name);
-               return 0;
+               return ECMD_FAILED;
        }
 
        memcpy(uuid, &lv->lvid, sizeof(lv->lvid));
@@ -1995,7 +1995,7 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volu
 
         if (lv_info(cmd, cow, 0, &info, 1, 0)) {
                 if (!lv_check_not_in_use(cmd, cow, &info))
-                        return_0;
+                       return_ECMD_FAILED;
 
                 if ((lp->force == PROMPT) &&
                     lv_is_visible(cow) &&
@@ -3047,8 +3047,11 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
        if (lp->splitsnapshot)
                return _lvconvert_splitsnapshot(cmd, lv, lp);
 
-       if (arg_count(cmd, repair_ARG) && lv_is_thin_pool(lv))
-               return _lvconvert_thinpool_repair(cmd, lv, lp);
+       if (arg_count(cmd, repair_ARG) && lv_is_thin_pool(lv)) {
+               if (!_lvconvert_thinpool_repair(cmd, lv, lp))
+                       return_ECMD_FAILED;
+               return ECMD_PROCESSED;
+       }
 
        if (arg_count(cmd, repair_ARG) &&
            !(lv->status & MIRRORED) && !(lv->status & RAID)) {
@@ -3070,9 +3073,8 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
                 * to consult the default.
                 */
                if (arg_count(cmd, mirrors_ARG) && !lv_is_mirrored(lv)) {
-                       lp->segtype = get_segtype_from_string(cmd, find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL));
-                       if (!lp->segtype)
-                               return_0;
+                       if (!(lp->segtype = get_segtype_from_string(cmd, find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL))))
+                               return_ECMD_FAILED;
                }
        }
        if (lp->merge) {
This page took 0.050405 seconds and 5 git commands to generate.