master - report: recognize list of keys to sort report by (-O|--sort) for each subreport; make -O|--sort groupable
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e081203f3e2ee5...
Commit: e081203f3e2ee5e3270c7f5f2753ed446d8b72cb
Parent: bd26684d5d9f44f7677f6e30a461542d4280a1b9
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu May 26 15:12:38 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:42 2016 +0200
report: recognize list of keys to sort report by (-O|--sort) for each subreport; make -O|--sort groupable
---
WHATS_NEW | 1 +
tools/args.h | 2 +-
tools/reporter.c | 20 ++++++++++++++++++--
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8afc577..fb5d3e7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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.
diff --git a/tools/args.h b/tools/args.h
index c0e0864..985f5d1 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -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)
diff --git a/tools/reporter.c b/tools/reporter.c
index c081e1c..8165288 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -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;
}
7 years, 11 months
master - report: recognize list of fields to report (-o|--options) for each subreport
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bd26684d5d9f44...
Commit: bd26684d5d9f44f7677f6e30a461542d4280a1b9
Parent: 80ffaefb88917f77eafdf36dd4f882cc65706050
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed May 4 14:07:45 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:42 2016 +0200
report: recognize list of fields to report (-o|--options) for each subreport
---
tools/reporter.c | 124 +++++++++++++++++++++++++++++++++++-------------------
1 files changed, 81 insertions(+), 43 deletions(-)
diff --git a/tools/reporter.c b/tools/reporter.c
index 103ae2c..c081e1c 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -694,7 +694,6 @@ static void _del_option_from_list(struct dm_list *sll, const char *prefix,
struct dm_str_list *sl;
const char *a = str, *b;
- prefix_len--;
dm_list_uniterate(slh, sll, sll) {
sl = dm_list_item(slh, struct dm_str_list);
@@ -764,38 +763,61 @@ static int _should_process_report_idx(report_type_t report_type, report_idx_t id
return 1;
}
+enum opts_list_type {
+ OPTS_REPLACE,
+ OPTS_ADD,
+ OPTS_REMOVE,
+ OPTS_COMPACT
+};
+
static int _get_report_options(struct cmd_context *cmd,
struct report_args *args,
struct single_report_args *single_args)
{
- const char *prefix = report_get_field_prefix(single_args->report_type);
- size_t prefix_len = strlen(prefix);
+ int action;
struct arg_value_group_list *current_group;
- struct dm_list *final_opts_list;
- struct dm_list *final_compact_list = NULL;
+ struct dm_list *final_opts_list[REPORT_IDX_COUNT];
struct dm_list *opts_list = NULL;
struct dm_str_list *sl;
- const char *opts;
struct dm_pool *mem;
- int r = ECMD_PROCESSED;
+ const char *report_name = NULL;
+ const char *opts;
+ report_idx_t idx = REPORT_IDX_SINGLE;
+ int r = ECMD_FAILED;
if (!arg_count(cmd, options_ARG))
return ECMD_PROCESSED;
if (!(mem = dm_pool_create("report_options", 128))) {
log_error("Failed to create temporary mempool to process report options.");
- return ECMD_FAILED;
+ goto out;
}
- if (!(final_opts_list = str_to_str_list(mem, single_args->options, ",", 1))) {
- r = ECMD_FAILED;
- goto_out;
+ if (single_args->report_type == CMDLOG) {
+ if (!(final_opts_list[REPORT_IDX_LOG] = str_to_str_list(mem, single_args->options, ",", 1)))
+ goto_out;
+ } else if (single_args->report_type == FULL) {
+ if (!(final_opts_list[REPORT_IDX_FULL_VGS] = str_to_str_list(mem, args->single_args[REPORT_IDX_FULL_VGS].options, ",", 1)) ||
+ !(final_opts_list[REPORT_IDX_FULL_PVS] = str_to_str_list(mem, args->single_args[REPORT_IDX_FULL_PVS].options, ",", 1)) ||
+ !(final_opts_list[REPORT_IDX_FULL_LVS] = str_to_str_list(mem, args->single_args[REPORT_IDX_FULL_LVS].options, ",", 1)) ||
+ !(final_opts_list[REPORT_IDX_FULL_PVSEGS] = str_to_str_list(mem, args->single_args[REPORT_IDX_FULL_PVSEGS].options, ",", 1)) ||
+ !(final_opts_list[REPORT_IDX_FULL_SEGS] = str_to_str_list(mem, args->single_args[REPORT_IDX_FULL_SEGS].options, ",", 1)))
+ goto_out;
+ } else {
+ if (!(final_opts_list[REPORT_IDX_SINGLE] = str_to_str_list(mem, single_args->options, ",", 1)))
+ goto_out;
}
dm_list_iterate_items(current_group, &cmd->arg_value_groups) {
if (!grouped_arg_is_set(current_group->arg_values, options_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;
+ }
+
opts = grouped_arg_str_value(current_group->arg_values, options_ARG, NULL);
if (!opts || !*opts) {
log_error("Invalid options string: %s", opts);
@@ -805,48 +827,64 @@ static int _get_report_options(struct cmd_context *cmd,
switch (*opts) {
case '+':
- /* fall through */
+ action = OPTS_ADD;
+ opts++;
+ break;
case '-':
- /* fall through */
+ action = OPTS_REMOVE;
+ opts++;
+ break;
case '#':
- if (!(opts_list = str_to_str_list(mem, opts + 1, ",", 1))) {
- r = ECMD_FAILED;
- goto_out;
- }
- if (*opts == '+') {
- dm_list_splice(final_opts_list, opts_list);
- } else if (*opts == '-') {
- dm_list_iterate_items(sl, opts_list)
- _del_option_from_list(final_opts_list, prefix,
- prefix_len, sl->str);
- } else if (*opts == '#') {
- if (!final_compact_list)
- final_compact_list = opts_list;
- else
- dm_list_splice(final_compact_list, opts_list);
- }
+ action = OPTS_COMPACT;
+ opts++;
break;
default:
- if (!(final_opts_list = str_to_str_list(mem, opts, ",", 1))) {
- r = ECMD_FAILED;
- goto_out;
- }
+ action = OPTS_REPLACE;
}
- }
- if (!(single_args->options = str_list_to_str(cmd->mem, final_opts_list, ","))) {
- r = ECMD_FAILED;
- goto_out;
+ if (!_should_process_report_idx(single_args->report_type, idx))
+ continue;
+
+ if ((action != OPTS_COMPACT) &&
+ !(opts_list = str_to_str_list(mem, opts, ",", 1)))
+ goto_out;
+
+ switch (action) {
+ case OPTS_ADD:
+ dm_list_splice(final_opts_list[idx], opts_list);
+ break;
+ case OPTS_REMOVE:
+ dm_list_iterate_items(sl, opts_list)
+ _del_option_from_list(final_opts_list[idx], args->single_args[idx].report_prefix,
+ strlen(args->single_args[idx].report_prefix), sl->str);
+ break;
+ case OPTS_COMPACT:
+ args->single_args[idx].fields_to_compact = opts;
+ break;
+ case OPTS_REPLACE:
+ final_opts_list[idx] = opts_list;
+ break;
+ }
}
- if (final_compact_list &&
- !(single_args->fields_to_compact = str_list_to_str(cmd->mem, final_compact_list, ","))) {
- dm_pool_free(cmd->mem, (char *) single_args->options);
- r = ECMD_FAILED;
- goto_out;
+
+ if (single_args->report_type == CMDLOG) {
+ if (!(single_args->options = str_list_to_str(cmd->mem, final_opts_list[REPORT_IDX_LOG], ",")))
+ goto_out;
+ } else if (single_args->report_type == FULL) {
+ if (!(args->single_args[REPORT_IDX_FULL_VGS].options = str_list_to_str(cmd->mem, final_opts_list[REPORT_IDX_FULL_VGS], ",")) ||
+ !(args->single_args[REPORT_IDX_FULL_PVS].options = str_list_to_str(cmd->mem, final_opts_list[REPORT_IDX_FULL_PVS], ",")) ||
+ !(args->single_args[REPORT_IDX_FULL_LVS].options = str_list_to_str(cmd->mem, final_opts_list[REPORT_IDX_FULL_LVS], ",")) ||
+ !(args->single_args[REPORT_IDX_FULL_PVSEGS].options = str_list_to_str(cmd->mem, final_opts_list[REPORT_IDX_FULL_PVSEGS], ",")) ||
+ !(args->single_args[REPORT_IDX_FULL_SEGS].options = str_list_to_str(cmd->mem, final_opts_list[REPORT_IDX_FULL_SEGS], ",")))
+ goto_out;
+ } else {
+ if (!(single_args->options = str_list_to_str(cmd->mem, final_opts_list[REPORT_IDX_SINGLE], ",")))
+ goto_out;
}
+
+ r = ECMD_PROCESSED;
out:
dm_pool_destroy(mem);
-
return r;
}
7 years, 11 months
master - report: add _get_report_idx_from_name and _should_process_report_idx helper fns
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=80ffaefb88917f...
Commit: 80ffaefb88917f77eafdf36dd4f882cc65706050
Parent: 28b4c48e2ae66b87bbb5d8fd29b761edba63a90e
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu May 26 15:50:52 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:42 2016 +0200
report: add _get_report_idx_from_name and _should_process_report_idx helper fns
Prepare for recognition of cmd line options for each subreport within
one command.
---
tools/reporter.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/tools/reporter.c b/tools/reporter.c
index 408d410..103ae2c 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -723,6 +723,47 @@ static void _del_option_from_list(struct dm_list *sll, const char *prefix,
}
}
+#define _get_report_idx(report_type,single_report_type) \
+ (((report_type != FULL) && (report_type == single_report_type)) ? REPORT_IDX_SINGLE : REPORT_IDX_FULL_ ## single_report_type)
+
+static report_idx_t _get_report_idx_from_name(report_type_t report_type, const char *name)
+{
+ report_idx_t idx;
+
+ if (!name || !*name)
+ return REPORT_IDX_NULL;
+
+ if (!strcasecmp(name, "log"))
+ idx = REPORT_IDX_LOG;
+ else if (!strcasecmp(name, "vg"))
+ idx = _get_report_idx(report_type, VGS);
+ else if (!strcasecmp(name, "pv"))
+ 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 {
+ idx = REPORT_IDX_NULL;
+ log_error("Unknonwn report specifier in "
+ "report option list: %s.", name);
+ }
+
+ return idx;
+}
+
+static int _should_process_report_idx(report_type_t report_type, report_idx_t idx)
+{
+ if (((idx == REPORT_IDX_LOG) && (report_type != CMDLOG)) ||
+ ((idx == REPORT_IDX_SINGLE) && ((report_type == FULL) || (report_type == CMDLOG))) ||
+ ((idx > REPORT_IDX_LOG) && report_type != FULL))
+ return 0;
+
+ return 1;
+}
+
static int _get_report_options(struct cmd_context *cmd,
struct report_args *args,
struct single_report_args *single_args)
7 years, 11 months
master - args: add --configreport arg
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=28b4c48e2ae66b...
Commit: 28b4c48e2ae66b87bbb5d8fd29b761edba63a90e
Parent: d23c5b93183675199ff78ff288e4bbd12f935515
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 16 15:49:18 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:42 2016 +0200
args: add --configreport arg
---
WHATS_NEW | 1 +
tools/args.h | 1 +
tools/commands.h | 3 ++-
3 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 626851e..8afc577 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.158 -
=================================
+ 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.
Add lvm fullreport command for joined PV, VG, LV and segment report per VG.
diff --git a/tools/args.h b/tools/args.h
index 8d66809..c0e0864 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -31,6 +31,7 @@ arg(cachemode_ARG, '\0', "cachemode", cachemode_arg, 0, 0)
arg(cachepool_ARG, '\0', "cachepool", string_arg, 0, 0)
arg(commandprofile_ARG, '\0', "commandprofile", string_arg, 0, 0)
arg(config_ARG, '\0', "config", string_arg, 0, 0)
+arg(configreport_ARG, '\0', "configreport", string_arg, ARG_GROUPABLE, 1)
arg(configtype_ARG, '\0', "type", string_arg, 0, 0)
arg(corelog_ARG, '\0', "corelog", NULL, 0, 0)
arg(dataalignment_ARG, '\0', "dataalignment", size_kb_arg, 0, 0)
diff --git a/tools/commands.h b/tools/commands.h
index a9e4be5..3f0fff5 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -714,6 +714,7 @@ xx(lvs,
"\t[--aligned]\n"
"\t[--binary]\n"
"\t[--commandprofile ProfileName]\n"
+ "\t[--configreport ReportName]\n"
"\t[-d|--debug]\n"
"\t[--foreign]\n"
"\t[-h|--help]\n"
@@ -740,7 +741,7 @@ xx(lvs,
"\t[--version]\n"
"\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n",
- aligned_ARG, all_ARG, binary_ARG, foreign_ARG, history_ARG,
+ aligned_ARG, all_ARG, binary_ARG, configreport_ARG, foreign_ARG, history_ARG,
ignorelockingfailure_ARG, ignoreskippedcluster_ARG, nameprefixes_ARG,
noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
readonly_ARG, reportformat_ARG, rows_ARG, segments_ARG, select_ARG,
7 years, 11 months
master - args: add priorities for grouping args
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d23c5b93183675...
Commit: d23c5b93183675199ff78ff288e4bbd12f935515
Parent: 9c37b7ed7c33bb6e66daf369fd563c52f6743282
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jun 17 11:03:14 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:42 2016 +0200
args: add priorities for grouping args
Groupable args (the ones marked with ARG_GROUPABLE flag) start a new
group of args if:
- this is the first time we hit such a groupable arg,
- or if non-countable arg is repeated.
However, there may be cases where we want to give priorities when
forming groups and hence force new group creation if we hit an arg
with higher grouping priority.
For example, let's assume (for now) hypothetical sequence of args used:
lvs -o lv_name --configreport log -o log_type --configreport lv -o +vg_name
Without giving any priorites, we end up with:
lvs -o lv_name --configreport log -o log_type --configreport lv -o +vg_name
| | | | | |
\__________GROUP1___________/ \________GROUP2___________/ \_GROUP3_/
This is because we hit "-o" as the first groupable arg. The --configreport,
even though it's groupable too, it falls into the previous "-o" group.
While we may need to give priority to the --configreport arg that should
always start a new group in this scenario instead:
lvs -o lv_name --configreport log -o log_type --configreport lv -o +vg_name
| | | | | |
\_GROUP1_/ \_________GROUP2___________/ \_________GROUP3__________/
So here "-o" started a new group but since "--configreport" has higher
priority than "-o", it starts fresh new group now and hence the rest of
the command line's args are grouped by --configreport now.
---
WHATS_NEW | 1 +
tools/args.h | 396 ++++++++++++++++++++++++++--------------------------
tools/lvmcmdline.c | 14 ++-
tools/tools.h | 4 +-
4 files changed, 213 insertions(+), 202 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4e87e47..626851e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.158 -
=================================
+ Add support for priorities on grouping command arguments.
Add report/{pvs,vgs,lvs,pvsegs,segs}_{cols,sort}_full to lvm.conf.
Add lvm fullreport command for joined PV, VG, LV and segment report per VG.
Integrate report group handling and cmd log report into cmd processing code.
diff --git a/tools/args.h b/tools/args.h
index 049ea5a..8d66809 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2016 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -17,209 +17,209 @@
* Put all long args that don't have a corresponding short option first.
*/
/* *INDENT-OFF* */
-arg(abort_ARG, '\0', "abort", NULL, 0)
-arg(activationmode_ARG, '\0', "activationmode", string_arg, 0)
-arg(addtag_ARG, '\0', "addtag", tag_arg, ARG_GROUPABLE)
-arg(aligned_ARG, '\0', "aligned", NULL, 0)
-arg(alloc_ARG, '\0', "alloc", alloc_arg, 0)
-arg(atomic_ARG, '\0', "atomic", NULL, 0)
-arg(atversion_ARG, '\0', "atversion", string_arg, 0)
-arg(binary_ARG, '\0', "binary", NULL, 0)
-arg(bootloaderareasize_ARG, '\0', "bootloaderareasize", size_mb_arg, 0)
-arg(cache_long_ARG, '\0', "cache", NULL, 0)
-arg(cachemode_ARG, '\0', "cachemode", cachemode_arg, 0)
-arg(cachepool_ARG, '\0', "cachepool", string_arg, 0)
-arg(commandprofile_ARG, '\0', "commandprofile", string_arg, 0)
-arg(config_ARG, '\0', "config", string_arg, 0)
-arg(configtype_ARG, '\0', "type", string_arg, 0)
-arg(corelog_ARG, '\0', "corelog", NULL, 0)
-arg(dataalignment_ARG, '\0', "dataalignment", size_kb_arg, 0)
-arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", size_kb_arg, 0)
-arg(deltag_ARG, '\0', "deltag", tag_arg, ARG_GROUPABLE)
-arg(detachprofile_ARG, '\0', "detachprofile", NULL, 0)
-arg(discards_ARG, '\0', "discards", discards_arg, 0)
-arg(driverloaded_ARG, '\0', "driverloaded", yes_no_arg, 0)
-arg(errorwhenfull_ARG, '\0', "errorwhenfull", yes_no_arg, 0)
-arg(force_long_ARG, '\0', "force", NULL, ARG_COUNTABLE)
-arg(foreign_ARG, '\0', "foreign", NULL, 0)
-arg(handlemissingpvs_ARG, '\0', "handlemissingpvs", NULL, 0)
-arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", NULL, 0)
-arg(ignorelocal_ARG, '\0', "ignorelocal", NULL, 0)
-arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0)
-arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
-arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", NULL, 0)
-arg(ignoreunsupported_ARG, '\0', "ignoreunsupported", NULL, 0)
-arg(labelsector_ARG, '\0', "labelsector", int_arg, 0)
-arg(lockopt_ARG, '\0', "lockopt", string_arg, 0)
-arg(lockstart_ARG, '\0', "lockstart", NULL, 0)
-arg(lockstop_ARG, '\0', "lockstop", NULL, 0)
-arg(locktype_ARG, '\0', "locktype", locktype_arg, 0)
-arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", size_kb_arg, 0)
-arg(merge_ARG, '\0', "merge", NULL, 0)
-arg(mergedconfig_ARG, '\0', "mergedconfig", NULL, 0)
-arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_arg, 0)
-arg(metadataignore_ARG, '\0', "metadataignore", yes_no_arg, 0)
-arg(metadataprofile_ARG, '\0', "metadataprofile", string_arg, 0)
-arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0)
-arg(minor_ARG, '\0', "minor", int_arg, ARG_GROUPABLE)
-arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", size_kb_arg, 0)
-arg(mirrorlog_ARG, '\0', "mirrorlog", mirrorlog_arg, 0)
-arg(mirrorsonly_ARG, '\0', "mirrorsonly", NULL, 0)
-arg(mknodes_ARG, '\0', "mknodes", NULL, 0)
-arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0)
-arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0)
-arg(noheadings_ARG, '\0', "noheadings", NULL, 0)
-arg(nohistory_ARG, '\0', "nohistory", NULL, 0)
-arg(nolocking_ARG, '\0', "nolocking", NULL, 0)
-arg(norestorefile_ARG, '\0', "norestorefile", NULL, 0)
-arg(nosuffix_ARG, '\0', "nosuffix", NULL, 0)
-arg(nosync_ARG, '\0', "nosync", NULL, 0)
-arg(notifydbus_ARG, '\0', "notifydbus", NULL, 0)
-arg(noudevsync_ARG, '\0', "noudevsync", NULL, 0)
-arg(originname_ARG, '\0', "originname", string_arg, 0)
-arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0)
-arg(poll_ARG, '\0', "poll", yes_no_arg, 0)
-arg(polloperation_ARG, '\0', "polloperation", string_arg, 0)
-arg(pooldatasize_ARG, '\0', "pooldatasize", size_mb_arg, 0)
-arg(poolmetadata_ARG, '\0', "poolmetadata", string_arg, 0)
-arg(poolmetadatasize_ARG, '\0', "poolmetadatasize", size_mb_arg, 0)
-arg(poolmetadataspare_ARG, '\0', "poolmetadataspare", yes_no_arg, 0)
-arg(profile_ARG, '\0', "profile", string_arg, 0)
-arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", int_arg, 0)
-arg(raidmaxrecoveryrate_ARG, '\0', "raidmaxrecoveryrate", size_kb_arg, 0)
-arg(raidminrecoveryrate_ARG, '\0', "raidminrecoveryrate", size_kb_arg, 0)
-arg(raidsyncaction_ARG, '\0', "raidsyncaction", string_arg, 0)
-arg(raidwritebehind_ARG, '\0', "raidwritebehind", int_arg, 0)
-arg(raidwritemostly_ARG, '\0', "raidwritemostly", string_arg, ARG_GROUPABLE)
-arg(readonly_ARG, '\0', "readonly", NULL, 0)
-arg(refresh_ARG, '\0', "refresh", NULL, 0)
-arg(removemissing_ARG, '\0', "removemissing", NULL, 0)
-arg(repair_ARG, '\0', "repair", NULL, 0)
-arg(replace_ARG, '\0', "replace", string_arg, ARG_GROUPABLE)
-arg(reportformat_ARG, '\0', "reportformat", string_arg, 0)
-arg(restorefile_ARG, '\0', "restorefile", string_arg, 0)
-arg(restoremissing_ARG, '\0', "restoremissing", NULL, 0)
-arg(resync_ARG, '\0', "resync", NULL, 0)
-arg(rows_ARG, '\0', "rows", NULL, 0)
-arg(segments_ARG, '\0', "segments", NULL, 0)
-arg(separator_ARG, '\0', "separator", string_arg, 0)
-arg(shared_ARG, '\0', "shared", NULL, 0)
-arg(sinceversion_ARG, '\0', "sinceversion", string_arg, 0)
-arg(split_ARG, '\0', "split", NULL, 0)
-arg(splitcache_ARG, '\0', "splitcache", NULL, 0)
-arg(splitmirrors_ARG, '\0', "splitmirrors", int_arg, 0)
-arg(splitsnapshot_ARG, '\0', "splitsnapshot", NULL, 0)
-arg(showdeprecated_ARG, '\0', "showdeprecated", NULL, 0)
-arg(showunsupported_ARG, '\0', "showunsupported", NULL, 0)
-arg(stripes_long_ARG, '\0', "stripes", int_arg, 0)
-arg(syncaction_ARG, '\0', "syncaction", string_arg, 0) /* FIXME Use custom validation fn */
-arg(sysinit_ARG, '\0', "sysinit", NULL, 0)
-arg(systemid_ARG, '\0', "systemid", string_arg, 0)
-arg(thinpool_ARG, '\0', "thinpool", string_arg, 0)
-arg(trackchanges_ARG, '\0', "trackchanges", NULL, 0)
-arg(trustcache_ARG, '\0', "trustcache", NULL, 0)
-arg(type_ARG, '\0', "type", segtype_arg, 0)
-arg(unbuffered_ARG, '\0', "unbuffered", NULL, 0)
-arg(uncache_ARG, '\0', "uncache", NULL, 0)
-arg(cachepolicy_ARG, '\0', "cachepolicy", string_arg, 0)
-arg(cachesettings_ARG, '\0', "cachesettings", string_arg, ARG_GROUPABLE)
-arg(unconfigured_ARG, '\0', "unconfigured", NULL, 0)
-arg(units_ARG, '\0', "units", string_arg, 0)
-arg(unquoted_ARG, '\0', "unquoted", NULL, 0)
-arg(usepolicies_ARG, '\0', "usepolicies", NULL, 0)
-arg(validate_ARG, '\0', "validate", NULL, 0)
-arg(version_ARG, '\0', "version", NULL, 0)
-arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0)
-arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0)
-arg(withsummary_ARG, '\0', "withsummary", NULL, 0)
-arg(withcomments_ARG, '\0', "withcomments", NULL, 0)
-arg(withspaces_ARG, '\0', "withspaces", NULL, 0)
-arg(withversions_ARG, '\0', "withversions", NULL, 0)
-arg(writebehind_ARG, '\0', "writebehind", int_arg, 0)
-arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE)
+arg(abort_ARG, '\0', "abort", NULL, 0, 0)
+arg(activationmode_ARG, '\0', "activationmode", string_arg, 0, 0)
+arg(addtag_ARG, '\0', "addtag", tag_arg, ARG_GROUPABLE, 0)
+arg(aligned_ARG, '\0', "aligned", NULL, 0, 0)
+arg(alloc_ARG, '\0', "alloc", alloc_arg, 0, 0)
+arg(atomic_ARG, '\0', "atomic", NULL, 0, 0)
+arg(atversion_ARG, '\0', "atversion", string_arg, 0, 0)
+arg(binary_ARG, '\0', "binary", NULL, 0, 0)
+arg(bootloaderareasize_ARG, '\0', "bootloaderareasize", size_mb_arg, 0, 0)
+arg(cache_long_ARG, '\0', "cache", NULL, 0, 0)
+arg(cachemode_ARG, '\0', "cachemode", cachemode_arg, 0, 0)
+arg(cachepool_ARG, '\0', "cachepool", string_arg, 0, 0)
+arg(commandprofile_ARG, '\0', "commandprofile", string_arg, 0, 0)
+arg(config_ARG, '\0', "config", string_arg, 0, 0)
+arg(configtype_ARG, '\0', "type", string_arg, 0, 0)
+arg(corelog_ARG, '\0', "corelog", NULL, 0, 0)
+arg(dataalignment_ARG, '\0', "dataalignment", size_kb_arg, 0, 0)
+arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", size_kb_arg, 0, 0)
+arg(deltag_ARG, '\0', "deltag", tag_arg, ARG_GROUPABLE, 0)
+arg(detachprofile_ARG, '\0', "detachprofile", NULL, 0, 0)
+arg(discards_ARG, '\0', "discards", discards_arg, 0, 0)
+arg(driverloaded_ARG, '\0', "driverloaded", yes_no_arg, 0, 0)
+arg(errorwhenfull_ARG, '\0', "errorwhenfull", yes_no_arg, 0, 0)
+arg(force_long_ARG, '\0', "force", NULL, ARG_COUNTABLE, 0)
+arg(foreign_ARG, '\0', "foreign", NULL, 0, 0)
+arg(handlemissingpvs_ARG, '\0', "handlemissingpvs", NULL, 0, 0)
+arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", NULL, 0, 0)
+arg(ignorelocal_ARG, '\0', "ignorelocal", NULL, 0, 0)
+arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0, 0)
+arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0, 0)
+arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", NULL, 0, 0)
+arg(ignoreunsupported_ARG, '\0', "ignoreunsupported", NULL, 0, 0)
+arg(labelsector_ARG, '\0', "labelsector", int_arg, 0, 0)
+arg(lockopt_ARG, '\0', "lockopt", string_arg, 0, 0)
+arg(lockstart_ARG, '\0', "lockstart", NULL, 0, 0)
+arg(lockstop_ARG, '\0', "lockstop", NULL, 0, 0)
+arg(locktype_ARG, '\0', "locktype", locktype_arg, 0, 0)
+arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", size_kb_arg, 0, 0)
+arg(merge_ARG, '\0', "merge", NULL, 0, 0)
+arg(mergedconfig_ARG, '\0', "mergedconfig", NULL, 0, 0)
+arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_arg, 0, 0)
+arg(metadataignore_ARG, '\0', "metadataignore", yes_no_arg, 0, 0)
+arg(metadataprofile_ARG, '\0', "metadataprofile", string_arg, 0, 0)
+arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0, 0)
+arg(minor_ARG, '\0', "minor", int_arg, ARG_GROUPABLE, 0)
+arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", size_kb_arg, 0, 0)
+arg(mirrorlog_ARG, '\0', "mirrorlog", mirrorlog_arg, 0, 0)
+arg(mirrorsonly_ARG, '\0', "mirrorsonly", NULL, 0, 0)
+arg(mknodes_ARG, '\0', "mknodes", NULL, 0, 0)
+arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0, 0)
+arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0, 0)
+arg(noheadings_ARG, '\0', "noheadings", NULL, 0, 0)
+arg(nohistory_ARG, '\0', "nohistory", NULL, 0, 0)
+arg(nolocking_ARG, '\0', "nolocking", NULL, 0, 0)
+arg(norestorefile_ARG, '\0', "norestorefile", NULL, 0, 0)
+arg(nosuffix_ARG, '\0', "nosuffix", NULL, 0, 0)
+arg(nosync_ARG, '\0', "nosync", NULL, 0, 0)
+arg(notifydbus_ARG, '\0', "notifydbus", NULL, 0, 0)
+arg(noudevsync_ARG, '\0', "noudevsync", NULL, 0, 0)
+arg(originname_ARG, '\0', "originname", string_arg, 0, 0)
+arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0, 0)
+arg(poll_ARG, '\0', "poll", yes_no_arg, 0, 0)
+arg(polloperation_ARG, '\0', "polloperation", string_arg, 0, 0)
+arg(pooldatasize_ARG, '\0', "pooldatasize", size_mb_arg, 0, 0)
+arg(poolmetadata_ARG, '\0', "poolmetadata", string_arg, 0, 0)
+arg(poolmetadatasize_ARG, '\0', "poolmetadatasize", size_mb_arg, 0, 0)
+arg(poolmetadataspare_ARG, '\0', "poolmetadataspare", yes_no_arg, 0, 0)
+arg(profile_ARG, '\0', "profile", string_arg, 0, 0)
+arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", int_arg, 0, 0)
+arg(raidmaxrecoveryrate_ARG, '\0', "raidmaxrecoveryrate", size_kb_arg, 0, 0)
+arg(raidminrecoveryrate_ARG, '\0', "raidminrecoveryrate", size_kb_arg, 0, 0)
+arg(raidsyncaction_ARG, '\0', "raidsyncaction", string_arg, 0, 0)
+arg(raidwritebehind_ARG, '\0', "raidwritebehind", int_arg, 0, 0)
+arg(raidwritemostly_ARG, '\0', "raidwritemostly", string_arg, ARG_GROUPABLE, 0)
+arg(readonly_ARG, '\0', "readonly", NULL, 0, 0)
+arg(refresh_ARG, '\0', "refresh", NULL, 0, 0)
+arg(removemissing_ARG, '\0', "removemissing", NULL, 0, 0)
+arg(repair_ARG, '\0', "repair", NULL, 0, 0)
+arg(replace_ARG, '\0', "replace", string_arg, ARG_GROUPABLE, 0)
+arg(reportformat_ARG, '\0', "reportformat", string_arg, 0, 0)
+arg(restorefile_ARG, '\0', "restorefile", string_arg, 0, 0)
+arg(restoremissing_ARG, '\0', "restoremissing", NULL, 0, 0)
+arg(resync_ARG, '\0', "resync", NULL, 0, 0)
+arg(rows_ARG, '\0', "rows", NULL, 0, 0)
+arg(segments_ARG, '\0', "segments", NULL, 0, 0)
+arg(separator_ARG, '\0', "separator", string_arg, 0, 0)
+arg(shared_ARG, '\0', "shared", NULL, 0, 0)
+arg(sinceversion_ARG, '\0', "sinceversion", string_arg, 0, 0)
+arg(split_ARG, '\0', "split", NULL, 0, 0)
+arg(splitcache_ARG, '\0', "splitcache", NULL, 0, 0)
+arg(splitmirrors_ARG, '\0', "splitmirrors", int_arg, 0, 0)
+arg(splitsnapshot_ARG, '\0', "splitsnapshot", NULL, 0, 0)
+arg(showdeprecated_ARG, '\0', "showdeprecated", NULL, 0, 0)
+arg(showunsupported_ARG, '\0', "showunsupported", NULL, 0, 0)
+arg(stripes_long_ARG, '\0', "stripes", int_arg, 0, 0)
+arg(syncaction_ARG, '\0', "syncaction", string_arg, 0, 0) /* FIXME Use custom validation fn */
+arg(sysinit_ARG, '\0', "sysinit", NULL, 0, 0)
+arg(systemid_ARG, '\0', "systemid", string_arg, 0, 0)
+arg(thinpool_ARG, '\0', "thinpool", string_arg, 0, 0)
+arg(trackchanges_ARG, '\0', "trackchanges", NULL, 0, 0)
+arg(trustcache_ARG, '\0', "trustcache", NULL, 0, 0)
+arg(type_ARG, '\0', "type", segtype_arg, 0, 0)
+arg(unbuffered_ARG, '\0', "unbuffered", NULL, 0, 0)
+arg(uncache_ARG, '\0', "uncache", NULL, 0, 0)
+arg(cachepolicy_ARG, '\0', "cachepolicy", string_arg, 0, 0)
+arg(cachesettings_ARG, '\0', "cachesettings", string_arg, ARG_GROUPABLE, 0)
+arg(unconfigured_ARG, '\0', "unconfigured", NULL, 0, 0)
+arg(units_ARG, '\0', "units", string_arg, 0, 0)
+arg(unquoted_ARG, '\0', "unquoted", NULL, 0, 0)
+arg(usepolicies_ARG, '\0', "usepolicies", NULL, 0, 0)
+arg(validate_ARG, '\0', "validate", NULL, 0, 0)
+arg(version_ARG, '\0', "version", NULL, 0, 0)
+arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0, 0)
+arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0, 0)
+arg(withsummary_ARG, '\0', "withsummary", NULL, 0, 0)
+arg(withcomments_ARG, '\0', "withcomments", NULL, 0, 0)
+arg(withspaces_ARG, '\0', "withspaces", NULL, 0, 0)
+arg(withversions_ARG, '\0', "withversions", NULL, 0, 0)
+arg(writebehind_ARG, '\0', "writebehind", int_arg, 0, 0)
+arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE, 0)
/* Allow some variations */
-arg(allocation_ARG, '\0', "allocation", yes_no_arg, 0)
-arg(available_ARG, '\0', "available", activation_arg, 0)
-arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
+arg(allocation_ARG, '\0', "allocation", yes_no_arg, 0, 0)
+arg(available_ARG, '\0', "available", activation_arg, 0, 0)
+arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0, 0)
/*
* ... and now the short args.
*/
-arg(activate_ARG, 'a', "activate", activation_arg, 0)
-arg(all_ARG, 'a', "all", NULL, 0)
-arg(autobackup_ARG, 'A', "autobackup", yes_no_arg, 0)
-arg(activevolumegroups_ARG, 'A', "activevolumegroups", NULL, 0)
-arg(background_ARG, 'b', "background", NULL, 0)
-arg(backgroundfork_ARG, 'b', "background", NULL, 0)
-arg(blockdevice_ARG, 'b', "blockdevice", NULL, 0)
-arg(chunksize_ARG, 'c', "chunksize", size_kb_arg, 0)
-arg(clustered_ARG, 'c', "clustered", yes_no_arg, 0)
-arg(colon_ARG, 'c', "colon", NULL, 0)
-arg(columns_ARG, 'C', "columns", NULL, 0)
-arg(contiguous_ARG, 'C', "contiguous", yes_no_arg, 0)
-arg(debug_ARG, 'd', "debug", NULL, ARG_COUNTABLE)
-arg(exported_ARG, 'e', "exported", NULL, 0)
-arg(physicalextent_ARG, 'E', "physicalextent", NULL, 0)
-arg(file_ARG, 'f', "file", string_arg, 0)
-arg(force_ARG, 'f', "force", NULL, ARG_COUNTABLE)
-arg(full_ARG, 'f', "full", NULL, 0)
-arg(help_ARG, 'h', "help", NULL, 0)
-arg(cache_ARG, 'H', "cache", NULL, 0)
-arg(history_ARG, 'H', "history", NULL, 0)
-arg(help2_ARG, '?', "", NULL, 0)
-arg(interval_ARG, 'i', "interval", int_arg, 0)
-arg(iop_version_ARG, 'i', "iop_version", NULL, 0)
-arg(stripes_ARG, 'i', "stripes", int_arg, 0)
-arg(stripesize_ARG, 'I', "stripesize", size_kb_arg, 0)
-arg(logicalvolume_ARG, 'l', "logicalvolume", int_arg, 0)
-arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", int_arg, 0)
-arg(extents_ARG, 'l', "extents", int_arg_with_sign_and_percent, 0)
-arg(list_ARG, 'l', "list", NULL, 0)
-arg(lvmpartition_ARG, 'l', "lvmpartition", NULL, 0)
-arg(logicalextent_ARG, 'L', "logicalextent", int_arg_with_sign, 0)
-arg(size_ARG, 'L', "size", size_mb_arg, 0)
-arg(persistent_ARG, 'M', "persistent", yes_no_arg, 0)
-arg(major_ARG, 'j', "major", int_arg, ARG_GROUPABLE)
-arg(setactivationskip_ARG, 'k', "setactivationskip", yes_no_arg, 0)
-arg(ignoreactivationskip_ARG, 'K', "ignoreactivationskip", NULL, 0)
-arg(maps_ARG, 'm', "maps", NULL, 0)
-arg(mirrors_ARG, 'm', "mirrors", int_arg_with_sign, 0)
-arg(metadatatype_ARG, 'M', "metadatatype", metadatatype_arg, 0)
-arg(name_ARG, 'n', "name", string_arg, 0)
-arg(nofsck_ARG, 'n', "nofsck", NULL, 0)
-arg(novolumegroup_ARG, 'n', "novolumegroup", NULL, 0)
-arg(oldpath_ARG, 'n', "oldpath", NULL, 0)
-arg(options_ARG, 'o', "options", string_arg, ARG_GROUPABLE)
-arg(sort_ARG, 'O', "sort", string_arg, 0)
-arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", int_arg, 0)
-arg(permission_ARG, 'p', "permission", permission_arg, 0)
-arg(partial_ARG, 'P', "partial", NULL, 0)
-arg(physicalvolume_ARG, 'P', "physicalvolume", NULL, 0)
-arg(quiet_ARG, 'q', "quiet", NULL, ARG_COUNTABLE)
-arg(readahead_ARG, 'r', "readahead", readahead_arg, 0)
-arg(resizefs_ARG, 'r', "resizefs", NULL, 0)
-arg(reset_ARG, 'R', "reset", NULL, 0)
-arg(regionsize_ARG, 'R', "regionsize", size_mb_arg, 0)
-arg(physicalextentsize_ARG, 's', "physicalextentsize", size_mb_arg, 0)
-arg(snapshot_ARG, 's', "snapshot", NULL, 0)
-arg(short_ARG, 's', "short", NULL, 0)
-arg(stdin_ARG, 's', "stdin", NULL, 0)
-arg(select_ARG, 'S', "select", string_arg, 0)
-arg(test_ARG, 't', "test", NULL, 0)
-arg(thin_ARG, 'T', "thin", NULL, 0)
-arg(uuid_ARG, 'u', "uuid", NULL, 0)
-arg(uuidstr_ARG, 'u', "uuid", string_arg, 0)
-arg(uuidlist_ARG, 'U', "uuidlist", NULL, 0)
-arg(verbose_ARG, 'v', "verbose", NULL, ARG_COUNTABLE)
-arg(volumegroup_ARG, 'V', "volumegroup", NULL, 0)
-arg(virtualsize_ARG, 'V', "virtualsize", size_mb_arg, 0)
-arg(wipesignatures_ARG, 'W', "wipesignatures", yes_no_arg, 0)
-arg(allocatable_ARG, 'x', "allocatable", yes_no_arg, 0)
-arg(resizeable_ARG, 'x', "resizeable", yes_no_arg, 0)
-arg(yes_ARG, 'y', "yes", NULL, 0)
-arg(zero_ARG, 'Z', "zero", yes_no_arg, 0)
+arg(activate_ARG, 'a', "activate", activation_arg, 0, 0)
+arg(all_ARG, 'a', "all", NULL, 0, 0)
+arg(autobackup_ARG, 'A', "autobackup", yes_no_arg, 0, 0)
+arg(activevolumegroups_ARG, 'A', "activevolumegroups", NULL, 0, 0)
+arg(background_ARG, 'b', "background", NULL, 0, 0)
+arg(backgroundfork_ARG, 'b', "background", NULL, 0, 0)
+arg(blockdevice_ARG, 'b', "blockdevice", NULL, 0, 0)
+arg(chunksize_ARG, 'c', "chunksize", size_kb_arg, 0, 0)
+arg(clustered_ARG, 'c', "clustered", yes_no_arg, 0, 0)
+arg(colon_ARG, 'c', "colon", NULL, 0, 0)
+arg(columns_ARG, 'C', "columns", NULL, 0, 0)
+arg(contiguous_ARG, 'C', "contiguous", yes_no_arg, 0, 0)
+arg(debug_ARG, 'd', "debug", NULL, ARG_COUNTABLE, 0)
+arg(exported_ARG, 'e', "exported", NULL, 0, 0)
+arg(physicalextent_ARG, 'E', "physicalextent", NULL, 0, 0)
+arg(file_ARG, 'f', "file", string_arg, 0, 0)
+arg(force_ARG, 'f', "force", NULL, ARG_COUNTABLE, 0)
+arg(full_ARG, 'f', "full", NULL, 0, 0)
+arg(help_ARG, 'h', "help", NULL, 0, 0)
+arg(cache_ARG, 'H', "cache", NULL, 0, 0)
+arg(history_ARG, 'H', "history", NULL, 0, 0)
+arg(help2_ARG, '?', "", NULL, 0, 0)
+arg(interval_ARG, 'i', "interval", int_arg, 0, 0)
+arg(iop_version_ARG, 'i', "iop_version", NULL, 0, 0)
+arg(stripes_ARG, 'i', "stripes", int_arg, 0, 0)
+arg(stripesize_ARG, 'I', "stripesize", size_kb_arg, 0, 0)
+arg(logicalvolume_ARG, 'l', "logicalvolume", int_arg, 0, 0)
+arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", int_arg, 0, 0)
+arg(extents_ARG, 'l', "extents", int_arg_with_sign_and_percent, 0, 0)
+arg(list_ARG, 'l', "list", NULL, 0, 0)
+arg(lvmpartition_ARG, 'l', "lvmpartition", NULL, 0, 0)
+arg(logicalextent_ARG, 'L', "logicalextent", int_arg_with_sign, 0, 0)
+arg(size_ARG, 'L', "size", size_mb_arg, 0, 0)
+arg(persistent_ARG, 'M', "persistent", yes_no_arg, 0, 0)
+arg(major_ARG, 'j', "major", int_arg, ARG_GROUPABLE, 0)
+arg(setactivationskip_ARG, 'k', "setactivationskip", yes_no_arg, 0, 0)
+arg(ignoreactivationskip_ARG, 'K', "ignoreactivationskip", NULL, 0, 0)
+arg(maps_ARG, 'm', "maps", NULL, 0, 0)
+arg(mirrors_ARG, 'm', "mirrors", int_arg_with_sign, 0, 0)
+arg(metadatatype_ARG, 'M', "metadatatype", metadatatype_arg, 0, 0)
+arg(name_ARG, 'n', "name", string_arg, 0, 0)
+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(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)
+arg(physicalvolume_ARG, 'P', "physicalvolume", NULL, 0, 0)
+arg(quiet_ARG, 'q', "quiet", NULL, ARG_COUNTABLE, 0)
+arg(readahead_ARG, 'r', "readahead", readahead_arg, 0, 0)
+arg(resizefs_ARG, 'r', "resizefs", NULL, 0, 0)
+arg(reset_ARG, 'R', "reset", NULL, 0, 0)
+arg(regionsize_ARG, 'R', "regionsize", size_mb_arg, 0, 0)
+arg(physicalextentsize_ARG, 's', "physicalextentsize", size_mb_arg, 0, 0)
+arg(snapshot_ARG, 's', "snapshot", NULL, 0, 0)
+arg(short_ARG, 's', "short", NULL, 0, 0)
+arg(stdin_ARG, 's', "stdin", NULL, 0, 0)
+arg(select_ARG, 'S', "select", string_arg, 0, 0)
+arg(test_ARG, 't', "test", NULL, 0, 0)
+arg(thin_ARG, 'T', "thin", NULL, 0, 0)
+arg(uuid_ARG, 'u', "uuid", NULL, 0, 0)
+arg(uuidstr_ARG, 'u', "uuid", string_arg, 0, 0)
+arg(uuidlist_ARG, 'U', "uuidlist", NULL, 0, 0)
+arg(verbose_ARG, 'v', "verbose", NULL, ARG_COUNTABLE, 0)
+arg(volumegroup_ARG, 'V', "volumegroup", NULL, 0, 0)
+arg(virtualsize_ARG, 'V', "virtualsize", size_mb_arg, 0, 0)
+arg(wipesignatures_ARG, 'W', "wipesignatures", yes_no_arg, 0, 0)
+arg(allocatable_ARG, 'x', "allocatable", yes_no_arg, 0, 0)
+arg(resizeable_ARG, 'x', "resizeable", yes_no_arg, 0, 0)
+arg(yes_ARG, 'y', "yes", NULL, 0, 0)
+arg(zero_ARG, 'Z', "zero", yes_no_arg, 0, 0)
/* this should always be last */
-arg(ARG_COUNT, '-', "", NULL, 0)
+arg(ARG_COUNT, '-', "", NULL, 0, 0)
/* *INDENT-ON* */
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 452e6aa..5533cb1 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -53,7 +53,7 @@ extern char *optarg;
* Table of valid switches
*/
static struct arg_props _arg_props[ARG_COUNT + 1] = {
-#define arg(a, b, c, d, e) {b, "", "--" c, d, e},
+#define arg(a, b, c, d, e, f) {b, "", "--" c, d, e, f},
#include "args.h"
#undef arg
};
@@ -920,14 +920,22 @@ static int _process_command_line(struct cmd_context *cmd, int *argc,
av = &cmd->arg_values[arg];
if (a->flags & ARG_GROUPABLE) {
- /* Start a new group of arguments the first time or if a non-countable argument is repeated. */
- if (!current_group || (current_group->arg_values[arg].count && !(a->flags & ARG_COUNTABLE))) {
+ /*
+ * Start a new group of arguments:
+ * - the first time,
+ * - or if a non-countable argument is repeated,
+ * - or if argument has higher priority than current group.
+ */
+ if (!current_group ||
+ (current_group->arg_values[arg].count && !(a->flags & ARG_COUNTABLE)) ||
+ (current_group->prio < a->prio)) {
/* FIXME Reduce size including only groupable args */
if (!(current_group = dm_pool_zalloc(cmd->mem, sizeof(struct arg_value_group_list) + sizeof(*cmd->arg_values) * ARG_COUNT))) {
log_fatal("Unable to allocate memory for command line arguments.");
return 0;
}
+ current_group->prio = a->prio;
dm_list_add(&cmd->arg_value_groups, ¤t_group->list);
}
/* Maintain total argument count as well as count within each group */
diff --git a/tools/tools.h b/tools/tools.h
index 8704749..f6d224f 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -59,7 +59,7 @@ typedef int (*command_fn) (struct cmd_context * cmd, int argc, char **argv);
/* define the enums for the command line switches */
enum {
-#define arg(a, b, c, d, e) a ,
+#define arg(a, b, c, d, e, f) a ,
#include "args.h"
#undef arg
};
@@ -87,11 +87,13 @@ struct arg_props {
int (*fn) (struct cmd_context *cmd, struct arg_values *av);
uint32_t flags;
+ uint32_t prio;
};
struct arg_value_group_list {
struct dm_list list;
struct arg_values arg_values[0];
+ uint32_t prio;
};
#define CACHE_VGMETADATA 0x00000001
7 years, 11 months
master - conf: add report/{vgs, pvs, lvs, pvsegs, segs}_{cols, sort}_full config settings
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9c37b7ed7c33bb...
Commit: 9c37b7ed7c33bb6e66daf369fd563c52f6743282
Parent: 26c43c6ce525f5b338a2fbdae72bf308d42708d7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 14 12:38:40 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:42 2016 +0200
conf: add report/{vgs,pvs,lvs,pvsegs,segs}_{cols,sort}_full config settings
---
WHATS_NEW | 1 +
conf/example.conf.in | 60 ++++++++++++++++++++++++++++++++++++++++++
lib/config/config_settings.h | 40 ++++++++++++++++++++++++++++
tools/reporter.c | 16 +++++-----
4 files changed, 109 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 79dfe09..4e87e47 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.158 -
=================================
+ Add report/{pvs,vgs,lvs,pvsegs,segs}_{cols,sort}_full to lvm.conf.
Add lvm fullreport command for joined PV, VG, LV and segment report per VG.
Integrate report group handling and cmd log report into cmd processing code.
Add log/report_command_log to lvm.conf to enable or disable cmd log report.
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 69bb668..1918a3d 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -1900,6 +1900,66 @@ activation {
# This configuration option has an automatic default value.
# pvsegs_cols_verbose = "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
+ # Configuration option report/vgs_cols_full.
+ # List of columns to report for lvm fullreport's 'vgs' subreport.
+ # See 'vgs -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # vgs_cols_full = "vg_all"
+
+ # Configuration option report/pvs_cols_full.
+ # List of columns to report for lvm fullreport's 'vgs' subreport.
+ # See 'pvs -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # pvs_cols_full = "pv_all"
+
+ # Configuration option report/lvs_cols_full.
+ # List of columns to report for lvm fullreport's 'lvs' subreport.
+ # See 'lvs -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # lvs_cols_full = "lv_all"
+
+ # Configuration option report/pvsegs_cols_full.
+ # List of columns to report for lvm fullreport's 'pvseg' subreport.
+ # See 'pvs --segments -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # pvsegs_cols_full = "pvseg_all,pv_uuid,lv_uuid"
+
+ # Configuration option report/segs_cols_full.
+ # List of columns to report for lvm fullreport's 'seg' subreport.
+ # See 'lvs --segments -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # segs_cols_full = "seg_all,lv_uuid"
+
+ # Configuration option report/vgs_sort_full.
+ # List of columns to sort by when reporting lvm fullreport's 'vgs' subreport.
+ # See 'vgs -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # vgs_sort_full = "vg_name"
+
+ # Configuration option report/pvs_sort_full.
+ # List of columns to sort by when reporting lvm fullreport's 'vgs' subreport.
+ # See 'pvs -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # pvs_sort_full = "pv_name"
+
+ # Configuration option report/lvs_sort_full.
+ # List of columns to sort by when reporting lvm fullreport's 'lvs' subreport.
+ # See 'lvs -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # lvs_sort_full = "vg_name,lv_name"
+
+ # Configuration option report/pvsegs_sort_full.
+ # List of columns to sort by when reporting for lvm fullreport's 'pvseg' subreport.
+ # See 'pvs --segments -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # pvsegs_sort_full = "pv_uuid,pvseg_start"
+
+ # Configuration option report/segs_sort_full.
+ # List of columns to sort by when reporting lvm fullreport's 'seg' subreport.
+ # See 'lvs --segments -o help' for the list of possible fields.
+ # This configuration option has an automatic default value.
+ # segs_sort_full = "lv_uuid,seg_start"
+
# Configuration option report/mark_hidden_devices.
# Use brackets [] to mark hidden devices.
# This configuration option has an automatic default value.
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 09c9ab5..89e0771 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1743,6 +1743,46 @@ cfg(report_pvsegs_cols_verbose_CFG, "pvsegs_cols_verbose", report_CFG_SECTION, C
"List of columns to sort by when reporting 'pvs --segments' command in verbose mode.\n"
"See 'pvs --segments -o help' for the list of possible fields.\n")
+cfg(report_vgs_cols_full_CFG, "vgs_cols_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_VGS_COLS_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to report for lvm fullreport's 'vgs' subreport.\n"
+ "See 'vgs -o help' for the list of possible fields.\n")
+
+cfg(report_pvs_cols_full_CFG, "pvs_cols_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_PVS_COLS_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to report for lvm fullreport's 'vgs' subreport.\n"
+ "See 'pvs -o help' for the list of possible fields.\n")
+
+cfg(report_lvs_cols_full_CFG, "lvs_cols_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_LVS_COLS_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to report for lvm fullreport's 'lvs' subreport.\n"
+ "See 'lvs -o help' for the list of possible fields.\n")
+
+cfg(report_pvsegs_cols_full_CFG, "pvsegs_cols_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_PVSEGS_COLS_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to report for lvm fullreport's 'pvseg' subreport.\n"
+ "See 'pvs --segments -o help' for the list of possible fields.\n")
+
+cfg(report_segs_cols_full_CFG, "segs_cols_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_SEGS_COLS_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to report for lvm fullreport's 'seg' subreport.\n"
+ "See 'lvs --segments -o help' for the list of possible fields.\n")
+
+cfg(report_vgs_sort_full_CFG, "vgs_sort_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_VGS_SORT_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to sort by when reporting lvm fullreport's 'vgs' subreport.\n"
+ "See 'vgs -o help' for the list of possible fields.\n")
+
+cfg(report_pvs_sort_full_CFG, "pvs_sort_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_PVS_SORT_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to sort by when reporting lvm fullreport's 'vgs' subreport.\n"
+ "See 'pvs -o help' for the list of possible fields.\n")
+
+cfg(report_lvs_sort_full_CFG, "lvs_sort_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_LVS_SORT_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to sort by when reporting lvm fullreport's 'lvs' subreport.\n"
+ "See 'lvs -o help' for the list of possible fields.\n")
+
+cfg(report_pvsegs_sort_full_CFG, "pvsegs_sort_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_PVSEGS_SORT_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to sort by when reporting for lvm fullreport's 'pvseg' subreport.\n"
+ "See 'pvs --segments -o help' for the list of possible fields.\n")
+
+cfg(report_segs_sort_full_CFG, "segs_sort_full", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_SEGS_SORT_FULL, vsn(2, 2, 158), NULL, 0, NULL,
+ "List of columns to sort by when reporting lvm fullreport's 'seg' subreport.\n"
+ "See 'lvs --segments -o help' for the list of possible fields.\n")
+
cfg(report_mark_hidden_devices_CFG, "mark_hidden_devices", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 1, vsn(2, 2, 140), NULL, 0, NULL,
"Use brackets [] to mark hidden devices.\n")
diff --git a/tools/reporter.c b/tools/reporter.c
index 2037f6e..408d410 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -1055,11 +1055,11 @@ out:
return r;
}
-#define _set_full_report_single(args,type,name) \
+#define _set_full_report_single(cmd,args,type,name) \
do { \
args->single_args[REPORT_IDX_FULL_ ## type].report_type = type; \
- args->single_args[REPORT_IDX_FULL_ ## type].keys = DEFAULT_ ## type ## _SORT_FULL; \
- args->single_args[REPORT_IDX_FULL_ ## type].options = DEFAULT_ ## type ## _COLS_FULL; \
+ args->single_args[REPORT_IDX_FULL_ ## type].keys = find_config_tree_str(cmd, report_ ## name ## _sort_full_CFG, NULL); \
+ args->single_args[REPORT_IDX_FULL_ ## type].options = find_config_tree_str(cmd, report_ ## name ## _cols_full_CFG, NULL); \
if (!_set_report_prefix_and_name(&args->single_args[REPORT_IDX_FULL_ ## type])) \
return_0; \
} while (0)
@@ -1125,11 +1125,11 @@ static int _config_report(struct cmd_context *cmd, struct report_args *args, str
single_args->options = find_config_tree_str(cmd, report_pvsegs_cols_verbose_CFG, NULL);
break;
case FULL:
- _set_full_report_single(args, VGS, vgs);
- _set_full_report_single(args, LVS, lvs);
- _set_full_report_single(args, PVS, pvs);
- _set_full_report_single(args, PVSEGS, pvsegs);
- _set_full_report_single(args, SEGS, segs);
+ _set_full_report_single(cmd, args, VGS, vgs);
+ _set_full_report_single(cmd, args, LVS, lvs);
+ _set_full_report_single(cmd, args, PVS, pvs);
+ _set_full_report_single(cmd, args, PVSEGS, pvsegs);
+ _set_full_report_single(cmd, args, SEGS, segs);
break;
case CMDLOG:
single_args->keys = find_config_tree_str(cmd, log_command_log_sort_CFG, NULL);
7 years, 11 months
master - commands: report: add lvm fullreport command
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=26c43c6ce525f5...
Commit: 26c43c6ce525f5b338a2fbdae72bf308d42708d7
Parent: f1e7f35bb5982f6767bcaa8ab775bde580316c5d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue May 3 11:18:16 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:42 2016 +0200
commands: report: add lvm fullreport command
lvm fullreport executes 5 subreports (vg, pv, lv, pvseg, seg) per each VG
(and so taking one VG lock each time) within one command which makes it
easier to produce full report about LVM entities.
Since all 5 subreports for a VG are done under a VG lock, the output is
more consistent mainly in cases where LVM entities may be changed in
parallel.
---
WHATS_NEW | 1 +
lib/config/defaults.h | 12 +++
lib/report/report.h | 21 +++--
tools/Makefile.in | 2 +-
tools/commands.h | 38 +++++++++
tools/reporter.c | 219 ++++++++++++++++++++++++++++++++++++++-----------
6 files changed, 235 insertions(+), 58 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 349bd30..79dfe09 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.158 -
=================================
+ Add lvm fullreport command for joined PV, VG, LV and segment report per VG.
Integrate report group handling and cmd log report into cmd processing code.
Add log/report_command_log to lvm.conf to enable or disable cmd log report.
Add log/report_output_format to lvm.conf for default report output format.
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index ae8134f..6c7769a 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -226,6 +226,12 @@
#define DEFAULT_PVSEGS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
#define DEFAULT_DEVTYPES_COLS_VERB "devtype_name,devtype_max_partitions,devtype_description"
+#define DEFAULT_VGS_COLS_FULL "vg_all"
+#define DEFAULT_PVS_COLS_FULL "pv_all"
+#define DEFAULT_LVS_COLS_FULL "lv_all"
+#define DEFAULT_PVSEGS_COLS_FULL "pvseg_all,pv_uuid,lv_uuid"
+#define DEFAULT_SEGS_COLS_FULL "seg_all,lv_uuid"
+
#define DEFAULT_LVS_SORT "vg_name,lv_name"
#define DEFAULT_VGS_SORT "vg_name"
#define DEFAULT_PVS_SORT "pv_name"
@@ -234,6 +240,12 @@
#define DEFAULT_DEVTYPES_SORT "devtype_name"
#define DEFAULT_COMMAND_LOG_SORT "log_seq_num"
+#define DEFAULT_VGS_SORT_FULL "vg_name"
+#define DEFAULT_PVS_SORT_FULL "pv_name"
+#define DEFAULT_LVS_SORT_FULL "vg_name,lv_name"
+#define DEFAULT_PVSEGS_SORT_FULL "pv_uuid,pvseg_start"
+#define DEFAULT_SEGS_SORT_FULL "lv_uuid,seg_start"
+
#define DEFAULT_MIRROR_DEVICE_FAULT_POLICY "remove"
#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
#define DEFAULT_SNAPSHOT_AUTOEXTEND_THRESHOLD 100
diff --git a/lib/report/report.h b/lib/report/report.h
index 62c52dc..20ccd99 100644
--- a/lib/report/report.h
+++ b/lib/report/report.h
@@ -22,16 +22,17 @@
typedef enum {
CMDLOG = 1,
- LVS = 2,
- LVSINFO = 4,
- LVSSTATUS = 8,
- LVSINFOSTATUS = 16,
- PVS = 32,
- VGS = 64,
- SEGS = 128,
- PVSEGS = 256,
- LABEL = 512,
- DEVTYPES = 1024
+ FULL = 2,
+ LVS = 4,
+ LVSINFO = 8,
+ LVSSTATUS = 16,
+ LVSINFOSTATUS = 32,
+ PVS = 64,
+ VGS = 128,
+ SEGS = 256,
+ PVSEGS = 512,
+ LABEL = 1024,
+ DEVTYPES = 2048
} report_type_t;
/*
diff --git a/tools/Makefile.in b/tools/Makefile.in
index f2f9faa..bb29176 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -168,7 +168,7 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
.commands: $(srcdir)/commands.h $(srcdir)/cmdnames.h Makefile
$(CC) -E -P $(srcdir)/cmdnames.h 2> /dev/null | \
- egrep -v '^ *(|#.*|config|devtypes|dumpconfig|formats|help|lvpoll|pvdata|segtypes|systemid|tags|version) *$$' > .commands
+ egrep -v '^ *(|#.*|config|devtypes|dumpconfig|formats|fullreport|help|lvpoll|pvdata|segtypes|systemid|tags|version) *$$' > .commands
ifneq ("$(CFLOW_CMD)", "")
CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
diff --git a/tools/commands.h b/tools/commands.h
index 4db57d5..a9e4be5 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -136,6 +136,44 @@ xx(lvactivate,
"Logical Volume(s)\n")
***********/
+xx(fullreport,
+ "Display full report",
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH,
+ "fullreport\n"
+ "\t[--aligned]\n"
+ "\t[--binary]\n"
+ "\t[-a|--all]\n"
+ "\t[--commandprofile ProfileName]\n"
+ "\t[-d|--debug]\n"
+ "\t[--foreign]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
+ "\t[--ignoreskippedcluster]\n"
+ "\t[--nameprefixes]\n"
+ "\t[--noheadings]\n"
+ "\t[--nosuffix]\n"
+ "\t[-o|--options [+|-|#]Field[,Field]]\n"
+ "\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
+ "\t[-P|--partial]\n"
+ "\t[--readonly]\n"
+ "\t[--reportformat {json}]\n"
+ "\t[--rows]\n"
+ "\t[-S|--select Selection]\n"
+ "\t[--separator Separator]\n"
+ "\t[--trustcache]\n"
+ "\t[--unbuffered]\n"
+ "\t[--units hHbBsSkKmMgGtTpPeE]\n"
+ "\t[--unquoted]\n"
+ "\t[-v|--verbose]\n"
+ "\t[--version]\n"
+ "\t[VolumeGroupName [VolumeGroupName...]]\n",
+
+ aligned_ARG, all_ARG, binary_ARG, foreign_ARG, ignorelockingfailure_ARG,
+ ignoreskippedcluster_ARG, nameprefixes_ARG, noheadings_ARG, nolocking_ARG,
+ nosuffix_ARG, options_ARG, partial_ARG, readonly_ARG, reportformat_ARG,
+ rows_ARG, select_ARG, separator_ARG, shared_ARG, sort_ARG, trustcache_ARG,
+ unbuffered_ARG, units_ARG, unquoted_ARG)
+
xx(lvchange,
"Change the attributes of logical volume(s)",
CACHE_VGMETADATA | PERMITTED_READ_ONLY,
diff --git a/tools/reporter.c b/tools/reporter.c
index 9f4f95a..2037f6e 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -21,6 +21,11 @@ typedef enum {
REPORT_IDX_NULL = -1,
REPORT_IDX_SINGLE,
REPORT_IDX_LOG,
+ REPORT_IDX_FULL_VGS,
+ REPORT_IDX_FULL_LVS,
+ REPORT_IDX_FULL_PVS,
+ REPORT_IDX_FULL_PVSEGS,
+ REPORT_IDX_FULL_SEGS,
REPORT_IDX_COUNT
} report_idx_t;
@@ -48,6 +53,7 @@ struct report_args {
int quoted;
int columns_as_rows;
const char *separator;
+ struct volume_group *full_report_vg;
struct single_report_args single_args[REPORT_IDX_COUNT];
};
@@ -457,8 +463,10 @@ static int _get_final_report_type(int args_are_pvs,
}
/* Change report type if fields specified makes this necessary */
- if ((report_type & PVSEGS) ||
- ((report_type & (PVS | LABEL)) && (report_type & (LVS | LVSINFO | LVSSTATUS | LVSINFOSTATUS))))
+ if (report_type & FULL)
+ report_type = FULL;
+ else if ((report_type & PVSEGS) ||
+ ((report_type & (PVS | LABEL)) && (report_type & (LVS | LVSINFO | LVSSTATUS | LVSINFOSTATUS))))
report_type = PVSEGS;
else if ((report_type & PVS) ||
((report_type & LABEL) && (report_type & VGS)))
@@ -829,6 +837,12 @@ static int _set_report_prefix_and_name(struct single_report_args *single_args)
const char *report_prefix;
size_t len;
+ if (single_args->report_type == FULL) {
+ single_args->report_prefix[0] = '\0';
+ single_args->report_name = single_args->report_prefix;
+ return 1;
+ }
+
report_prefix = report_get_field_prefix(single_args->report_type);
len = strlen(report_prefix);
if (report_prefix[len - 1] == '_')
@@ -850,27 +864,24 @@ static int _set_report_prefix_and_name(struct single_report_args *single_args)
return 1;
}
-static int _do_report(struct cmd_context *cmd, struct report_args *args, struct single_report_args *single_args)
+static int _do_report(struct cmd_context *cmd, struct processing_handle *handle,
+ struct report_args *args, struct single_report_args *single_args)
{
- struct processing_handle *handle = NULL;
+ void *orig_custom_handle = handle->custom_handle;
report_type_t report_type = single_args->report_type;
void *report_handle = NULL;
int lock_global = 0;
int lv_info_needed;
int lv_segment_status_needed;
+ int report_in_group = 0;
int r = ECMD_FAILED;
- if (!(handle = init_processing_handle(cmd, NULL)))
- goto_out;
-
if (!(report_handle = report_init(cmd, single_args->options, single_args->keys, &report_type,
args->separator, args->aligned, args->buffered,
args->headings, args->field_prefixes, args->quoted,
args->columns_as_rows, single_args->selection)))
goto_out;
- handle->internal_report_for_select = 0;
- handle->include_historical_lvs = cmd->include_historical_lvs;
handle->custom_handle = report_handle;
if (!_get_final_report_type(single_args->args_are_pvs,
@@ -879,8 +890,11 @@ static int _do_report(struct cmd_context *cmd, struct report_args *args, struct
&report_type))
goto_out;
- if (!dm_report_group_push(handle->report_group, report_handle, (void *) single_args->report_name))
- goto_out;
+ if (handle->report_group) {
+ if (!dm_report_group_push(handle->report_group, report_handle, (void *) single_args->report_name))
+ goto_out;
+ report_in_group = 1;
+ }
/*
* We lock VG_GLOBAL to enable use of metadata cache.
@@ -906,48 +920,72 @@ static int _do_report(struct cmd_context *cmd, struct report_args *args, struct
case LVSINFOSTATUS:
/* fall through */
case LVS:
- r = process_each_lv(cmd, args->argc, args->argv, NULL, NULL, 0, handle,
- lv_info_needed && !lv_segment_status_needed ? &_lvs_with_info_single :
- !lv_info_needed && lv_segment_status_needed ? &_lvs_with_status_single :
- lv_info_needed && lv_segment_status_needed ? &_lvs_with_info_and_status_single :
- &_lvs_single);
+ if (args->full_report_vg)
+ r = _report_all_in_vg(cmd, handle, args->full_report_vg, LVS, lv_info_needed, lv_segment_status_needed);
+ else
+ r = process_each_lv(cmd, args->argc, args->argv, NULL, NULL, 0, handle,
+ lv_info_needed && !lv_segment_status_needed ? &_lvs_with_info_single :
+ !lv_info_needed && lv_segment_status_needed ? &_lvs_with_status_single :
+ lv_info_needed && lv_segment_status_needed ? &_lvs_with_info_and_status_single :
+ &_lvs_single);
break;
case VGS:
- r = process_each_vg(cmd, args->argc, args->argv, NULL, NULL, 0,
- handle, &_vgs_single);
+ if (args->full_report_vg)
+ r = _report_all_in_vg(cmd, handle, args->full_report_vg, VGS, lv_info_needed, lv_segment_status_needed);
+ else
+ r = process_each_vg(cmd, args->argc, args->argv, NULL, NULL, 0,
+ handle, &_vgs_single);
break;
case LABEL:
r = process_each_label(cmd, args->argc, args->argv,
handle, &_label_single);
break;
case PVS:
- if (single_args->args_are_pvs)
- r = process_each_pv(cmd, args->argc, args->argv, NULL,
- arg_is_set(cmd, all_ARG), 0,
- handle, &_pvs_single);
- else
- r = process_each_vg(cmd, args->argc, args->argv, NULL, NULL,
- 0, handle, &_pvs_in_vg);
+ if (args->full_report_vg)
+ r = _report_all_in_vg(cmd, handle, args->full_report_vg, PVS, lv_info_needed, lv_segment_status_needed);
+ else {
+ if (single_args->args_are_pvs)
+ r = process_each_pv(cmd, args->argc, args->argv, NULL,
+ arg_is_set(cmd, all_ARG), 0,
+ handle, &_pvs_single);
+ else
+ r = process_each_vg(cmd, args->argc, args->argv, NULL, NULL,
+ 0, handle, &_pvs_in_vg);
+ }
break;
case SEGS:
- r = process_each_lv(cmd, args->argc, args->argv, NULL, NULL, 0, handle,
- lv_info_needed && !lv_segment_status_needed ? &_lvsegs_with_info_single :
- !lv_info_needed && lv_segment_status_needed ? &_lvsegs_with_status_single :
- lv_info_needed && lv_segment_status_needed ? &_lvsegs_with_info_and_status_single :
- &_lvsegs_single);
+ if (args->full_report_vg)
+ r = _report_all_in_vg(cmd, handle, args->full_report_vg, SEGS, lv_info_needed, lv_segment_status_needed);
+ else
+ r = process_each_lv(cmd, args->argc, args->argv, NULL, NULL, 0, handle,
+ lv_info_needed && !lv_segment_status_needed ? &_lvsegs_with_info_single :
+ !lv_info_needed && lv_segment_status_needed ? &_lvsegs_with_status_single :
+ lv_info_needed && lv_segment_status_needed ? &_lvsegs_with_info_and_status_single :
+ &_lvsegs_single);
break;
case PVSEGS:
- if (single_args->args_are_pvs)
- r = process_each_pv(cmd, args->argc, args->argv, NULL,
- arg_is_set(cmd, all_ARG), 0,
- handle,
- lv_info_needed && !lv_segment_status_needed ? &_pvsegs_with_lv_info_single :
- !lv_info_needed && lv_segment_status_needed ? &_pvsegs_with_lv_status_single :
- lv_info_needed && lv_segment_status_needed ? &_pvsegs_with_lv_info_and_status_single :
+ if (args->full_report_vg)
+ r = _report_all_in_vg(cmd, handle, args->full_report_vg, PVSEGS, lv_info_needed, lv_segment_status_needed);
+ else {
+ if (single_args->args_are_pvs)
+ r = process_each_pv(cmd, args->argc, args->argv, NULL,
+ arg_is_set(cmd, all_ARG), 0,
+ handle,
+ lv_info_needed && !lv_segment_status_needed ? &_pvsegs_with_lv_info_single :
+ !lv_info_needed && lv_segment_status_needed ? &_pvsegs_with_lv_status_single :
+ lv_info_needed && lv_segment_status_needed ? &_pvsegs_with_lv_info_and_status_single :
&_pvsegs_single);
- else
- r = process_each_vg(cmd, args->argc, args->argv, NULL, NULL,
- 0, handle, &_pvsegs_in_vg);
+ else
+ r = process_each_vg(cmd, args->argc, args->argv, NULL, NULL,
+ 0, handle, &_pvsegs_in_vg);
+ }
+ break;
+ case FULL:
+ /*
+ * Full report's subreports already covered by combinations above with args->full_report_vg.
+ * We shouldn't see report_type == FULL in this function.
+ */
+ log_error(INTERNAL_ERROR "_do_report: full report requested at incorrect level");
break;
case CMDLOG:
/* Log is reported throughout the code via report_cmdlog calls. */
@@ -970,13 +1008,62 @@ static int _do_report(struct cmd_context *cmd, struct report_args *args, struct
if (lock_global)
unlock_vg(cmd, VG_GLOBAL);
out:
- if (handle)
- destroy_processing_handle(cmd, handle);
- if (report_handle)
+ if (report_handle) {
+ if (report_in_group && !dm_report_group_pop(handle->report_group))
+ stack;
dm_report_free(report_handle);
+ }
+
+ handle->custom_handle = orig_custom_handle;
+ return r;
+}
+
+static int _full_report_single(struct cmd_context *cmd,
+ const char *vg_name,
+ struct volume_group *vg,
+ struct processing_handle *handle)
+{
+ struct report_args *args = (struct report_args *) handle->custom_handle;
+ int orphan = is_orphan_vg(vg->name);
+ int r = ECMD_FAILED;
+
+ if (orphan && !dm_list_size(&vg->pvs))
+ return ECMD_PROCESSED;
+
+ args->full_report_vg = vg;
+
+ if (!dm_report_group_push(handle->report_group, NULL, NULL))
+ goto out;
+
+ if (orphan) {
+ if (((r = _do_report(cmd, handle, args, &args->single_args[REPORT_IDX_FULL_PVS])) != ECMD_PROCESSED) ||
+ ((r = _do_report(cmd, handle, args, &args->single_args[REPORT_IDX_FULL_PVSEGS])) != ECMD_PROCESSED))
+ stack;
+ } else {
+ if (((r = _do_report(cmd, handle, args, &args->single_args[REPORT_IDX_FULL_VGS])) != ECMD_PROCESSED) ||
+ ((r = _do_report(cmd, handle, args, &args->single_args[REPORT_IDX_FULL_PVS])) != ECMD_PROCESSED) ||
+ ((r = _do_report(cmd, handle, args, &args->single_args[REPORT_IDX_FULL_LVS])) != ECMD_PROCESSED) ||
+ ((r = _do_report(cmd, handle, args, &args->single_args[REPORT_IDX_FULL_PVSEGS])) != ECMD_PROCESSED) ||
+ ((r = _do_report(cmd, handle, args, &args->single_args[REPORT_IDX_FULL_SEGS])) != ECMD_PROCESSED))
+ stack;
+ }
+
+ if (!dm_report_group_pop(handle->report_group))
+ goto_out;
+out:
+ args->full_report_vg = NULL;
return r;
}
+#define _set_full_report_single(args,type,name) \
+ do { \
+ args->single_args[REPORT_IDX_FULL_ ## type].report_type = type; \
+ args->single_args[REPORT_IDX_FULL_ ## type].keys = DEFAULT_ ## type ## _SORT_FULL; \
+ args->single_args[REPORT_IDX_FULL_ ## type].options = DEFAULT_ ## type ## _COLS_FULL; \
+ if (!_set_report_prefix_and_name(&args->single_args[REPORT_IDX_FULL_ ## type])) \
+ return_0; \
+ } while (0)
+
static int _config_report(struct cmd_context *cmd, struct report_args *args, struct single_report_args *single_args)
{
args->aligned = find_config_tree_bool(cmd, report_aligned_CFG, NULL);
@@ -1037,6 +1124,13 @@ static int _config_report(struct cmd_context *cmd, struct report_args *args, str
else
single_args->options = find_config_tree_str(cmd, report_pvsegs_cols_verbose_CFG, NULL);
break;
+ case FULL:
+ _set_full_report_single(args, VGS, vgs);
+ _set_full_report_single(args, LVS, lvs);
+ _set_full_report_single(args, PVS, pvs);
+ _set_full_report_single(args, PVSEGS, pvsegs);
+ _set_full_report_single(args, SEGS, segs);
+ break;
case CMDLOG:
single_args->keys = find_config_tree_str(cmd, log_command_log_sort_CFG, NULL);
single_args->options = find_config_tree_str(cmd, log_command_log_cols_CFG, NULL);
@@ -1046,7 +1140,8 @@ static int _config_report(struct cmd_context *cmd, struct report_args *args, str
return 0;
}
- single_args->fields_to_compact = find_config_tree_str_allow_empty(cmd, report_compact_output_cols_CFG, NULL);
+ if (single_args->report_type != FULL)
+ single_args->fields_to_compact = find_config_tree_str_allow_empty(cmd, report_compact_output_cols_CFG, NULL);
/* If -o supplied use it, else use default for report_type */
if ((_get_report_options(cmd, args, single_args) != ECMD_PROCESSED))
@@ -1084,6 +1179,9 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, report_type_t
{
struct report_args args = {0};
struct single_report_args *single_args = &args.single_args[REPORT_IDX_SINGLE];
+ static char report_name[] = "report";
+ struct processing_handle *handle;
+ int r = ECMD_FAILED;
/*
* Include foreign VGs that contain active LVs.
@@ -1097,10 +1195,33 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, report_type_t
args.argv = argv;
single_args->report_type = report_type;
- if (!_config_report(cmd, &args, single_args))
+ if (!(handle = init_processing_handle(cmd, NULL)))
return_ECMD_FAILED;
- return _do_report(cmd, &args, single_args);
+ handle->internal_report_for_select = 0;
+ handle->include_historical_lvs = cmd->include_historical_lvs;
+
+ args.report_group_type = handle->report_group_type;
+
+ if (!_config_report(cmd, &args, single_args)) {
+ destroy_processing_handle(cmd, handle);
+ return_ECMD_FAILED;
+ }
+
+ if (!dm_report_group_push(handle->report_group, NULL, report_name)) {
+ log_error("Failed to add main report section to report group.");
+ destroy_processing_handle(cmd, handle);
+ return ECMD_FAILED;
+ }
+
+ if (single_args->report_type == FULL) {
+ handle->custom_handle = &args;
+ r = process_each_vg(cmd, argc, argv, NULL, NULL, 0, handle, &_full_report_single);
+ } else
+ r = _do_report(cmd, handle, &args, single_args);
+
+ destroy_processing_handle(cmd, handle);
+ return r;
}
int lvs(struct cmd_context *cmd, int argc, char **argv)
@@ -1132,6 +1253,11 @@ int pvs(struct cmd_context *cmd, int argc, char **argv)
return _report(cmd, argc, argv, type);
}
+int fullreport(struct cmd_context *cmd, int argc, char **argv)
+{
+ return _report(cmd, argc, argv, FULL);
+}
+
int devtypes(struct cmd_context *cmd, int argc, char **argv)
{
return _report(cmd, argc, argv, DEVTYPES);
@@ -1143,7 +1269,6 @@ int devtypes(struct cmd_context *cmd, int argc, char **argv)
int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_group_type,
struct dm_report_group **report_group, struct dm_report **log_rh)
{
- static char log_report_name[] = "log";
int config_set = find_config_tree_node(cmd, report_output_format_CFG, NULL) != NULL;
const char *config_format_str = find_config_tree_str(cmd, report_output_format_CFG, NULL);
const char *format_str = arg_str_value(cmd, reportformat_ARG, config_set ? config_format_str : NULL);
7 years, 11 months
master - commands: recognize --reportformat option for other commands
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f1e7f35bb5982f...
Commit: f1e7f35bb5982f6767bcaa8ab775bde580316c5d
Parent: f8a93763e59eea8cef3762908c3e663c7a22a4fa
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue May 17 13:32:56 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:42 2016 +0200
commands: recognize --reportformat option for other commands
Enables --reportformat option for all command using processing_handle
(and process_each_* fn variant), that is: lvchange, lvcreate, lvdisplay,
lvextend, lvreduce, lvremove, lvrename, lvresize, lvscan, pvchange,
pvresize, pvcreate, pvdisplay, pvmove, pvremove, pvscan, vgcfgbackup,
vgchange, vgck, vgconvert, vgcreate, vgdisplay, vgexport, vgextend,
vgimport, vgmknodes, vgreduce, vgremove, vgrename command.
---
tools/commands.h | 114 ++++++++++++++++++++++++++++++++++++------------------
1 files changed, 76 insertions(+), 38 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index b544ae1..4db57d5 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -175,6 +175,7 @@ xx(lvchange,
"\t[--[raid]writemostly <PhysicalVolume>[:{t|n|y}]]\n"
"\t[-r|--readahead <ReadAheadSectors>|auto|none]\n"
"\t[--refresh]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[--resync]\n"
"\t[-S|--select Selection]\n"
"\t[--sysinit]\n"
@@ -194,9 +195,9 @@ xx(lvchange,
monitor_ARG, minrecoveryrate_ARG, maxrecoveryrate_ARG, noudevsync_ARG,
partial_ARG, permission_ARG, persistent_ARG, poll_ARG,
raidminrecoveryrate_ARG, raidmaxrecoveryrate_ARG, raidsyncaction_ARG,
- raidwritebehind_ARG, raidwritemostly_ARG, readahead_ARG, resync_ARG,
- refresh_ARG, select_ARG, setactivationskip_ARG, syncaction_ARG, sysinit_ARG,
- test_ARG, writebehind_ARG, writemostly_ARG, zero_ARG)
+ raidwritebehind_ARG, raidwritemostly_ARG, readahead_ARG, reportformat_ARG,
+ resync_ARG, refresh_ARG, select_ARG, setactivationskip_ARG, syncaction_ARG,
+ sysinit_ARG, test_ARG, writebehind_ARG, writemostly_ARG, zero_ARG)
#define COMMON_OPTS \
"\t[--commandprofile <ProfileName>] [-d|--debug] [-h|-?|--help]\n" \
@@ -337,6 +338,7 @@ xx(lvcreate,
"\t[--[raid]minrecoveryrate Rate]\n"
"\t[--[raid]maxrecoveryrate Rate]\n"
"\t[-r|--readahead {ReadAheadSectors|auto|none}]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-R|--regionsize MirrorLogRegionSize]\n"
"\t[-T|--thin\n"
"\t [--discards {ignore|nopassdown|passdown}]\n"
@@ -380,6 +382,7 @@ xx(lvcreate,
"\t[--noudevsync]\n"
"\t[-p|--permission {r|rw}]\n"
"\t[-r|--readahead ReadAheadSectors|auto|none]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-t|--test]\n"
"\t[{--thinpool ThinPoolLogicalVolume[Path] |\n"
"\t --cachepool CachePoolLogicalVolume[Path]}]\n"
@@ -397,9 +400,10 @@ xx(lvcreate,
//pooldatasize_ARG,
poolmetadatasize_ARG, poolmetadataspare_ARG,
raidminrecoveryrate_ARG, raidmaxrecoveryrate_ARG,
- readahead_ARG, regionsize_ARG, setactivationskip_ARG, size_ARG, snapshot_ARG,
- stripes_ARG, stripesize_ARG, test_ARG, thin_ARG, thinpool_ARG, type_ARG,
- virtualoriginsize_ARG, virtualsize_ARG, wipesignatures_ARG, zero_ARG)
+ readahead_ARG, regionsize_ARG, reportformat_ARG, setactivationskip_ARG,
+ size_ARG, snapshot_ARG, stripes_ARG, stripesize_ARG, test_ARG, thin_ARG,
+ thinpool_ARG, type_ARG, virtualoriginsize_ARG, virtualsize_ARG,
+ wipesignatures_ARG, zero_ARG)
xx(lvdisplay,
"Display information about a logical volume",
@@ -442,6 +446,7 @@ xx(lvdisplay,
"\t[-S|--select Selection]\n"
"\t[-P|--partial]\n"
"\t[--readonly]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[--segments]\n"
"\t[--separator Separator]\n"
"\t[--unbuffered]\n"
@@ -453,8 +458,8 @@ xx(lvdisplay,
aligned_ARG, all_ARG, binary_ARG, colon_ARG, columns_ARG, foreign_ARG,
history_ARG, ignorelockingfailure_ARG, ignoreskippedcluster_ARG,
maps_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, sort_ARG,
- partial_ARG, readonly_ARG, segments_ARG, select_ARG, separator_ARG,
- shared_ARG, unbuffered_ARG, units_ARG)
+ partial_ARG, readonly_ARG, reportformat_ARG, segments_ARG, select_ARG,
+ separator_ARG, shared_ARG, unbuffered_ARG, units_ARG)
xx(lvextend,
"Add space to a logical volume",
@@ -475,6 +480,7 @@ xx(lvextend,
"\t[--use-policies]\n"
"\t[-n|--nofsck]\n"
"\t[--noudevsync]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-r|--resizefs]\n"
"\t[-t|--test]\n"
"\t[--type VolumeType]\n"
@@ -484,7 +490,7 @@ xx(lvextend,
alloc_ARG, autobackup_ARG, extents_ARG, force_ARG, mirrors_ARG,
nofsck_ARG, nosync_ARG, noudevsync_ARG, poolmetadatasize_ARG,
- resizefs_ARG, size_ARG, stripes_ARG, stripesize_ARG,
+ reportformat_ARG, resizefs_ARG, size_ARG, stripes_ARG, stripesize_ARG,
test_ARG, type_ARG, usepolicies_ARG)
xx(lvmchange,
@@ -584,6 +590,7 @@ xx(lvreduce,
"\t[-n|--nofsck]\n"
"\t[--noudevsync]\n"
"\t[-r|--resizefs]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
@@ -591,7 +598,7 @@ xx(lvreduce,
"\tLogicalVolume[Path]\n",
autobackup_ARG, force_ARG, extents_ARG, nofsck_ARG, noudevsync_ARG,
- resizefs_ARG, size_ARG, test_ARG)
+ reportformat_ARG, resizefs_ARG, size_ARG, test_ARG)
xx(lvremove,
"Remove logical volume(s) from the system",
@@ -604,6 +611,7 @@ xx(lvremove,
"\t[-h|--help]\n"
"\t[--nohistory]\n"
"\t[--noudevsync]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-S|--select Selection]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
@@ -611,7 +619,7 @@ xx(lvremove,
"\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
autobackup_ARG, force_ARG, nohistory_ARG, noudevsync_ARG,
- select_ARG, test_ARG)
+ reportformat_ARG, select_ARG, test_ARG)
xx(lvrename,
"Rename a logical volume",
@@ -622,13 +630,14 @@ xx(lvrename,
"\t[-d|--debug]\n"
"\t[-h|-?|--help]\n"
"\t[--noudevsync]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\t{ OldLogicalVolumePath NewLogicalVolumePath |\n"
"\t VolumeGroupName OldLogicalVolumeName NewLogicalVolumeName }\n",
- autobackup_ARG, noudevsync_ARG, test_ARG)
+ autobackup_ARG, noudevsync_ARG, reportformat_ARG, test_ARG)
xx(lvresize,
"Resize a logical volume",
@@ -646,6 +655,7 @@ xx(lvresize,
"\t --poolmetadatasize [+]MetadataVolumeSize[bBsSkKmMgG]}\n"
"\t[-n|--nofsck]\n"
"\t[--noudevsync]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-r|--resizefs]\n"
"\t[-t|--test]\n"
"\t[--type VolumeType]\n"
@@ -654,8 +664,8 @@ xx(lvresize,
"\tLogicalVolume[Path] [ PhysicalVolumePath... ]\n",
alloc_ARG, autobackup_ARG, extents_ARG, force_ARG, nofsck_ARG,
- noudevsync_ARG, resizefs_ARG, poolmetadatasize_ARG,
- size_ARG, stripes_ARG, stripesize_ARG,
+ noudevsync_ARG, reportformat_ARG, resizefs_ARG,
+ poolmetadatasize_ARG, size_ARG, stripes_ARG, stripesize_ARG,
test_ARG, type_ARG)
xx(lvs,
@@ -712,11 +722,12 @@ xx(lvscan,
"\t[--ignorelockingfailure]\n"
"\t[-P|--partial]\n"
"\t[--readonly]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n",
all_ARG, blockdevice_ARG, ignorelockingfailure_ARG, partial_ARG,
- readonly_ARG, cache_long_ARG)
+ readonly_ARG, reportformat_ARG, cache_long_ARG)
xx(pvchange,
"Change attributes of physical volume(s)",
@@ -730,6 +741,7 @@ xx(pvchange,
"\t[-h|--help]\n"
"\t[--ignoreskippedcluster]\n"
"\t[--metadataignore y|n]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-S|--select Selection]\n"
"\t[-t|--test]\n"
"\t[-u|--uuid]\n"
@@ -742,7 +754,7 @@ xx(pvchange,
all_ARG, allocatable_ARG, allocation_ARG, autobackup_ARG, deltag_ARG,
addtag_ARG, force_ARG, ignoreskippedcluster_ARG, metadataignore_ARG,
- select_ARG, test_ARG, uuid_ARG)
+ reportformat_ARG, select_ARG, test_ARG, uuid_ARG)
xx(pvresize,
"Resize physical volume(s)",
@@ -751,13 +763,14 @@ xx(pvresize,
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
"\t[-h|-?|--help]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[--setphysicalvolumesize PhysicalVolumeSize[bBsSkKmMgGtTpPeE]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\tPhysicalVolume [PhysicalVolume...]\n",
- physicalvolumesize_ARG, test_ARG)
+ physicalvolumesize_ARG, reportformat_ARG, test_ARG)
xx(pvck,
"Check the consistency of physical volume(s)",
@@ -779,6 +792,7 @@ xx(pvcreate,
"pvcreate\n"
"\t[--norestorefile]\n"
"\t[--restorefile file]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
"\t[-f[f]|--force [--force]]\n"
@@ -803,7 +817,7 @@ xx(pvcreate,
force_ARG, test_ARG, labelsector_ARG, metadatatype_ARG,
metadatacopies_ARG, metadatasize_ARG, metadataignore_ARG,
norestorefile_ARG, physicalvolumesize_ARG, pvmetadatacopies_ARG,
- restorefile_ARG, uuidstr_ARG, zero_ARG)
+ reportformat_ARG, restorefile_ARG, uuidstr_ARG, zero_ARG)
xx(pvdata,
"Display the on-disk metadata for physical volume(s)",
@@ -860,6 +874,7 @@ xx(pvdisplay,
"\t[--nosuffix]\n"
"\t[-o|--options [+|-|#]Field[,Field]]\n"
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-S|--select Selection]\n"
"\t[--readonly]\n"
"\t[--separator Separator]\n"
@@ -871,7 +886,7 @@ xx(pvdisplay,
aligned_ARG, all_ARG, binary_ARG, colon_ARG, columns_ARG, foreign_ARG,
ignorelockingfailure_ARG, ignoreskippedcluster_ARG, maps_ARG,
- noheadings_ARG, nosuffix_ARG, options_ARG, readonly_ARG,
+ noheadings_ARG, nosuffix_ARG, options_ARG, readonly_ARG, reportformat_ARG,
select_ARG, separator_ARG, shared_ARG, short_ARG, sort_ARG, unbuffered_ARG,
units_ARG)
@@ -891,6 +906,7 @@ xx(pvmove,
"\t[-h|-?|--help]\n"
"\t[-i|--interval seconds]\n"
"\t[--noudevsync]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-t|--test]\n "
"\t[-v|--verbose]\n "
"\t[--version]\n"
@@ -900,7 +916,7 @@ xx(pvmove,
"\t[DestinationPhysicalVolume[:PhysicalExtent[-PhysicalExtent]...]...]\n",
abort_ARG, alloc_ARG, atomic_ARG, autobackup_ARG, background_ARG,
- interval_ARG, name_ARG, noudevsync_ARG, test_ARG)
+ interval_ARG, name_ARG, noudevsync_ARG, reportformat_ARG, test_ARG)
xx(lvpoll,
"Continue already initiated poll operation on a logical volume",
@@ -928,13 +944,14 @@ xx(pvremove,
"\t[-d|--debug]\n"
"\t[-f[f]|--force [--force]]\n"
"\t[-h|-?|--help]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\t[-y|--yes]\n"
"\tPhysicalVolume [PhysicalVolume...]\n",
- force_ARG, test_ARG)
+ force_ARG, reportformat_ARG, test_ARG)
xx(pvs,
"Display information about physical volumes",
@@ -988,6 +1005,7 @@ xx(pvscan,
"\t[--ignorelockingfailure]\n"
"\t[-P|--partial]\n"
"\t[--readonly]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-s|--short]\n"
"\t[-u|--uuid]\n"
"\t[-v|--verbose]\n"
@@ -995,7 +1013,8 @@ xx(pvscan,
activate_ARG, available_ARG, backgroundfork_ARG, cache_long_ARG,
exported_ARG, ignorelockingfailure_ARG, major_ARG, minor_ARG,
- novolumegroup_ARG, partial_ARG, readonly_ARG, short_ARG, uuid_ARG)
+ novolumegroup_ARG, partial_ARG, readonly_ARG, reportformat_ARG,
+ short_ARG, uuid_ARG)
xx(segtypes,
"List available segment types",
@@ -1024,11 +1043,13 @@ xx(vgcfgbackup,
"\t[--ignorelockingfailure]\n"
"\t[-P|--partial]\n"
"\t[--readonly]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\t[VolumeGroupName...]\n",
- file_ARG, foreign_ARG, ignorelockingfailure_ARG, partial_ARG, readonly_ARG)
+ file_ARG, foreign_ARG, ignorelockingfailure_ARG, partial_ARG, readonly_ARG,
+ reportformat_ARG)
xx(vgcfgrestore,
"Restore volume group configuration",
@@ -1069,6 +1090,7 @@ xx(vgchange,
"\t[--poll {y|n}]\n"
"\t[--noudevsync]\n"
"\t[--refresh]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-S|--select Selection]\n"
"\t[--sysinit]\n"
"\t[--systemid SystemID]\n"
@@ -1093,9 +1115,9 @@ xx(vgchange,
ignoreskippedcluster_ARG, logicalvolume_ARG, maxphysicalvolumes_ARG,
metadataprofile_ARG, monitor_ARG, noudevsync_ARG, metadatacopies_ARG,
vgmetadatacopies_ARG, partial_ARG, physicalextentsize_ARG, poll_ARG,
- refresh_ARG, resizeable_ARG, resizable_ARG, select_ARG, sysinit_ARG,
- systemid_ARG, test_ARG, uuid_ARG, lockstart_ARG, lockstop_ARG, locktype_ARG, lockopt_ARG,
- force_ARG)
+ refresh_ARG, reportformat_ARG, resizeable_ARG, resizable_ARG, select_ARG,
+ sysinit_ARG, systemid_ARG, test_ARG, uuid_ARG, lockstart_ARG, lockstop_ARG,
+ locktype_ARG, lockopt_ARG, force_ARG)
xx(vgck,
"Check the consistency of volume group(s)",
@@ -1104,9 +1126,12 @@ xx(vgck,
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
- "\t[VolumeGroupName...]\n")
+ "\t[VolumeGroupName...]\n",
+
+ reportformat_ARG)
xx(vgconvert,
"Change volume group metadata format",
@@ -1120,6 +1145,7 @@ xx(vgconvert,
"\t[--pvmetadatacopies #copies]\n"
"\t[--metadatasize MetadataSize[bBsSkKmMgGtTpPeE]]\n"
"\t[--bootloaderareasize BootLoaderAreaSize[bBsSkKmMgGtTpPeE]]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
@@ -1127,7 +1153,7 @@ xx(vgconvert,
force_ARG, test_ARG, labelsector_ARG, bootloaderareasize_ARG,
metadatatype_ARG, metadatacopies_ARG, pvmetadatacopies_ARG,
- metadatasize_ARG)
+ metadatasize_ARG, reportformat_ARG)
xx(vgcreate,
"Create a volume group",
@@ -1145,6 +1171,7 @@ xx(vgcreate,
"\t[-M|--metadatatype 1|2]\n"
"\t[--[vg]metadatacopies #copies]\n"
"\t[-p|--maxphysicalvolumes MaxPhysicalVolumes]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-s|--physicalextentsize PhysicalExtentSize[bBsSkKmMgGtTpPeE]]\n"
"\t[--systemid SystemID]\n"
"\t[-t|--test]\n"
@@ -1157,7 +1184,7 @@ xx(vgcreate,
addtag_ARG, alloc_ARG, autobackup_ARG, clustered_ARG, maxlogicalvolumes_ARG,
maxphysicalvolumes_ARG, metadataprofile_ARG, metadatatype_ARG,
physicalextentsize_ARG, test_ARG, force_ARG, zero_ARG, labelsector_ARG,
- metadatasize_ARG, pvmetadatacopies_ARG, metadatacopies_ARG,
+ metadatasize_ARG, pvmetadatacopies_ARG, reportformat_ARG, metadatacopies_ARG,
vgmetadatacopies_ARG, dataalignment_ARG, dataalignmentoffset_ARG,
shared_ARG, systemid_ARG, locktype_ARG, lockopt_ARG)
@@ -1195,6 +1222,7 @@ xx(vgdisplay,
"\t[-o|--options [+|-|#]Field[,Field]]\n"
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
"\t[-P|--partial]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-S|--select Selection]\n"
"\t[--readonly]\n"
"\t[--separator Separator]\n"
@@ -1207,7 +1235,8 @@ xx(vgdisplay,
activevolumegroups_ARG, aligned_ARG, binary_ARG, colon_ARG, columns_ARG,
foreign_ARG, ignorelockingfailure_ARG, ignoreskippedcluster_ARG,
noheadings_ARG, nosuffix_ARG, options_ARG, partial_ARG, readonly_ARG,
- select_ARG, shared_ARG, short_ARG, separator_ARG, sort_ARG, unbuffered_ARG, units_ARG)
+ reportformat_ARG, select_ARG, shared_ARG, short_ARG, separator_ARG,
+ sort_ARG, unbuffered_ARG, units_ARG)
xx(vgexport,
"Unregister volume group(s) from the system",
@@ -1217,12 +1246,13 @@ xx(vgexport,
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-S|--select Selection]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\tVolumeGroupName [VolumeGroupName...]\n",
- all_ARG, select_ARG, test_ARG)
+ all_ARG, reportformat_ARG, select_ARG, test_ARG)
xx(vgextend,
"Add physical volumes to a volume group",
@@ -1234,6 +1264,7 @@ xx(vgextend,
"\t[-d|--debug]\n"
"\t[-f|--force]\n"
"\t[-h|--help]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
@@ -1245,7 +1276,7 @@ xx(vgextend,
force_ARG, zero_ARG, labelsector_ARG, metadatatype_ARG,
metadatasize_ARG, pvmetadatacopies_ARG, metadatacopies_ARG,
metadataignore_ARG, dataalignment_ARG, dataalignmentoffset_ARG,
- restoremissing_ARG)
+ reportformat_ARG, restoremissing_ARG)
xx(vgimport,
"Register exported volume group with system",
@@ -1256,13 +1287,14 @@ xx(vgimport,
"\t[-d|--debug]\n"
"\t[-f|--force]\n"
"\t[-h|--help]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-S|--select Selection]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\tVolumeGroupName...\n",
- all_ARG, force_ARG, select_ARG, test_ARG)
+ all_ARG, force_ARG, reportformat_ARG, select_ARG, test_ARG)
xx(vgmerge,
"Merge volume groups",
@@ -1289,11 +1321,12 @@ xx(vgmknodes,
"\t[-h|--help]\n"
"\t[--ignorelockingfailure]\n"
"\t[--refresh]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\t[VolumeGroupName...]\n",
- ignorelockingfailure_ARG, refresh_ARG)
+ ignorelockingfailure_ARG, refresh_ARG, reportformat_ARG)
xx(vgreduce,
"Remove physical volume(s) from a volume group",
@@ -1306,6 +1339,7 @@ xx(vgreduce,
"\t[-h|--help]\n"
"\t[--mirrorsonly]\n"
"\t[--removemissing]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-f|--force]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
@@ -1314,7 +1348,7 @@ xx(vgreduce,
"\t[PhysicalVolumePath...]\n",
all_ARG, autobackup_ARG, force_ARG, mirrorsonly_ARG, removemissing_ARG,
- test_ARG)
+ reportformat_ARG, test_ARG)
xx(vgremove,
"Remove volume group(s)",
@@ -1325,13 +1359,14 @@ xx(vgremove,
"\t[-f|--force]\n"
"\t[-h|--help]\n"
"\t[--noudevsync]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-S|--select Selection]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\tVolumeGroupName [VolumeGroupName...]\n",
- force_ARG, noudevsync_ARG, select_ARG, test_ARG)
+ force_ARG, noudevsync_ARG, reportformat_ARG, select_ARG, test_ARG)
xx(vgrename,
"Rename a volume group",
@@ -1341,13 +1376,14 @@ xx(vgrename,
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\tOldVolumeGroupPath NewVolumeGroupPath |\n"
"\tOldVolumeGroupName NewVolumeGroupName\n",
- autobackup_ARG, force_ARG, test_ARG)
+ autobackup_ARG, force_ARG, reportformat_ARG, test_ARG)
xx(vgs,
"Display information about volume groups",
@@ -1399,10 +1435,12 @@ xx(vgscan,
"\t[--mknodes]\n"
"\t[--notifydbus]\n"
"\t[-P|--partial]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n",
- cache_long_ARG, ignorelockingfailure_ARG, mknodes_ARG, notifydbus_ARG, partial_ARG)
+ cache_long_ARG, ignorelockingfailure_ARG, mknodes_ARG, notifydbus_ARG,
+ partial_ARG, reportformat_ARG)
xx(vgsplit,
"Move physical volumes into a new or existing volume group",
7 years, 11 months
master - commands: recognize --reportformat option for pvs, vgs, lvs and devtypes command
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f8a93763e59eea...
Commit: f8a93763e59eea8cef3762908c3e663c7a22a4fa
Parent: 10a1b9e18248f08f11af2bb0214fa857d0c9d6fc
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon May 2 14:39:32 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:41 2016 +0200
commands: recognize --reportformat option for pvs,vgs,lvs and devtypes command
Enables --reportformat options for pvs, vgs, lvs, devtypes command.
---
tools/commands.h | 31 +++++++++++++++++--------------
1 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index 888f3a2..b544ae1 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -73,6 +73,7 @@ xx(devtypes,
"\t[--nosuffix]\n"
"\t[-o|--options [+|-|#]Field[,Field]]\n"
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[--rows]\n"
"\t[-S|--select Selection]\n"
"\t[--separator Separator]\n"
@@ -80,10 +81,9 @@ xx(devtypes,
"\t[--unquoted]\n"
"\t[--version]\n",
- aligned_ARG, binary_ARG, nameprefixes_ARG,
- noheadings_ARG, nosuffix_ARG, options_ARG,
- rows_ARG, select_ARG, separator_ARG, sort_ARG,
- unbuffered_ARG, unquoted_ARG)
+ aligned_ARG, binary_ARG, nameprefixes_ARG, noheadings_ARG,
+ nosuffix_ARG, options_ARG, reportformat_ARG, rows_ARG,
+ select_ARG, separator_ARG, sort_ARG, unbuffered_ARG, unquoted_ARG)
xx(dumpconfig,
"Display and manipulate configuration information",
@@ -679,6 +679,7 @@ xx(lvs,
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
"\t[-P|--partial]\n"
"\t[--readonly]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[--rows]\n"
"\t[--segments]\n"
"\t[-S|--select Selection]\n"
@@ -694,9 +695,9 @@ xx(lvs,
aligned_ARG, all_ARG, binary_ARG, foreign_ARG, history_ARG,
ignorelockingfailure_ARG, ignoreskippedcluster_ARG, nameprefixes_ARG,
noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
- readonly_ARG, rows_ARG, segments_ARG, select_ARG, separator_ARG,
- shared_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG,
- unquoted_ARG)
+ readonly_ARG, reportformat_ARG, rows_ARG, segments_ARG, select_ARG,
+ separator_ARG, shared_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG,
+ units_ARG, unquoted_ARG)
xx(lvscan,
"List all logical volumes in all volume groups",
@@ -955,6 +956,7 @@ xx(pvs,
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
"\t[-P|--partial]\n"
"\t[--readonly]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[--rows]\n"
"\t[--segments]\n"
"\t[-S|--select Selection]\n"
@@ -969,9 +971,9 @@ xx(pvs,
aligned_ARG, all_ARG, binary_ARG, foreign_ARG, ignorelockingfailure_ARG,
ignoreskippedcluster_ARG, nameprefixes_ARG, noheadings_ARG, nolocking_ARG,
- nosuffix_ARG, options_ARG, partial_ARG, readonly_ARG, rows_ARG,
- segments_ARG, select_ARG, separator_ARG, shared_ARG, sort_ARG, trustcache_ARG,
- unbuffered_ARG, units_ARG, unquoted_ARG)
+ nosuffix_ARG, options_ARG, partial_ARG, readonly_ARG, reportformat_ARG,
+ rows_ARG, segments_ARG, select_ARG, separator_ARG, shared_ARG, sort_ARG,
+ trustcache_ARG, unbuffered_ARG, units_ARG, unquoted_ARG)
xx(pvscan,
"List all physical volumes",
@@ -1367,6 +1369,7 @@ xx(vgs,
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
"\t[-P|--partial]\n"
"\t[--readonly]\n"
+ "\t[--reportformat {basic|json}]\n"
"\t[--rows]\n"
"\t[-S|--select Selection]\n"
"\t[--separator Separator]\n"
@@ -1379,10 +1382,10 @@ xx(vgs,
"\t[VolumeGroupName [VolumeGroupName...]]\n",
aligned_ARG, all_ARG, binary_ARG, foreign_ARG, ignorelockingfailure_ARG,
- ignoreskippedcluster_ARG, nameprefixes_ARG, noheadings_ARG,
- nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
- readonly_ARG, rows_ARG, select_ARG, separator_ARG, shared_ARG, sort_ARG,
- trustcache_ARG, unbuffered_ARG, units_ARG, unquoted_ARG)
+ ignoreskippedcluster_ARG, nameprefixes_ARG, noheadings_ARG, nolocking_ARG,
+ nosuffix_ARG, options_ARG, partial_ARG, readonly_ARG, reportformat_ARG,
+ rows_ARG, select_ARG, separator_ARG, shared_ARG, sort_ARG, trustcache_ARG,
+ unbuffered_ARG, units_ARG, unquoted_ARG)
xx(vgscan,
"Search for all volume groups",
7 years, 11 months
master - report: add current report to existing group
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=10a1b9e18248f0...
Commit: 10a1b9e18248f08f11af2bb0214fa857d0c9d6fc
Parent: f752a953022387cc7e5c4da11d118c12e3716ce4
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon May 2 14:37:16 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 20 11:33:41 2016 +0200
report: add current report to existing group
Add any report (pvs/vgs/lvs) currently processed to current report group
which is part of processing handle and which already contains log
report. This way both log report and pvs/vgs/lvs report will be
reported as a whole within a group, thus having same output format as
selected by --reportformat option.
---
tools/reporter.c | 54 +++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/tools/reporter.c b/tools/reporter.c
index 7bd5d36..9f4f95a 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -26,6 +26,8 @@ typedef enum {
struct single_report_args {
report_type_t report_type;
+ char report_prefix[32];
+ const char *report_name;
int args_are_pvs;
const char *keys;
const char *options;
@@ -822,6 +824,32 @@ static int _get_report_selection(struct cmd_context *cmd,
return r;
}
+static int _set_report_prefix_and_name(struct single_report_args *single_args)
+{
+ const char *report_prefix;
+ size_t len;
+
+ report_prefix = report_get_field_prefix(single_args->report_type);
+ len = strlen(report_prefix);
+ if (report_prefix[len - 1] == '_')
+ len--;
+
+ if (!len) {
+ log_error(INTERNAL_ERROR "_set_report_prefix_and_name: no prefix "
+ "found for report type 0x%x", single_args->report_type);
+ return 0;
+ }
+
+ if (!dm_strncpy(single_args->report_prefix, report_prefix, sizeof(single_args->report_prefix))) {
+ log_error("_set_report_prefix_and_name: dm_strncpy failed");
+ return 0;
+ }
+ single_args->report_prefix[len] = '\0';
+ single_args->report_name = single_args->report_prefix;
+
+ return 1;
+}
+
static int _do_report(struct cmd_context *cmd, struct report_args *args, struct single_report_args *single_args)
{
struct processing_handle *handle = NULL;
@@ -851,6 +879,9 @@ static int _do_report(struct cmd_context *cmd, struct report_args *args, struct
&report_type))
goto_out;
+ if (!dm_report_group_push(handle->report_group, report_handle, (void *) single_args->report_name))
+ goto_out;
+
/*
* We lock VG_GLOBAL to enable use of metadata cache.
* This can pause alongide pvscan or vgscan process for a while.
@@ -959,6 +990,9 @@ static int _config_report(struct cmd_context *cmd, struct report_args *args, str
/* Check PV specifics and do extra changes/actions if needed. */
_check_pv_list(cmd, args, single_args);
+ if (!_set_report_prefix_and_name(single_args))
+ return_0;
+
switch (single_args->report_type) {
case DEVTYPES:
single_args->keys = find_config_tree_str(cmd, report_devtypes_sort_CFG, NULL);
@@ -1141,10 +1175,10 @@ int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_g
}
if (report_command_log) {
- if (!*log_rh) {
- single_args = &args.single_args[REPORT_IDX_LOG];
- single_args->report_type = CMDLOG;
+ single_args = &args.single_args[REPORT_IDX_LOG];
+ single_args->report_type = CMDLOG;
+ if (!*log_rh) {
if (!_config_report(cmd, &args, single_args))
goto_bad;
@@ -1155,19 +1189,21 @@ int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_g
log_error("Failed to create log report.");
goto bad;
}
+ } else {
+ /*
+ * We reusing existing log report handle.
+ * Just get report's name and prefix now.
+ */
+ if (!_set_report_prefix_and_name(single_args))
+ goto_bad;
}
- if (!(dm_report_group_push(new_report_group, *log_rh ? : tmp_log_rh, log_report_name))) {
+ if (!(dm_report_group_push(new_report_group, tmp_log_rh ? : *log_rh, (void *) single_args->report_name))) {
log_error("Failed to add log report to report group.");
goto bad;
}
}
- if (!(dm_report_group_push(new_report_group, tmp_log_rh ? : *log_rh, log_report_name))) {
- log_error("Failed to add log report to report group.");
- goto bad;
- }
-
*report_group = new_report_group;
if (tmp_log_rh)
*log_rh = tmp_log_rh;
7 years, 11 months