diff options
Diffstat (limited to 'tools/vgcfgbackup.c')
-rw-r--r-- | tools/vgcfgbackup.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tools/vgcfgbackup.c b/tools/vgcfgbackup.c index 7d061d517..49779cabe 100644 --- a/tools/vgcfgbackup.c +++ b/tools/vgcfgbackup.c @@ -67,9 +67,12 @@ 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 (vg_read_error(vg) == FAILED_INCONSISTENT) { - log_error("No backup taken: specify filename with -f " - "to backup an inconsistent VG"); + if (vg_missing_pv_count(vg)) { + log_error("No backup taken: specify filename with -f to backup with missing PVs."); + return ECMD_FAILED; + } + if (vg_has_unknown_segments(vg)) { + log_error("No backup taken: specify filename with -f to backup with unknown segments."); return ECMD_FAILED; } @@ -97,9 +100,17 @@ int vgcfgbackup(struct cmd_context *cmd, int argc, char **argv) handle->custom_handle = &last_filename; + /* + * Just set so that we can do the check ourselves above and + * report a helpful error message in place of the error message + * that would be generated from vg_read. + */ + cmd->handles_missing_pvs = 1; + cmd->handles_unknown_segments = 1; + init_pvmove(1); - ret = process_each_vg(cmd, argc, argv, NULL, NULL, READ_ALLOW_INCONSISTENT, 0, + ret = process_each_vg(cmd, argc, argv, NULL, NULL, 0, 0, handle, &_vg_backup_single); free(last_filename); |