diff options
author | Dave Wysochanski <dwysocha@redhat.com> | 2009-07-01 17:00:50 +0000 |
---|---|---|
committer | Dave Wysochanski <dwysocha@redhat.com> | 2009-07-01 17:00:50 +0000 |
commit | 13e8c7e4344ec57917f5c74f9bca071274d235ce (patch) | |
tree | fa112cef193eb9bd824953b3a504cfcf5ad6b246 /tools/vgcfgbackup.c | |
parent | b8b3508c59da5eed15b8db507fd8ef6cc771823f (diff) | |
download | lvm2-13e8c7e4344ec57917f5c74f9bca071274d235ce.tar.gz |
Rework the toollib interface (process_each_*) on top of new vg_read.
Sun May 3 12:32:30 CEST 2009 Petr Rockai <me@mornfall.net>
* Rework the toollib interface (process_each_*) on top of new vg_read.
Rebased 6/26/09 by Dave W.
- Add skipping message to process_each_lv
- Remove inconsistent_t.
Diffstat (limited to 'tools/vgcfgbackup.c')
-rw-r--r-- | tools/vgcfgbackup.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/vgcfgbackup.c b/tools/vgcfgbackup.c index 2d77e650d..c8ae40ccb 100644 --- a/tools/vgcfgbackup.c +++ b/tools/vgcfgbackup.c @@ -48,12 +48,15 @@ static char *_expand_filename(const char *template, const char *vg_name, } static int vg_backup_single(struct cmd_context *cmd, const char *vg_name, - struct volume_group *vg, int consistent, + struct volume_group *vg, void *handle) { char **last_filename = (char **)handle; char *filename; + if (vg_read_error(vg) && !vg_read_error(vg) == FAILED_INCONSISTENT) + return ECMD_FAILED; + if (arg_count(cmd, file_ARG)) { if (!(filename = _expand_filename(arg_value(cmd, file_ARG), vg->name, last_filename))) { @@ -64,7 +67,7 @@ static int vg_backup_single(struct cmd_context *cmd, const char *vg_name, if (!backup_to_file(filename, vg->cmd->cmd_line, vg)) return ECMD_FAILED; } else { - if (!consistent) { + if (vg_read_error(vg) == FAILED_INCONSISTENT) { log_error("No backup taken: specify filename with -f " "to backup an inconsistent VG"); stack; @@ -90,8 +93,7 @@ int vgcfgbackup(struct cmd_context *cmd, int argc, char **argv) init_pvmove(1); - ret = process_each_vg(cmd, argc, argv, LCK_VG_READ, - VG_INCONSISTENT_CONTINUE, + ret = process_each_vg(cmd, argc, argv, 0, &last_filename, &vg_backup_single); dm_free(last_filename); |