diff options
author | David Teigland <teigland@redhat.com> | 2013-08-29 16:42:49 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2014-04-22 13:39:49 -0500 |
commit | 7e5e2369823978acc25916d5060dfba7336e4f56 (patch) | |
tree | 47ac868a845d26274abab0d70817be7ea267b551 | |
parent | f5cbb41245801c47336690abd18e0c15dc16f2ab (diff) | |
download | lvm2-7e5e2369823978acc25916d5060dfba7336e4f56.tar.gz |
toollib: improve error message in process_each_lv_in_vg
Include in the error message the lv name args that were not found.
-rw-r--r-- | tools/toollib.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/toollib.c b/tools/toollib.c index fe2938748..353caf045 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -1691,8 +1691,8 @@ int process_each_lv_in_vg(struct cmd_context *cmd, unsigned process_lv = 0; unsigned tags_supplied = 0; unsigned lvargs_supplied = 0; - unsigned lvargs_matched = 0; struct lv_list *lvl; + struct str_list *sl; if (!vg_check_status(vg, EXPORTED_VG)) return_ECMD_FAILED; @@ -1753,7 +1753,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, if (lvargs_supplied && str_list_match_item(arg_lvnames, lvl->lv->name)) { process_lv = 1; - lvargs_matched++; + str_list_del(arg_lvnames, lvl->lv->name); } if (!process_lv) @@ -1762,20 +1762,25 @@ int process_each_lv_in_vg(struct cmd_context *cmd, if (sigint_caught()) return_ECMD_FAILED; + log_very_verbose("Processing LV %s in VG %s", lvl->lv->name, vg->name); + ret = process_single_lv(cmd, lvl->lv, handle); if (ret > ret_max) ret_max = ret; } - if (lvargs_supplied && lvargs_matched != dm_list_size(arg_lvnames)) { + if (lvargs_supplied) { /* * FIXME: lvm supports removal of LV with all its dependencies * this leads to miscalculation that depends on the order of args. */ - log_error("One or more specified logical volume(s) not found."); - if (ret_max < ECMD_FAILED) - ret_max = ECMD_FAILED; + dm_list_iterate_items(sl, arg_lvnames) { + log_error("Failed to find logical volume \"%s/%s\"", + vg->name, sl->str); + if (ret_max < ECMD_FAILED) + ret_max = ECMD_FAILED; + } } return ret_max; |