mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-22 09:57:47 +03:00
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.
This commit is contained in:
parent
baee45a103
commit
f7e0a4cc18
@ -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 */
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user