1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

report: recognize list of keys to sort report by (-O|--sort) for each subreport; make -O|--sort groupable

This commit is contained in:
Peter Rajnoha 2016-05-26 15:12:38 +02:00
parent bd26684d5d
commit e081203f3e
3 changed files with 20 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.158 -
=================================
Make -O|--sort option groupable that allows this option to be repeated.
Add --configreport option to select report for which next options are applied.
Add support for priorities on grouping command arguments.
Add report/{pvs,vgs,lvs,pvsegs,segs}_{cols,sort}_full to lvm.conf.

View File

@ -192,7 +192,7 @@ arg(nofsck_ARG, 'n', "nofsck", NULL, 0, 0)
arg(novolumegroup_ARG, 'n', "novolumegroup", NULL, 0, 0)
arg(oldpath_ARG, 'n', "oldpath", NULL, 0, 0)
arg(options_ARG, 'o', "options", string_arg, ARG_GROUPABLE, 0)
arg(sort_ARG, 'O', "sort", string_arg, 0, 0)
arg(sort_ARG, 'O', "sort", string_arg, ARG_GROUPABLE, 0)
arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", int_arg, 0, 0)
arg(permission_ARG, 'p', "permission", permission_arg, 0, 0)
arg(partial_ARG, 'P', "partial", NULL, 0, 0)

View File

@ -892,10 +892,26 @@ static int _get_report_keys(struct cmd_context *cmd,
struct report_args *args,
struct single_report_args *single_args)
{
int r = ECMD_PROCESSED;
struct arg_value_group_list *current_group;
const char *report_name = NULL;
report_idx_t idx = REPORT_IDX_SINGLE;
int r = ECMD_FAILED;
single_args->keys = arg_str_value(cmd, sort_ARG, single_args->keys);
dm_list_iterate_items(current_group, &cmd->arg_value_groups) {
if (!grouped_arg_is_set(current_group->arg_values, sort_ARG))
continue;
if (grouped_arg_is_set(current_group->arg_values, configreport_ARG)) {
report_name = grouped_arg_str_value(current_group->arg_values, configreport_ARG, NULL);
if ((idx = _get_report_idx_from_name(single_args->report_type, report_name)) == REPORT_IDX_NULL)
goto_out;
}
args->single_args[idx].keys = grouped_arg_str_value(current_group->arg_values, sort_ARG, NULL);
}
r = ECMD_PROCESSED;
out:
return r;
}