summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2019-02-06 13:46:35 -0600
committerDavid Teigland <teigland@redhat.com>2019-05-24 14:31:48 -0500
commit304fe16665b38992c4796d5bba464bd77f75130c (patch)
tree7b6b6b2731c39ac0ea65b7bbb09ba9de68cf4cd4
parent47bb622ff6e976171fada29251a433320b0c22d7 (diff)
downloadlvm2-304fe16665b38992c4796d5bba464bd77f75130c.tar.gz
vgcfgbackup add error messages
-rw-r--r--tools/vgcfgbackup.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/vgcfgbackup.c b/tools/vgcfgbackup.c
index 7d061d517..5a0fb13fa 100644
--- a/tools/vgcfgbackup.c
+++ b/tools/vgcfgbackup.c
@@ -73,6 +73,15 @@ static int _vg_backup_single(struct cmd_context *cmd, const char *vg_name,
return ECMD_FAILED;
}
+ 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;
+ }
+
/* just use the normal backup code */
backup_enable(cmd, 1); /* force a backup */
if (!backup(vg))
@@ -97,6 +106,14 @@ 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,