Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e4ec6bcdd38505c6…
Commit: e4ec6bcdd38505c6c229d578aa3eca006441b035
Parent: 815f1ee26d5ee5c64493f83a78f8c074fc8c82d8
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon May 30 16:37:05 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon May 30 16:46:18 2016 +0200
report: fix lvm devtypes internal error if -S is used with field name from pvs/vgs/lvs
Before this fix, when reporting 'lvm devtypes', the report was
initialized with incorrect reserved values - the ones used for
pvs/vgs/lvs report were used instead of NULL value (because devtypes
doesn't have any reserved values).
For example, trying to (incorrectly) use lv_name for the -S|--select
with lvm devtypes which doesn't have this field at all:
Before this patch (internal error issued):
$ lvm devtypes -S 'lv_name=lvol0'
Internal error: _check_reserved_values_supported: field-specific reserved value of type 0x0 for field not supported
Internal error: dm_report_init_with_selection: trying to register unsupported reserved value type, skipping report selection
DevType MaxParts Description
aoe 16 ATA over Ethernet
ataraid 16 ATA Raid
bcache 1 bcache block device cache
...
With this patch applied (correct error displayed about
unrecognized selection field):
$ lvm devtypes -S 'lv_name=lvol0'
Device Types Fields
-------------------
devtype_name - Name of Device Type exactly as it appears in /proc/devices. [string]
devtype_max_partitions - Maximum number of partitions. (How many device minor numbers get reserved for each device.) [number]
devtype_description - Description of Device Type. [string]
Special Fields
--------------
selected - Set if item passes selection criteria. [number]
help - Show help. [unselectable number]
? - Show help. [unselectable number]
Unrecognised selection field: lv_name
Selection syntax error at 'lv_name=lvol0'.
Use 'help' for selection to get more help.
---
WHATS_NEW | 1 +
lib/report/report.c | 20 +++++++++++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7eac3a7..1bad12a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.155 -
================================
+ Fix lvm devtypes internal error if -S used with field name from pvs/vgs/lvs.
When reporting Data%,Snap%,Meta%,Cpy%Sync use single ioctl per LV.
Add lvseg_percent_with_info_and_seg_status() for percent retrieval.
Enhance internal seg_status handling to understand snapshots better.
diff --git a/lib/report/report.c b/lib/report/report.c
index 56c6f5b..8e08c75 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3689,7 +3689,9 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
int quoted, int columns_as_rows, const char *selection)
{
uint32_t report_flags = 0;
- int devtypes_report = *report_type & DEVTYPES ? 1 : 0;
+ const struct dm_report_object_type *types;
+ const struct dm_report_field_type *fields;
+ const struct dm_report_reserved_value *reserved_values;
void *rh;
if (aligned)
@@ -3710,11 +3712,19 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
if (columns_as_rows)
report_flags |= DM_REPORT_OUTPUT_COLUMNS_AS_ROWS;
- rh = dm_report_init_with_selection(report_type,
- devtypes_report ? _devtypes_report_types : _report_types,
- devtypes_report ? _devtypes_fields : _fields,
+ if (*report_type & DEVTYPES) {
+ types = _devtypes_report_types;
+ fields = _devtypes_fields;
+ reserved_values = NULL;
+ } else {
+ types = _report_types;
+ fields = _fields;
+ reserved_values = _report_reserved_values;
+ }
+
+ rh = dm_report_init_with_selection(report_type, types, fields,
format, separator, report_flags, keys,
- selection, _report_reserved_values, cmd);
+ selection, reserved_values, cmd);
if (rh && field_prefixes)
dm_report_set_output_field_name_prefix(rh, "lvm2_");
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7d4d0ff606a78909…
Commit: 7d4d0ff606a78909041c0b734a3ceacc94a47fa0
Parent: 88eeb004e9d34635221d45619723518a71ac2ccc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 27 17:24:18 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 17:25:52 2016 +0200
tests: check thin is not flushed for status
We finally approach a moment where we generally avoid
flushing thin-pool with every lvs command...
---
test/shell/thin-flags.sh | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/test/shell/thin-flags.sh b/test/shell/thin-flags.sh
index 966752a..3fcafb2 100644
--- a/test/shell/thin-flags.sh
+++ b/test/shell/thin-flags.sh
@@ -52,6 +52,10 @@ lvcreate -T -L1M --errorwhenfull y $vg/pool
lvcreate -V2 -n $lv2 $vg/pool
aux error_dev "$dev2" 2054:2
+# Check our 'lvs' is not flushing pool - should be still OK
+check lv_attr_bit health $vg/pool "-"
+# Enforce flush on thin pool device to notice error device.
+dmsetup status $vg-pool-tpool
check lv_attr_bit health $vg/pool "F"
check lv_attr_bit health $vg/$lv2 "F"
aux enable_dev "$dev2"