diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-01 15:22:48 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-03 13:49:14 +0100 |
commit | f7e0a4cc1809c371a4aee2a3da8a3545379fcfbf (patch) | |
tree | 2691d43bb099598be16da844327ec3dd7bb19bcd | |
parent | baee45a103846a995b847e04c1c2985bfd1743e0 (diff) | |
download | lvm2-f7e0a4cc1809c371a4aee2a3da8a3545379fcfbf.tar.gz |
cmd: add '-H|--history' switch and wire it up in cmd_context and processing_handle
This patch adds "include_historical_lvs" field to struct cmd_context to
make it possible for the command to switch between original funcionality
where no historical LVs are processed and functionality where historical
LVs are taken into account (and reported or processed further). The switch
between these modes is done using the '-H|--history' switch on command
line.
The include_historical_lvs state is then passed to process_each_* fns
using the "include_historical_lvs" field within struct processing_handle.
-rw-r--r-- | lib/commands/toolcontext.h | 1 | ||||
-rw-r--r-- | tools/args.h | 1 | ||||
-rw-r--r-- | tools/lvmcmdline.c | 1 | ||||
-rw-r--r-- | tools/reporter.c | 5 | ||||
-rw-r--r-- | tools/toollib.c | 1 | ||||
-rw-r--r-- | tools/toollib.h | 1 |
6 files changed, 10 insertions, 0 deletions
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h index 5fda9a9b5..b5328e803 100644 --- a/lib/commands/toolcontext.h +++ b/lib/commands/toolcontext.h @@ -128,6 +128,7 @@ struct cmd_context { unsigned threaded:1; /* set if running within a thread e.g. clvmd */ unsigned independent_metadata_areas:1; /* active formats have MDAs outside PVs */ unsigned unknown_system_id:1; + unsigned include_historical_lvs:1; /* also process/report/display historical LVs */ unsigned include_foreign_vgs:1; /* report/display cmds can reveal foreign VGs */ unsigned include_shared_vgs:1; /* report/display cmds can reveal lockd VGs */ unsigned include_active_foreign_vgs:1; /* cmd should process foreign VGs with active LVs */ diff --git a/tools/args.h b/tools/args.h index 68de52467..8dfe7440c 100644 --- a/tools/args.h +++ b/tools/args.h @@ -163,6 +163,7 @@ 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) diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 29c1c7eac..4a5cd2355 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1101,6 +1101,7 @@ static int _get_settings(struct cmd_context *cmd) cmd->ignore_clustered_vgs = arg_is_set(cmd, ignoreskippedcluster_ARG); cmd->include_foreign_vgs = arg_is_set(cmd, foreign_ARG) ? 1 : 0; cmd->include_shared_vgs = arg_is_set(cmd, shared_ARG) ? 1 : 0; + cmd->include_historical_lvs = arg_is_set(cmd, history_ARG) ? 1 : 0; /* * This is set to zero by process_each which wants to print errors diff --git a/tools/reporter.c b/tools/reporter.c index 0c73a0955..1a708c40a 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -65,6 +65,10 @@ static int _do_info_and_status(struct cmd_context *cmd, unsigned use_layer = lv_is_thin_pool(lv) ? 1 : 0; status->lv = lv; + + if (lv_is_historical(lv)) + return 1; + if (do_status) { if (!(status->seg_status.mem = dm_pool_create("reporter_pool", 1024))) return_0; @@ -866,6 +870,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, } handle.internal_report_for_select = 0; + handle.include_historical_lvs = cmd->include_historical_lvs; handle.custom_handle = report_handle; switch (report_type) { diff --git a/tools/toollib.c b/tools/toollib.c index dba5023a4..38335819a 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -1692,6 +1692,7 @@ struct processing_handle *init_processing_handle(struct cmd_context *cmd) * *The internal report for select is only needed for non-reporting tools!* */ handle->internal_report_for_select = arg_is_set(cmd, select_ARG); + handle->include_historical_lvs = cmd->include_historical_lvs; return handle; } diff --git a/tools/toollib.h b/tools/toollib.h index a67b3e662..19f4dd009 100644 --- a/tools/toollib.h +++ b/tools/toollib.h @@ -70,6 +70,7 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm); */ struct processing_handle { int internal_report_for_select; + int include_historical_lvs; struct selection_handle *selection_handle; void *custom_handle; }; |