master - toolib: fix ignore_vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d8923457b82456ebee3e333b3fcc26087483cd01 Commit: d8923457b82456ebee3e333b3fcc26087483cd01 Parent: 06e3f1757eee0005267bbe1e088dd95638540849 Author: Zdenek Kabelac <[email protected]> AuthorDate: Fri Nov 14 10:50:31 2014 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Fri Nov 14 18:10:45 2014 +0100
toolib: fix ignore_vg
Rework ignore_vg() API so it properly handles
multiple kind of vg_read_error() states.
Skip processing only otherwise valid VG.
Always return ECMD_FAILED when break is detected.
Check sigint_caught() in front of dm iterator loop.
Add stack for _process failing ret codes.
--- WHATS_NEW | 1 + tools/reporter.c | 22 +++--- tools/toollib.c | 201 ++++++++++++++++++++++++++---------------------------- tools/toollib.h | 2 +- 4 files changed, 112 insertions(+), 114 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.113 - ===================================== + Fix ignore_vg() to properly react on various vg_read errors (2.02.112). Failed recovery returns FAILED_RECOVERY status flag for vg_read(). Exit with non-zero status code when pvck encounters a problem. Fix clean_tree after activation/resume for cache target (2.02.112).
tools/reporter.c +12 -10
@@ -361,12 +361,13 @@ static int _pvs_in_vg(struct cmd_context *cmd, const char *vg_name,struct volume_group *vg, void *handle) { - int ret = ECMD_PROCESSED; + int skip; -if (ignore_vg (vg, vg_name,0 , &ret)) { - stack; -return ret; - } +if (ignore_vg (vg, vg_name,0 , &skip)) + return_ECMD_FAILED; + +if (skip) +return ECMD_PROCESSED ;return process_each_pv_in_vg (cmd, vg, handle, &_pvs_single); }
@@ -375,12 +376,13 @@ static int _pvsegs_in_vg(struct cmd_context *cmd, const char *vg_name,struct volume_group *vg, void *handle) { - int ret = ECMD_PROCESSED; + int skip; -if (ignore_vg (vg, vg_name,0 , &ret)) { - stack; -return ret; - } +if (ignore_vg (vg, vg_name,0 , &skip)) + return_ECMD_FAILED; + +if (skip) +return ECMD_PROCESSED ;return process_each_pv_in_vg (cmd, vg, handle, &_pvsegs_single); }
tools/toollib.c +98 -103
338 lines not on this page · raw message
tools/toollib.h +1 -1
@@ -20,7 +20,7 @@int become_daemon (struct cmd_context *cmd,int skip_lvm); -int ignore_vg (struct volume_group *vg,const char *vg_name,int allow_inconsistent,int *ret); +int ignore_vg (struct volume_group *vg,const char *vg_name,int allow_inconsistent,int *skip); typedef int (*process_single_vg_fn_t) (struct cmd_context * cmd, const char *vg_name,