1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-24 17:57:48 +03:00

report: compare --configreport value with basic report type

Reporting commands can be of different types (even if the command name
is the same):
  - pvs command can be either of PVS, PVSEGS or LABEL report type,
  - vgs command is of VGS report type,
  - lvs command is of LVS or SEGS report type.

Use basic report type when looking for report prefix used for
--configreport option.

This means that:
  - 'pvs --configreport pv' applies to PVS, PVSEGS or LABEL report type
  - 'vgs --configreport vg' applies to VGS report type
  - 'lvs --configreport lv' applies to LVS and SEGS report type
This commit is contained in:
Peter Rajnoha 2016-06-20 13:15:33 +02:00
parent 2593cab5c4
commit db6b4c1eef

View File

@ -747,6 +747,14 @@ static report_idx_t _get_report_idx_from_name(report_type_t report_type, const c
if (!name || !*name)
return REPORT_IDX_NULL;
/* Change to basic report type for comparison. */
if (report_type == LABEL)
report_type = PVS;
else if (report_type == SEGS)
report_type = LVS;
else if (report_type == PVSEGS)
report_type = PVSEGS;
if (!strcasecmp(name, "log"))
idx = REPORT_IDX_LOG;
else if (!strcasecmp(name, "vg"))
@ -755,10 +763,12 @@ static report_idx_t _get_report_idx_from_name(report_type_t report_type, const c
idx = _get_report_idx(report_type, PVS);
else if (!strcasecmp(name, "lv"))
idx = _get_report_idx(report_type, LVS);
else if (!strcasecmp(name, "pvseg"))
idx = _get_report_idx(report_type, PVSEGS);
else if (!strcasecmp(name, "seg"))
idx = _get_report_idx(report_type, SEGS);
else if (!strcasecmp(name, "pvseg")) {
idx = (report_type == FULL) ? _get_report_idx(report_type, PVSEGS)
: _get_report_idx(report_type, PVS);
} else if (!strcasecmp(name, "seg"))
idx = (report_type == FULL) ? _get_report_idx(report_type, SEGS)
: _get_report_idx(report_type, LVS);
else {
idx = REPORT_IDX_NULL;
log_error("Unknonwn report specifier in "