master - test: process-each-duplicate-pvs
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f3d508630d7acd...
Commit: f3d508630d7acdd638afae700973f1d68e43cbcc
Parent: 5c18b0ce9c5e4f94cce83a98cb2d996875cfa812
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed May 11 09:35:07 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 11 09:35:42 2016 -0500
test: process-each-duplicate-pvs
skip on RHEL5 where DEV_USED_FOR_LV doesn't work
because it depends on a newer bit of sysfs.
---
test/shell/process-each-duplicate-pvs.sh | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/test/shell/process-each-duplicate-pvs.sh b/test/shell/process-each-duplicate-pvs.sh
index 41d844d..9ab98dc 100644
--- a/test/shell/process-each-duplicate-pvs.sh
+++ b/test/shell/process-each-duplicate-pvs.sh
@@ -15,6 +15,11 @@ SKIP_WITH_CLVMD=1
aux prepare_devs 6 16
+# The LV-using-PV tests (DEV_USED_FOR_LV, where a PV is
+# preferred if an active LV is using it) depend on sysfs
+# info that is not available in RHEL5 kernels.
+aux driver_at_least 4 15 || skip
+
aux lvmconf 'devices/allow_changes_with_duplicate_pvs = 0'
pvcreate "$dev1"
7 years
master - refactor: separate original _report fn into _report and _do_report fn
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5c18b0ce9c5e4f...
Commit: 5c18b0ce9c5e4f94cce83a98cb2d996875cfa812
Parent: 04987e7f49b7e4752b9716f04a0a10221f2ada8b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue May 10 13:57:23 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue May 10 14:00:13 2016 +0200
refactor: separate original _report fn into _report and _do_report fn
The _report fn is getting big - separate it in two:
- _report fn to get all the options and arguments
- _do_report fn for reporting itself
Also, place all the variables/arguments in one structure for easier
handling of the variables around.
---
tools/reporter.c | 403 +++++++++++++++++++++++++++++-------------------------
1 files changed, 215 insertions(+), 188 deletions(-)
diff --git a/tools/reporter.c b/tools/reporter.c
index fb09263..4e27159 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -17,6 +17,24 @@
#include "report.h"
+struct report_args {
+ int argc;
+ char **argv;
+ report_type_t report_type;
+ int args_are_pvs;
+ int aligned;
+ int buffered;
+ int headings;
+ int field_prefixes;
+ int quoted;
+ int columns_as_rows;
+ const char *keys;
+ const char *options;
+ const char *fields_to_compact;
+ const char *separator;
+ const char *selection;
+};
+
static int _process_each_devtype(struct cmd_context *cmd, int argc,
struct processing_handle *handle)
{
@@ -605,31 +623,30 @@ int report_for_selection(struct cmd_context *cmd,
return r;
}
-static void _check_pv_list(struct cmd_context *cmd, int argc, char **argv,
- report_type_t *report_type, unsigned *args_are_pvs)
+static void _check_pv_list(struct cmd_context *cmd, struct report_args *args)
{
unsigned i;
int rescan_done = 0;
- *args_are_pvs = (*report_type == PVS ||
- *report_type == LABEL ||
- *report_type == PVSEGS) ? 1 : 0;
+ args->args_are_pvs = (args->report_type == PVS ||
+ args->report_type == LABEL ||
+ args->report_type == PVSEGS) ? 1 : 0;
- if (*args_are_pvs && argc) {
- for (i = 0; i < argc; i++) {
- if (!rescan_done && !dev_cache_get(argv[i], cmd->full_filter)) {
+ if (args->args_are_pvs && args->argc) {
+ for (i = 0; i < args->argc; i++) {
+ if (!rescan_done && !dev_cache_get(args->argv[i], cmd->full_filter)) {
cmd->filter->wipe(cmd->filter);
/* FIXME scan only one device */
lvmcache_label_scan(cmd);
rescan_done = 1;
}
- if (*argv[i] == '@') {
+ if (*args->argv[i] == '@') {
/*
* Tags are metadata related, not label
* related, change report type accordingly!
*/
- if (*report_type == LABEL)
- *report_type = PVS;
+ if (args->report_type == LABEL)
+ args->report_type = PVS;
/*
* If we changed the report_type and we did rescan,
* no need to iterate over dev list further - nothing
@@ -679,11 +696,9 @@ static void _del_option_from_list(struct dm_list *sll, const char *prefix,
}
static int _get_report_options(struct cmd_context *cmd,
- report_type_t report_type,
- const char **options,
- const char **fields_to_compact)
+ struct report_args *args)
{
- const char *prefix = report_get_field_prefix(report_type);
+ const char *prefix = report_get_field_prefix(args->report_type);
size_t prefix_len = strlen(prefix);
struct arg_value_group_list *current_group;
struct dm_list *final_opts_list;
@@ -699,7 +714,7 @@ static int _get_report_options(struct cmd_context *cmd,
return ECMD_FAILED;
}
- if (!(final_opts_list = str_to_str_list(mem, *options, ",", 1))) {
+ if (!(final_opts_list = str_to_str_list(mem, args->options, ",", 1))) {
r = ECMD_FAILED;
goto_out;
}
@@ -746,13 +761,13 @@ static int _get_report_options(struct cmd_context *cmd,
}
}
- if (!(*options = str_list_to_str(cmd->mem, final_opts_list, ","))) {
+ if (!(args->options = str_list_to_str(cmd->mem, final_opts_list, ","))) {
r = ECMD_FAILED;
goto_out;
}
if (final_compact_list &&
- !(*fields_to_compact = str_list_to_str(cmd->mem, final_compact_list, ","))) {
- dm_pool_free(cmd->mem, (char *) *options);
+ !(args->fields_to_compact = str_list_to_str(cmd->mem, final_compact_list, ","))) {
+ dm_pool_free(cmd->mem, (char *) args->options);
r = ECMD_FAILED;
goto_out;
}
@@ -762,131 +777,30 @@ out:
return r;
}
-static int _report(struct cmd_context *cmd, int argc, char **argv,
- report_type_t report_type)
+static int _do_report(struct cmd_context *cmd, struct report_args *args)
{
- void *report_handle = NULL;
struct processing_handle *handle = NULL;
- const char *keys = NULL, *options = NULL, *selection = NULL, *separator;
- int r = ECMD_FAILED;
- int aligned, buffered, headings, field_prefixes, quoted;
- int columns_as_rows;
- unsigned args_are_pvs;
- int lv_info_needed, lv_segment_status_needed;
+ report_type_t report_type = args->report_type;
+ void *report_handle = NULL;
int lock_global = 0;
- const char *fields_to_compact = NULL;
-
- aligned = find_config_tree_bool(cmd, report_aligned_CFG, NULL);
- buffered = find_config_tree_bool(cmd, report_buffered_CFG, NULL);
- headings = find_config_tree_bool(cmd, report_headings_CFG, NULL);
- separator = find_config_tree_str(cmd, report_separator_CFG, NULL);
- field_prefixes = find_config_tree_bool(cmd, report_prefixes_CFG, NULL);
- quoted = find_config_tree_bool(cmd, report_quoted_CFG, NULL);
- columns_as_rows = find_config_tree_bool(cmd, report_colums_as_rows_CFG, NULL);
-
- /*
- * Include foreign VGs that contain active LVs.
- * That shouldn't happen in general, but if it does by some
- * mistake, then we want to display those VGs and allow the
- * LVs to be deactivated.
- */
- cmd->include_active_foreign_vgs = 1;
-
- /* Check PV specifics and do extra changes/actions if needed. */
- _check_pv_list(cmd, argc, argv, &report_type, &args_are_pvs);
-
- switch (report_type) {
- case DEVTYPES:
- keys = find_config_tree_str(cmd, report_devtypes_sort_CFG, NULL);
- if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_devtypes_cols_CFG, NULL);
- else
- options = find_config_tree_str(cmd, report_devtypes_cols_verbose_CFG, NULL);
- break;
- case LVS:
- keys = find_config_tree_str(cmd, report_lvs_sort_CFG, NULL);
- if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_lvs_cols_CFG, NULL);
- else
- options = find_config_tree_str(cmd, report_lvs_cols_verbose_CFG, NULL);
- break;
- case VGS:
- keys = find_config_tree_str(cmd, report_vgs_sort_CFG, NULL);
- if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_vgs_cols_CFG, NULL);
- else
- options = find_config_tree_str(cmd, report_vgs_cols_verbose_CFG, NULL);
- break;
- case LABEL:
- case PVS:
- keys = find_config_tree_str(cmd, report_pvs_sort_CFG, NULL);
- if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_pvs_cols_CFG, NULL);
- else
- options = find_config_tree_str(cmd, report_pvs_cols_verbose_CFG, NULL);
- break;
- case SEGS:
- keys = find_config_tree_str(cmd, report_segs_sort_CFG, NULL);
- if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_segs_cols_CFG, NULL);
- else
- options = find_config_tree_str(cmd, report_segs_cols_verbose_CFG, NULL);
- break;
- case PVSEGS:
- keys = find_config_tree_str(cmd, report_pvsegs_sort_CFG, NULL);
- if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_pvsegs_cols_CFG, NULL);
- else
- options = find_config_tree_str(cmd, report_pvsegs_cols_verbose_CFG, NULL);
- break;
- default:
- log_error(INTERNAL_ERROR "Unknown report type.");
- goto out;
- }
-
- /* If -o supplied use it, else use default for report_type */
- if (arg_count(cmd, options_ARG) &&
- ((r = _get_report_options(cmd, report_type, &options, &fields_to_compact) != ECMD_PROCESSED)))
- goto_out;
-
- /* -O overrides default sort settings */
- keys = arg_str_value(cmd, sort_ARG, keys);
-
- separator = arg_str_value(cmd, separator_ARG, separator);
- if (arg_count(cmd, separator_ARG))
- aligned = 0;
- if (arg_count(cmd, aligned_ARG))
- aligned = 1;
- if (arg_count(cmd, unbuffered_ARG) && !arg_count(cmd, sort_ARG))
- buffered = 0;
- if (arg_count(cmd, noheadings_ARG))
- headings = 0;
- if (arg_count(cmd, nameprefixes_ARG)) {
- aligned = 0;
- field_prefixes = 1;
- }
- if (arg_count(cmd, unquoted_ARG))
- quoted = 0;
- if (arg_count(cmd, rows_ARG))
- columns_as_rows = 1;
-
- if (arg_count(cmd, select_ARG))
- selection = arg_str_value(cmd, select_ARG, NULL);
+ int lv_info_needed;
+ int lv_segment_status_needed;
+ int r = ECMD_FAILED;
if (!(handle = init_processing_handle(cmd)))
goto_out;
- if (!(report_handle = report_init(cmd, options, keys, &report_type,
- separator, aligned, buffered,
- headings, field_prefixes, quoted,
- columns_as_rows, selection)))
+ if (!(report_handle = report_init(cmd, args->options, args->keys, &report_type,
+ args->separator, args->aligned, args->buffered,
+ args->headings, args->field_prefixes, args->quoted,
+ args->columns_as_rows, 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(args_are_pvs,
+ if (!_get_final_report_type(args->args_are_pvs,
report_type, &lv_info_needed,
&lv_segment_status_needed,
&report_type))
@@ -896,7 +810,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
* We lock VG_GLOBAL to enable use of metadata cache.
* This can pause alongide pvscan or vgscan process for a while.
*/
- if (args_are_pvs && (report_type == PVS || report_type == PVSEGS) &&
+ if (args->args_are_pvs && (report_type == PVS || report_type == PVSEGS) &&
!lvmetad_used()) {
lock_global = 1;
if (!lock_vol(cmd, VG_GLOBAL, LCK_VG_READ, NULL)) {
@@ -906,67 +820,69 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
}
switch (report_type) {
- case DEVTYPES:
- r = _process_each_devtype(cmd, argc, handle);
- break;
- case LVSINFO:
- /* fall through */
- case LVSSTATUS:
- /* fall through */
- case LVSINFOSTATUS:
- /* fall through */
- case LVS:
- r = process_each_lv(cmd, argc, argv, 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, argc, argv, NULL, 0,
- handle, &_vgs_single);
- break;
- case LABEL:
- r = process_each_label(cmd, argc, argv,
- handle, &_label_single);
- break;
- case PVS:
- if (args_are_pvs)
- r = process_each_pv(cmd, argc, argv, NULL,
- arg_is_set(cmd, all_ARG), 0,
- handle, &_pvs_single);
- else
- r = process_each_vg(cmd, argc, argv, NULL, 0,
- handle, &_pvs_in_vg);
- break;
- case SEGS:
- r = process_each_lv(cmd, argc, argv, 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 (args_are_pvs)
- r = process_each_pv(cmd, argc, 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, argc, argv, NULL, 0,
- handle, &_pvsegs_in_vg);
- break;
+ case DEVTYPES:
+ r = _process_each_devtype(cmd, args->argc, handle);
+ break;
+ case LVSINFO:
+ /* fall through */
+ case LVSSTATUS:
+ /* fall through */
+ case LVSINFOSTATUS:
+ /* fall through */
+ case LVS:
+ r = process_each_lv(cmd, args->argc, args->argv, 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, 0,
+ handle, &_vgs_single);
+ break;
+ case LABEL:
+ r = process_each_label(cmd, args->argc, args->argv,
+ handle, &_label_single);
+ break;
+ case PVS:
+ if (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,
+ 0, handle, &_pvs_in_vg);
+ break;
+ case SEGS:
+ r = process_each_lv(cmd, args->argc, args->argv, 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 (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,
+ 0, handle, &_pvsegs_in_vg);
+ break;
+ default:
+ log_error(INTERNAL_ERROR "_do_report: unknown report type.");
+ return 0;
}
if (find_config_tree_bool(cmd, report_compact_output_CFG, NULL)) {
if (!dm_report_compact_fields(report_handle))
log_error("Failed to compact report output.");
- } else if (fields_to_compact ||
- (fields_to_compact = find_config_tree_str_allow_empty(cmd, report_compact_output_cols_CFG, NULL))) {
- if (!dm_report_compact_given_fields(report_handle, fields_to_compact))
+ } else if (args->fields_to_compact) {
+ if (!dm_report_compact_given_fields(report_handle, args->fields_to_compact))
log_error("Failed to compact given columns in report output.");
}
@@ -982,6 +898,117 @@ out:
return r;
}
+static int _report(struct cmd_context *cmd, int argc, char **argv, report_type_t report_type)
+{
+ struct report_args args = {0};
+
+ /*
+ * Include foreign VGs that contain active LVs.
+ * That shouldn't happen in general, but if it does by some
+ * mistake, then we want to display those VGs and allow the
+ * LVs to be deactivated.
+ */
+ cmd->include_active_foreign_vgs = 1;
+
+ args.argc = argc;
+ args.argv = argv;
+ args.report_type = report_type;
+
+ args.aligned = find_config_tree_bool(cmd, report_aligned_CFG, NULL);
+ args.buffered = find_config_tree_bool(cmd, report_buffered_CFG, NULL);
+ args.headings = find_config_tree_bool(cmd, report_headings_CFG, NULL);
+ args.separator = find_config_tree_str(cmd, report_separator_CFG, NULL);
+ args.field_prefixes = find_config_tree_bool(cmd, report_prefixes_CFG, NULL);
+ args.quoted = find_config_tree_bool(cmd, report_quoted_CFG, NULL);
+ args.columns_as_rows = find_config_tree_bool(cmd, report_colums_as_rows_CFG, NULL);
+
+ /* Check PV specifics and do extra changes/actions if needed. */
+ _check_pv_list(cmd, &args);
+
+ switch (args.report_type) {
+ case DEVTYPES:
+ args.keys = find_config_tree_str(cmd, report_devtypes_sort_CFG, NULL);
+ if (!arg_count(cmd, verbose_ARG))
+ args.options = find_config_tree_str(cmd, report_devtypes_cols_CFG, NULL);
+ else
+ args.options = find_config_tree_str(cmd, report_devtypes_cols_verbose_CFG, NULL);
+ break;
+ case LVS:
+ args.keys = find_config_tree_str(cmd, report_lvs_sort_CFG, NULL);
+ if (!arg_count(cmd, verbose_ARG))
+ args.options = find_config_tree_str(cmd, report_lvs_cols_CFG, NULL);
+ else
+ args.options = find_config_tree_str(cmd, report_lvs_cols_verbose_CFG, NULL);
+ break;
+ case VGS:
+ args.keys = find_config_tree_str(cmd, report_vgs_sort_CFG, NULL);
+ if (!arg_count(cmd, verbose_ARG))
+ args.options = find_config_tree_str(cmd, report_vgs_cols_CFG, NULL);
+ else
+ args.options = find_config_tree_str(cmd, report_vgs_cols_verbose_CFG, NULL);
+ break;
+ case LABEL:
+ case PVS:
+ args.keys = find_config_tree_str(cmd, report_pvs_sort_CFG, NULL);
+ if (!arg_count(cmd, verbose_ARG))
+ args.options = find_config_tree_str(cmd, report_pvs_cols_CFG, NULL);
+ else
+ args.options = find_config_tree_str(cmd, report_pvs_cols_verbose_CFG, NULL);
+ break;
+ case SEGS:
+ args.keys = find_config_tree_str(cmd, report_segs_sort_CFG, NULL);
+ if (!arg_count(cmd, verbose_ARG))
+ args.options = find_config_tree_str(cmd, report_segs_cols_CFG, NULL);
+ else
+ args.options = find_config_tree_str(cmd, report_segs_cols_verbose_CFG, NULL);
+ break;
+ case PVSEGS:
+ args.keys = find_config_tree_str(cmd, report_pvsegs_sort_CFG, NULL);
+ if (!arg_count(cmd, verbose_ARG))
+ args.options = find_config_tree_str(cmd, report_pvsegs_cols_CFG, NULL);
+ else
+ args.options = find_config_tree_str(cmd, report_pvsegs_cols_verbose_CFG, NULL);
+ break;
+ default:
+ log_error(INTERNAL_ERROR "_report: unknown report type.");
+ return 0;
+ }
+
+ /* If -o supplied use it, else use default for report_type */
+ if (arg_count(cmd, options_ARG) &&
+ (_get_report_options(cmd, &args) != ECMD_PROCESSED))
+ return_0;
+
+ if (!args.fields_to_compact)
+ args.fields_to_compact = find_config_tree_str_allow_empty(cmd, report_compact_output_cols_CFG, NULL);
+
+ /* -O overrides default sort settings */
+ args.keys = arg_str_value(cmd, sort_ARG, args.keys);
+
+ args.separator = arg_str_value(cmd, separator_ARG, args.separator);
+ if (arg_count(cmd, separator_ARG))
+ args.aligned = 0;
+ if (arg_count(cmd, aligned_ARG))
+ args.aligned = 1;
+ if (arg_count(cmd, unbuffered_ARG) && !arg_count(cmd, sort_ARG))
+ args.buffered = 0;
+ if (arg_count(cmd, noheadings_ARG))
+ args.headings = 0;
+ if (arg_count(cmd, nameprefixes_ARG)) {
+ args.aligned = 0;
+ args.field_prefixes = 1;
+ }
+ if (arg_count(cmd, unquoted_ARG))
+ args.quoted = 0;
+ if (arg_count(cmd, rows_ARG))
+ args.columns_as_rows = 1;
+
+ if (arg_count(cmd, select_ARG))
+ args.selection = arg_str_value(cmd, select_ARG, NULL);
+
+ return _do_report(cmd, &args);
+}
+
int lvs(struct cmd_context *cmd, int argc, char **argv)
{
report_type_t type;
7 years
v2_02_153 annotated tag has been created
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7cab5766ada282...
Commit: 7cab5766ada282979c83db33d0384ad212888f13
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2016-05-06 23:37 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2016-05-06 23:37 +0000
annotated tag: v2_02_153 has been created
at 7cab5766ada282979c83db33d0384ad212888f13 (tag)
tagging e4caf0beebd3718bf77a04905ed2f65712707a5d (commit)
replaces v2_02_152
Release 2.02.153.
A development release with improvements in duplicate PV detection and
handling. Duplicate PVs might be different paths to the same device or
cloned devices and these two cases need to be treated differently. If
the code couldn't tell, it used to assume multipath rather than clones,
but now it wants you to resolve the problem yourself - run multipath or
vgimportclone or configure filters to hide devices.
(A configuration setting lets you return to something close to the
previous behaviour.)
44 files changed, 1641 insertions(+), 839 deletions(-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlctLSgACgkQIoGRwVZ+LBfz6ACfVeFy36HH+9c7qNDH+Q3CJYhq
ursAoOn0v+XSEoy4nxr2WFd0GLzUBwdS
=Qs4F
-----END PGP SIGNATURE-----
Alasdair G Kergon (2):
post-release
pre-release
David Teigland (20):
pvcreate, pvremove: translate arg name to device once
pvcreate: improve debug message
pvscan: fix errors for single dev scan while lvmetad is disabled
lvmetad: set disabled flag in lvmetad if duplicate PVs are found
lvmetad: set disabled flag when duplicate PVs are seen
lvmetad: remove client side altdev code
lvmcache: improve duplicate PV handling
lvmcache: process duplicate PVs directly
pvs: new attr and field for unchosen duplicate device
lvmcache: use active LVs and device sizes to choose between duplicates
lvmetad: disable if device scan fails
lvmetad: add duplicate resolution advice
test: process-each-duplicate-pvs
test: pv-duplicate-uuid
test: lvmetad-ambiguous
test: vgsplit-usage
test: vgcfgbackup-usage
test: vgcfgbackup-lvm1
metadata: move warning message about repairing VG
WHATS_NEW: duplicate PVs
Zdenek Kabelac (18):
cache: function for min metadata size estimation
cache: add validate_lv_cache_chunk_size
cache: add cache_set_params function
cleanup: gather version info with single check
cache: use target_present_version
debug: enhance debug msg for cache
lvcreate: check for lv type and created segtype
lvcreate: improve --chunksize support for cached volume.
cleanup: just switch error path
cleanup: enhance warning message
cleanup: use unsigned with EPOCH printf format
tests: check for thin tools
tests: check default policy is used when unspecified
tests: update aux raid support
tests: do not use EPOCH for get wrapper
segtype: check for activation2
cleanup: drop tracing
activation: activation check is mandatory
7 years, 1 month
master - post-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=04987e7f49b7e4...
Commit: 04987e7f49b7e4752b9716f04a0a10221f2ada8b
Parent: e4caf0beebd3718bf77a04905ed2f65712707a5d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Sat May 7 00:48:40 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Sat May 7 00:48:40 2016 +0100
post-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 3 +++
WHATS_NEW_DM | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index 7909645..ebf6c49 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.153(2)-git (2016-05-07)
+2.02.154(2)-git (2016-05-07)
diff --git a/VERSION_DM b/VERSION_DM
index 17bcab0..5f973c5 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.124-git (2016-05-07)
+1.02.125-git (2016-05-07)
diff --git a/WHATS_NEW b/WHATS_NEW
index 721d8b7..89fa681 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.02.154 -
+===============================
+
Version 2.02.153 - 7th May 2016
===============================
Change warning messages related to duplicate PVs.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 24561d4..f6392ef 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.125 -
+==================================
+
Version 1.02.124 - 30th April 2016
==================================
Add dm_udev_wait_immediate to libdevmapper for waiting outside the library.
7 years, 1 month
master - pre-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e4caf0beebd371...
Commit: e4caf0beebd3718bf77a04905ed2f65712707a5d
Parent: 1202713f94cb2b0f6f5160d49615f4b839a862a7
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Sat May 7 00:36:59 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Sat May 7 00:36:59 2016 +0100
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 4 ++--
WHATS_NEW_DM | 3 ---
conf/example.conf.in | 13 +++++++++++++
5 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/VERSION b/VERSION
index 680848d..7909645 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.153(2)-git (2016-04-30)
+2.02.153(2)-git (2016-05-07)
diff --git a/VERSION_DM b/VERSION_DM
index 1eb63a8..17bcab0 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.125-git (2016-04-30)
+1.02.124-git (2016-05-07)
diff --git a/WHATS_NEW b/WHATS_NEW
index c8cee76..721d8b7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,5 @@
-Version 2.02.153 -
-==================================
+Version 2.02.153 - 7th May 2016
+===============================
Change warning messages related to duplicate PVs.
A named device is always processed itself, not switched for a duplicate.
Add PV attr "d" and report field "duplicate" for duplicate PVs.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index f6392ef..24561d4 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,6 +1,3 @@
-Version 1.02.125 -
-==================================
-
Version 1.02.124 - 30th April 2016
==================================
Add dm_udev_wait_immediate to libdevmapper for waiting outside the library.
diff --git a/conf/example.conf.in b/conf/example.conf.in
index a6a6762..c34481e 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -299,6 +299,19 @@ devices {
# generally do. If enabled, discards will only be issued if both the
# storage and kernel provide support.
issue_discards = 0
+
+ # Configuration option devices/allow_changes_with_duplicate_pvs.
+ # Allow VG modification while a PV appears on multiple devices.
+ # When a PV appears on multiple devices, LVM attempts to choose the
+ # best device to use for the PV. If the devices represent the same
+ # underlying storage, the choice has minimal consequence. If the
+ # devices represent different underlying storage, the wrong choice
+ # can result in data loss if the VG is modified. Disabling this
+ # setting is the safest option because it prevents modifying a VG
+ # or activating LVs in it while a PV appears on multiple devices.
+ # Enabling this setting allows the VG to be used as usual even with
+ # uncertain devices.
+ allow_changes_with_duplicate_pvs = 0
}
# Configuration section allocation.
7 years, 1 month
master - activation: activation check is mandatory
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1202713f94cb2b...
Commit: 1202713f94cb2b0f6f5160d49615f4b839a862a7
Parent: 2842a645fdb66ce1f90cad1fd206912eef365059
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 6 13:59:50 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 6 16:48:16 2016 +0200
activation: activation check is mandatory
Make missing activation() check before calling target_persent
an INTERNAL_ERROR.
---
lib/activate/activate.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 712f86c..1ef83d3 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -636,9 +636,10 @@ int target_present_version(struct cmd_context *cmd, const char *target_name,
int use_modprobe,
uint32_t *maj, uint32_t *min, uint32_t *patchlevel)
{
- if (!activation())
- return_0;
-
+ if (!activation()) {
+ log_error(INTERNAL_ERROR "Target present version called when activation is disabled.");
+ return 0;
+ }
#ifdef MODPROBE_CMD
if (use_modprobe) {
if (target_version(target_name, maj, min, patchlevel))
7 years, 1 month
master - cleanup: drop tracing
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2842a645fdb66c...
Commit: 2842a645fdb66ce1f90cad1fd206912eef365059
Parent: db606591c0b8aa173661377be066be7bd78c5351
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 6 13:59:13 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 6 16:48:16 2016 +0200
cleanup: drop tracing
When activation is disabled, avoid tracing it in cache target.
---
lib/cache_segtype/cache.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index 0cbb993..9d56f32 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -230,7 +230,7 @@ static int _target_present(struct cmd_context *cmd,
const char *str;
if (!activation())
- return_0;
+ return 0;
if (!_cache_checked) {
_cache_checked = 1;
7 years, 1 month
master - segtype: check for activation2
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=db606591c0b8aa...
Commit: db606591c0b8aa173661377be066be7bd78c5351
Parent: 144169b9b704a8c9693ee52bcc812c4f07d2ef8f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 6 13:57:36 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 6 16:48:16 2016 +0200
segtype: check for activation2
Previous patch 8857b227645e97b7cb52ae8d007e87e07db58b4e missed
to check for activation for raid target.
---
lib/raid/raid.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 67c355a..28fd45b 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -319,6 +319,9 @@ static int _raid_target_present(struct cmd_context *cmd,
uint32_t maj, min, patchlevel;
unsigned i;
+ if (!activation())
+ return 0;
+
if (!_raid_checked) {
_raid_checked = 1;
7 years, 1 month
master - WHATS_NEW: duplicate PVs
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=144169b9b704a8...
Commit: 144169b9b704a8c9693ee52bcc812c4f07d2ef8f
Parent: e2d823eced26b97874399670a59c1d5b9c1fb54d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 6 09:30:01 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 6 09:30:01 2016 -0500
WHATS_NEW: duplicate PVs
---
WHATS_NEW | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index eb442df..c8cee76 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,11 @@
Version 2.02.153 -
==================================
+ Change warning messages related to duplicate PVs.
+ A named device is always processed itself, not switched for a duplicate.
+ Add PV attr "d" and report field "duplicate" for duplicate PVs.
+ Add config setting to disallow VG changes when duplicate PVs exist.
+ Use device size and active LVs to choose the preferred duplicate PV.
+ Disable lvmetad when duplicate PVs are seen.
Support --chunksize option also when caching LV when possible.
Add function to check for target presence and version via 1 ioctl.
7 years, 1 month
master - metadata: move warning message about repairing VG
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e2d823eced26b9...
Commit: e2d823eced26b97874399670a59c1d5b9c1fb54d
Parent: fa130722cbe3f7ac7f80fce4bcd3c3dc12d6897e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu May 5 12:47:29 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 6 09:00:00 2016 -0500
metadata: move warning message about repairing VG
Move the message to just before the repair is going
to happen to avoid printing the message in cases
where repair is skipped.
---
lib/metadata/metadata.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index dbe443e..8adcbbd 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3942,6 +3942,8 @@ static int _repair_inconsistent_vg(struct volume_group *vg)
return 0;
}
+ log_warn("WARNING: Inconsistent metadata found for VG %s - updating to use version %u", vg->name, vg->seqno);
+
vg->cmd->handles_missing_pvs = 1;
if (!vg_write(vg)) {
log_error("Automatic metadata correction failed");
@@ -4554,9 +4556,6 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
return correct_vg;
}
- log_warn("WARNING: Inconsistent metadata found for VG %s - updating "
- "to use version %u", vgname, correct_vg->seqno);
-
/*
* If PV is marked missing but we found it,
* update metadata and remove MISSING flag
7 years, 1 month