summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2015-08-20 11:45:35 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2016-02-04 16:20:33 +0100
commit06716ca25eebfdcd007696c6a68adfb381dcbc22 (patch)
tree8ab8284a082069c0b2c7d9e925b786fef8a02808
parent8762dbac9471a29be9b6269df3ba5b3855b8d94b (diff)
downloadlvm2-06716ca25eebfdcd007696c6a68adfb381dcbc22.tar.gz
report: log error if trying to report segments and removed entries at the same time
Removed entries do not have any segments attached anymore - we can't report anything that is segment-related for these volumes so do not allow reporting segment fields while dead LVs are also processed. We could report removed entries together with segment fields if we created dummy lv_segment for such removed volumes, but let's add this later when someone asks for this...
-rw-r--r--tools/reporter.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/reporter.c b/tools/reporter.c
index febd69b41..ec8242372 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -399,7 +399,8 @@ static int _pvsegs_in_vg(struct cmd_context *cmd, const char *vg_name,
return process_each_pv_in_vg(cmd, vg, handle, &_pvsegs_single);
}
-static int _get_final_report_type(int args_are_pvs,
+static int _get_final_report_type(struct cmd_context *cmd,
+ int args_are_pvs,
report_type_t report_type,
int *lv_info_needed,
int *lv_segment_status_needed,
@@ -434,6 +435,11 @@ static int _get_final_report_type(int args_are_pvs,
else if (report_type & (LVS | LVSINFO | LVSSTATUS | LVSINFOSTATUS))
report_type = LVS;
+ if (cmd->include_dead_entities && (report_type & (SEGS | PVSEGS))) {
+ log_error("Can't report segments and removed entries at the same time");
+ return 0;
+ }
+
*final_report_type = report_type;
return 1;
}
@@ -450,7 +456,7 @@ int report_for_selection(struct cmd_context *cmd,
struct processing_handle *handle;
int r = 0;
- if (!_get_final_report_type(args_are_pvs,
+ if (!_get_final_report_type(cmd, args_are_pvs,
sh->orig_report_type | sh->report_type,
&do_lv_info,
&do_lv_seg_status,
@@ -847,7 +853,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
columns_as_rows, selection)))
return_ECMD_FAILED;
- if (!_get_final_report_type(args_are_pvs,
+ if (!_get_final_report_type(cmd, args_are_pvs,
report_type, &lv_info_needed,
&lv_segment_status_needed,
&report_type)) {