master - tests: try more advanced clean
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d7888e83169ac1...
Commit: d7888e83169ac1a7a962ffd66502995792879244
Parent: 066d0a4e1949afac055a7dc92bedd0f45f519124
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 24 11:12:55 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Apr 25 00:39:43 2015 +0200
tests: try more advanced clean
When test is executed on real device - lets try a more complete
cleanup - discard whole device first and try to wipe any
headers it might be left from previous test.
---
test/lib/aux.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 4e6961a..cc3718c 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -431,7 +431,8 @@ prepare_devs() {
# non-ephemeral devices need to be cleared between tests
test -f LOOP || for d in ${DEVICES[@]}; do
- dd if=/dev/zero of=$d bs=64K count=1
+ blkdiscard "$d" 2>/dev/null || true
+ wipefs -a "$d" 2>/dev/null || dd if=/dev/zero of="$d" bs=64K count=1
done
#for i in `seq 1 $n`; do
7 years, 11 months
master - cleanup: ancestors -> lv_ancestors, descendants -> lv_descendants
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=066d0a4e1949af...
Commit: 066d0a4e1949afac055a7dc92bedd0f45f519124
Parent: 6e4aee0492a6c3abbe6ecf24037d57bdd43c41fd
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Apr 24 14:19:23 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Apr 24 14:19:28 2015 +0200
cleanup: ancestors -> lv_ancestors, descendants -> lv_descendants
Use "lv_" prefix as they're LV fields.
---
lib/report/columns.h | 4 ++--
lib/report/properties.c | 8 ++++----
lib/report/report.c | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 8da8db1..cf84295 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -64,8 +64,8 @@ FIELD(LVS, lv, SIZ, "MSize", lvid, 6, lvmetadatasize, lv_metadata_size, "For thi
FIELD(LVS, lv, NUM, "#Seg", lvid, 4, lvsegcount, seg_count, "Number of segments in LV.", 0)
FIELD(LVS, lv, STR, "Origin", lvid, 6, origin, origin, "For snapshots, the origin device of this LV.", 0)
FIELD(LVS, lv, SIZ, "OSize", lvid, 5, originsize, origin_size, "For snapshots, the size of the origin device of this LV.", 0)
-FIELD(LVS, lv, STR_LIST, "Ancestors", lvid, 12, ancestors, ancestors, "Ancestors of this LV.", 0)
-FIELD(LVS, lv, STR_LIST, "Descendants", lvid, 12, descendants, descendants, "Descendants of this LV.", 0)
+FIELD(LVS, lv, STR_LIST, "Ancestors", lvid, 12, lvancestors, lv_ancestors, "Ancestors of this LV.", 0)
+FIELD(LVS, lv, STR_LIST, "Descendants", lvid, 12, lvdescendants, lv_descendants, "Descendants of this LV.", 0)
FIELD(LVS, lv, PCT, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0)
FIELD(LVS, lv, PCT, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0)
FIELD(LVS, lv, PCT, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 45ca0c7..ea70690 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -300,10 +300,10 @@ GET_LV_STR_PROPERTY_FN(origin, lv_origin_dup(lv->vg->vgmem, lv))
#define _origin_set prop_not_implemented_set
GET_LV_NUM_PROPERTY_FN(origin_size, (SECTOR_SIZE * lv_origin_size(lv)))
#define _origin_size_set prop_not_implemented_set
-#define _ancestors_set prop_not_implemented_set
-#define _ancestors_get prop_not_implemented_get
-#define _descendants_set prop_not_implemented_set
-#define _descendants_get prop_not_implemented_get
+#define _lv_ancestors_set prop_not_implemented_set
+#define _lv_ancestors_get prop_not_implemented_get
+#define _lv_descendants_set prop_not_implemented_set
+#define _lv_descendants_get prop_not_implemented_get
GET_LV_NUM_PROPERTY_FN(snap_percent, _snap_percent(lv))
#define _snap_percent_set prop_not_implemented_set
GET_LV_NUM_PROPERTY_FN(copy_percent, _copy_percent(lv))
diff --git a/lib/report/report.c b/lib/report/report.c
index 73beda3..500bf2b 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -659,7 +659,7 @@ static int _find_ancestors(struct _str_list_append_baton *ancestors,
return 1;
}
-static int _ancestors_disp(struct dm_report *rh, struct dm_pool *mem,
+static int _lvancestors_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
@@ -714,7 +714,7 @@ static int _find_descendants(struct _str_list_append_baton *descendants,
return 1;
}
-static int _descendants_disp(struct dm_report *rh, struct dm_pool *mem,
+static int _lvdescendants_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
7 years, 11 months
master - report: add lv_ancestors and lv_descendants reporting fields
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6e4aee0492a6c3...
Commit: 6e4aee0492a6c3abbe6ecf24037d57bdd43c41fd
Parent: 82f6dbfaf7b62c044cd765c207bd8eb1db0edc5a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Apr 24 11:51:52 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Apr 24 11:51:52 2015 +0200
report: add lv_ancestors and lv_descendants reporting fields
Show full chain of ancestors and descendants for snapshots
(both thick and thin - in case of thick, the "ancestor" field
is actually equal to "origin" field as snapshots can't be
chained for thick snapshots).
These fields display current state as it is, they do not
display any history! If the snapshot chain is broken in
the middle, we don't report the historical origin (this
is going to be a part of another patch and a different
set of fields or just a switch for existing fields to
show ancestors and descendants with history included).
For example:
(origin --> snapshot)
lvol1 --> lvol2 --> lvol3 --> lvol4
\
--> lvol5 --> lvol6 --> lvol7 --> lvol8
$ lvs -o name,pool_lv,origin,ancestors,descendants vg
LV Pool Origin Ancestors Descendants
lvol1 pool lvol2,lvol3,lvol4,lvol5,lvol6,lvol7,lvol8
lvol2 pool lvol1 lvol1 lvol3,lvol4,lvol5,lvol6,lvol7,lvol8
lvol3 pool lvol2 lvol2,lvol1 lvol4
lvol4 pool lvol3 lvol3,lvol2,lvol1
lvol5 pool lvol2 lvol2,lvol1 lvol6,lvol7,lvol8
lvol6 pool lvol5 lvol5,lvol2,lvol1 lvol7,lvol8
lvol7 pool lvol6 lvol6,lvol5,lvol2,lvol1 lvol8
lvol8 pool lvol7 lvol7,lvol6,lvol5,lvol2,lvol1
---
WHATS_NEW | 1 +
lib/report/columns.h | 2 +
lib/report/properties.c | 4 ++
lib/report/report.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 107 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 23c70eb..ca5ee0f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.119 -
==================================
+ Add lv_ancestors and lv_descendants reporting fields.
Add --ignorelocal option to dumpconfig to ignore the local section.
Close connection to lvmetad after fork.
Make lvchange able to resume background pvmove polling again.
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 6fde503..8da8db1 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -64,6 +64,8 @@ FIELD(LVS, lv, SIZ, "MSize", lvid, 6, lvmetadatasize, lv_metadata_size, "For thi
FIELD(LVS, lv, NUM, "#Seg", lvid, 4, lvsegcount, seg_count, "Number of segments in LV.", 0)
FIELD(LVS, lv, STR, "Origin", lvid, 6, origin, origin, "For snapshots, the origin device of this LV.", 0)
FIELD(LVS, lv, SIZ, "OSize", lvid, 5, originsize, origin_size, "For snapshots, the size of the origin device of this LV.", 0)
+FIELD(LVS, lv, STR_LIST, "Ancestors", lvid, 12, ancestors, ancestors, "Ancestors of this LV.", 0)
+FIELD(LVS, lv, STR_LIST, "Descendants", lvid, 12, descendants, descendants, "Descendants of this LV.", 0)
FIELD(LVS, lv, PCT, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0)
FIELD(LVS, lv, PCT, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0)
FIELD(LVS, lv, PCT, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 4c1f6f5..45ca0c7 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -300,6 +300,10 @@ GET_LV_STR_PROPERTY_FN(origin, lv_origin_dup(lv->vg->vgmem, lv))
#define _origin_set prop_not_implemented_set
GET_LV_NUM_PROPERTY_FN(origin_size, (SECTOR_SIZE * lv_origin_size(lv)))
#define _origin_size_set prop_not_implemented_set
+#define _ancestors_set prop_not_implemented_set
+#define _ancestors_get prop_not_implemented_get
+#define _descendants_set prop_not_implemented_set
+#define _descendants_get prop_not_implemented_get
GET_LV_NUM_PROPERTY_FN(snap_percent, _snap_percent(lv))
#define _snap_percent_set prop_not_implemented_set
GET_LV_NUM_PROPERTY_FN(copy_percent, _copy_percent(lv))
diff --git a/lib/report/report.c b/lib/report/report.c
index c29acdb..73beda3 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -633,6 +633,106 @@ static int _origin_disp(struct dm_report *rh, struct dm_pool *mem,
return _field_set_value(field, "", NULL);
}
+static int _find_ancestors(struct _str_list_append_baton *ancestors,
+ struct logical_volume *lv)
+{
+ struct logical_volume *ancestor_lv = NULL;
+ struct lv_segment *seg;
+
+ if (lv_is_cow(lv)) {
+ ancestor_lv = origin_from_cow(lv);
+ } else if (lv_is_thin_volume(lv)) {
+ seg = first_seg(lv);
+ if (seg->origin)
+ ancestor_lv = seg->origin;
+ else if (seg->external_lv)
+ ancestor_lv = seg->external_lv;
+ }
+
+ if (ancestor_lv) {
+ if (!_str_list_append(ancestor_lv->name, ancestors))
+ return_0;
+ if (!_find_ancestors(ancestors, ancestor_lv))
+ return_0;
+ }
+
+ return 1;
+}
+
+static int _ancestors_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ struct logical_volume *lv = (struct logical_volume *) data;
+ struct _str_list_append_baton ancestors;
+
+ ancestors.mem = mem;
+ if (!(ancestors.result = str_list_create(mem)))
+ return_0;
+
+ if (!_find_ancestors(&ancestors, lv)) {
+ dm_pool_free(ancestors.mem, ancestors.result);
+ return_0;
+ }
+
+ return _field_set_string_list(rh, field, ancestors.result, private, 0);
+}
+
+static int _find_descendants(struct _str_list_append_baton *descendants,
+ struct logical_volume *lv)
+{
+ struct logical_volume *descendant_lv = NULL;
+ const struct seg_list *sl;
+ struct lv_segment *seg;
+
+ if (lv_is_origin(lv)) {
+ dm_list_iterate_items_gen(seg, &lv->snapshot_segs, origin_list) {
+ if ((descendant_lv = seg->cow)) {
+ if (!_str_list_append(descendant_lv->name, descendants))
+ return_0;
+ if (!_find_descendants(descendants, descendant_lv))
+ return_0;
+ }
+ }
+ } else {
+ dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
+ if (lv_is_thin_volume(sl->seg->lv)) {
+ seg = first_seg(sl->seg->lv);
+ if ((seg->origin == lv) || (seg->external_lv == lv))
+ descendant_lv = sl->seg->lv;
+ }
+
+ if (descendant_lv) {
+ if (!_str_list_append(descendant_lv->name, descendants))
+ return_0;
+ if (!_find_descendants(descendants, descendant_lv))
+ return_0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+static int _descendants_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ struct logical_volume *lv = (struct logical_volume *) data;
+ struct _str_list_append_baton descendants;
+
+ descendants.mem = mem;
+ if (!(descendants.result = str_list_create(mem)))
+ return_0;
+
+ if (!_find_descendants(&descendants, lv)) {
+ dm_pool_free(descendants.mem, descendants.result);
+ return_0;
+ }
+
+ return _field_set_string_list(rh, field, descendants.result, private, 0);
+}
+
static int _movepv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
7 years, 11 months
master - select: fix matching reserved values while <, <=, >, >= is used in selection criteria
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=82f6dbfaf7b62c...
Commit: 82f6dbfaf7b62c044cd765c207bd8eb1db0edc5a
Parent: de0ce46361d65af7fb58699e4aba0b649551a6a8
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Apr 24 09:47:25 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Apr 24 09:48:57 2015 +0200
select: fix matching reserved values while <,<=,>,>= is used in selection criteria
Scenario:
$ vgs -o+vg_mda_copies
VG #PV #LV #SN Attr VSize VFree #VMdaCps
fedora 1 2 0 wz--n- 9.51g 0 unmanaged
vg 16 9 0 wz--n- 1.94g 1.83g 2
$ lvs -o+read_ahead vg/lvol6 vg/lvol7
LV VG Attr LSize Pool Origin Data% Rahead
lvol6 vg Vwi-a-tz-- 1.00g pool lvol5 0.00 auto
lvol7 vg Vwi---tz-k 1.00g pool lvol6 256.00k
Before this patch:
$vgs -o vg_name,vg_mda_copies -S 'vg_mda_copies < unmanaged'
VG #VMdaCps
vg 2
Problem:
Reserved values can be only used with exact match = or !=, not <,<=,>,>=.
In the example above, the "unamanaged" is internally represented as
18446744073709551615, but this should be ignored while not comparing
field directly with "unmanaged" reserved name with = or !=. Users
should not be aware of this internal mapping of the reserved value
name to its internal value and hence it doesn't make sense for such
reserved value to take place in results of <,<=,> and >=.
There's no order defined for reserved values!!! It's a special
*reserved* value that is taken out of the usual value range
of that type.
This is very similar to what we have already fixed with
2f7f6932dcd450ba75fe590aba8c09838d2618dc, but it's the other way round
now - we're using reserved value name in selection criteria now
(in the patch 2f7f693, we had concrete value and we compared it
with the reserved value). So this patch completes patch 2f7f693.
This patch also fixes this problem:
$ lvs -o+read_ahead vg/lvol6 vg/lvol7 -S 'read_ahead > 32k'
LV VG Attr LSize Pool Origin Data% Rahead
lvol6 vg Vwi-a-tz-- 1.00g pool lvol5 0.00 auto
lvol7 vg Vwi---tz-k 1.00g pool lvol6 256.00k
Problem:
In the example above, the internal reserved value "auto" is in the
range of selection "> 32k" - it shouldn't match as well. Here the
"auto" is internally represented as MAX_DBL and of course, numerically,
MAX_DBL > 256k. But for users, the reserved value should be uncomparable
to any number so the mapping of the reserved value name to its interna
value is transparent to users. Again, there's no order defined for
reserved values and hence it should never match if using <,<=,>,>=
operators.
This is actually exactly the same problem as already described in
2f7f6932dcd450ba75fe590aba8c09838d2618dc, but that patch failed for
size field types because of incorrect internal representation used.
With this patch applied, both problematic scenarios mentioned
above are fixed now:
$ vgs -o vg_name,vg_mda_copies -S 'vg_mda_copies < unmanaged'
(blank)
$ lvs -o+read_ahead vg/lvol6 vg/lvol7 -S 'read_ahead > 32k'
LV VG Attr LSize Pool Origin Rahead
lvol7 vg Vwi---tz-k 1.00g pool lvol6 256.00k
---
WHATS_NEW_DM | 2 +
lib/report/report.c | 18 ++++++---
lib/report/values.h | 2 +-
libdm/libdm-report.c | 103 +++++++++++++++++++++++++++++---------------------
4 files changed, 75 insertions(+), 50 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index cead126..dda91a2 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,7 @@
Version 1.02.96 -
=================================
+ Fix selection to not match if using reserved value in criteria with >,<,>=,<.
+ Fix selection to not match reserved values for size fields if using >,<,>=,<.
Include uuid or device number in log message after ioctl failure.
Add DM_INTERNAL_SUSPEND_FLAG to dm-ioctl.h.
Install blkdeactivate script and its man page with make install_device-mapper.
diff --git a/lib/report/report.c b/lib/report/report.c
index 86b0a54..c29acdb 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -26,6 +26,7 @@
#include "str_list.h"
#include <stddef.h> /* offsetof() */
+#include <float.h> /* DBL_MAX */
struct lvm_report_object {
struct volume_group *vg;
@@ -54,6 +55,7 @@ static const char _str_one[] = "1";
static const char _str_no[] = "no";
static const char _str_yes[] = "yes";
static const char _str_unknown[] = "unknown";
+static const double _siz_max = DBL_MAX;
/*
* 32 bit signed is casted to 64 bit unsigned in dm_report_field internally!
@@ -94,6 +96,7 @@ static const int32_t _reserved_num_undef_32 = INT32_C(-1);
* - 'reserved_value_id_n' (for 0)
*/
#define NUM uint64_t
+#define SIZ double
#define TYPE_RESERVED_VALUE(type, id, desc, value, ...) \
static const char *_reserved_ ## id ## _names[] = { __VA_ARGS__, NULL}; \
@@ -110,6 +113,7 @@ static const int32_t _reserved_num_undef_32 = INT32_C(-1);
#include "values.h"
#undef NUM
+#undef SIZ
#undef TYPE_RESERVED_VALUE
#undef FIELD_RESERVED_VALUE
#undef FIELD_RESERVED_BINARY_VALUE
@@ -122,6 +126,7 @@ static const int32_t _reserved_num_undef_32 = INT32_C(-1);
*/
#define NUM DM_REPORT_FIELD_TYPE_NUMBER
+#define SIZ DM_REPORT_FIELD_TYPE_SIZE
#define TYPE_RESERVED_VALUE(type, id, desc, value, ...) {type, &_reserved_ ## id, _reserved_ ## id ## _names, desc},
@@ -133,10 +138,11 @@ static const int32_t _reserved_num_undef_32 = INT32_C(-1);
static const struct dm_report_reserved_value _report_reserved_values[] = {
#include "values.h"
- {0, NULL, NULL}
+ {0, NULL, NULL, NULL}
};
#undef NUM
+#undef SIZ
#undef TYPE_RESERVED_VALUE
#undef FIELD_RESERVED_VALUE
#undef FIELD_RESERVED_BINARY_VALUE
@@ -659,7 +665,7 @@ static int _size32_disp(struct dm_report *rh __attribute__((unused)), struct dm_
{
const uint32_t size = *(const uint32_t *) data;
const char *disp, *repstr;
- uint64_t *sortval;
+ double *sortval;
if (!*(disp = display_size_units(private, (uint64_t) size)))
return_0;
@@ -674,7 +680,7 @@ static int _size32_disp(struct dm_report *rh __attribute__((unused)), struct dm_
return 0;
}
- *sortval = (uint64_t) size;
+ *sortval = (double) size;
return _field_set_value(field, repstr, sortval);
}
@@ -686,7 +692,7 @@ static int _size64_disp(struct dm_report *rh __attribute__((unused)),
{
const uint64_t size = *(const uint64_t *) data;
const char *disp, *repstr;
- uint64_t *sortval;
+ double *sortval;
if (!*(disp = display_size_units(private, size)))
return_0;
@@ -696,12 +702,12 @@ static int _size64_disp(struct dm_report *rh __attribute__((unused)),
return 0;
}
- if (!(sortval = dm_pool_alloc(mem, sizeof(uint64_t)))) {
+ if (!(sortval = dm_pool_alloc(mem, sizeof(double)))) {
log_error("dm_pool_alloc failed");
return 0;
}
- *sortval = size;
+ *sortval = (double) size;
return _field_set_value(field, repstr, sortval);
}
diff --git a/lib/report/values.h b/lib/report/values.h
index bc42563..dd20caf 100644
--- a/lib/report/values.h
+++ b/lib/report/values.h
@@ -83,7 +83,7 @@ FIELD_RESERVED_BINARY_VALUE(zero, zero, "", "zero")
FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_rw, "", "writeable", "writeable", "rw", "read-write")
FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r, "", "read-only", "read-only", "r", "ro")
FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r_override, "", "read-only-override", "read-only-override", "ro-override", "r-override", "R")
-FIELD_RESERVED_VALUE(lv_read_ahead, lv_read_ahead_auto, "", &GET_TYPE_RESERVED_VALUE(num_undef_64), "auto")
+FIELD_RESERVED_VALUE(lv_read_ahead, lv_read_ahead_auto, "", &_siz_max, "auto")
FIELD_RESERVED_VALUE(lv_when_full, lv_when_full_error, "", "error", "error", "error when full", "error if no space")
FIELD_RESERVED_VALUE(lv_when_full, lv_when_full_queue, "", "queue", "queue", "queue when full", "queue if no space")
FIELD_RESERVED_VALUE(lv_when_full, lv_when_full_undef, "", "", "", "undefined")
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 9f50ff3..2fe9300 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -1262,43 +1262,59 @@ static int _close_enough(double d1, double d2)
return fabs(d1 - d2) < DBL_EPSILON;
}
+static int _do_check_value_is_reserved(unsigned type, const void *reserved_value,
+ const void *value1, const void *value2)
+{
+ switch (type) {
+ case DM_REPORT_FIELD_TYPE_NUMBER:
+ if ((*(uint64_t *)value1 == *(uint64_t *) reserved_value) ||
+ (value2 && (*(uint64_t *)value2 == *(uint64_t *) reserved_value)))
+ return 1;
+ break;
+ case DM_REPORT_FIELD_TYPE_STRING:
+ if ((!strcmp((const char *)value1, (const char *) reserved_value)) ||
+ (value2 && (!strcmp((const char *)value2, (const char *) reserved_value))))
+ return 1;
+ break;
+ case DM_REPORT_FIELD_TYPE_SIZE:
+ if ((_close_enough(*(double *)value1, *(double *) reserved_value)) ||
+ (value2 && (_close_enough(*(double *)value2, *(double *) reserved_value))))
+ return 1;
+ break;
+ case DM_REPORT_FIELD_TYPE_STRING_LIST:
+ /* FIXME Add comparison for string list */
+ break;
+ }
+
+ return 0;
+}
+
/*
* Used to check whether a value of certain type used in selection is reserved.
*/
-static int _check_value_is_reserved(struct dm_report *rh, unsigned type, const void *value)
+static int _check_value_is_reserved(struct dm_report *rh, uint32_t field_num, unsigned type,
+ const void *value1, const void *value2)
{
const struct dm_report_reserved_value *iter = rh->reserved_values;
+ const struct dm_report_field_reserved_value *frv;
if (!iter)
return 0;
- while (iter->type) {
- if (iter->type & type) {
- switch (type) {
- case DM_REPORT_FIELD_TYPE_NUMBER:
- if (*(uint64_t *)iter->value == *(uint64_t *)value)
- return 1;
- break;
- case DM_REPORT_FIELD_TYPE_STRING:
- if (!strcmp((const char *)iter->value, (const char *) value))
- return 1;
- break;
- case DM_REPORT_FIELD_TYPE_SIZE:
- if (_close_enough(*(double *)iter->value, *(double *) value))
- return 1;
- break;
- case DM_REPORT_FIELD_TYPE_STRING_LIST:
- /* FIXME Add comparison for string list */
- break;
- }
- }
+ while (iter->value) {
+ if (iter->type == DM_REPORT_FIELD_TYPE_NONE) {
+ frv = (const struct dm_report_field_reserved_value *) iter->value;
+ if (frv->field_num == field_num && _do_check_value_is_reserved(type, frv->value, value1, value2))
+ return 1;
+ } else if (iter->type & type && _do_check_value_is_reserved(type, iter->value, value1, value2))
+ return 1;
iter++;
}
return 0;
}
-static int _cmp_field_int(struct dm_report *rh, const char *field_id,
+static int _cmp_field_int(struct dm_report *rh, uint32_t field_num, const char *field_id,
uint64_t a, uint64_t b, uint32_t flags)
{
switch(flags & FLD_CMP_MASK) {
@@ -1307,13 +1323,13 @@ static int _cmp_field_int(struct dm_report *rh, const char *field_id,
case FLD_CMP_NOT|FLD_CMP_EQUAL:
return a != b;
case FLD_CMP_NUMBER|FLD_CMP_GT:
- return _check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_NUMBER, &a) ? 0 : a > b;
+ return _check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_NUMBER, &a, &b) ? 0 : a > b;
case FLD_CMP_NUMBER|FLD_CMP_GT|FLD_CMP_EQUAL:
- return _check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_NUMBER, &a) ? 0 : a >= b;
+ return _check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_NUMBER, &a, &b) ? 0 : a >= b;
case FLD_CMP_NUMBER|FLD_CMP_LT:
- return _check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_NUMBER, &a) ? 0 : a < b;
+ return _check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_NUMBER, &a, &b) ? 0 : a < b;
case FLD_CMP_NUMBER|FLD_CMP_LT|FLD_CMP_EQUAL:
- return _check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_NUMBER, &a) ? 0 : a <= b;
+ return _check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_NUMBER, &a, &b) ? 0 : a <= b;
default:
log_error(INTERNAL_ERROR "_cmp_field_int: unsupported number "
"comparison type for field %s", field_id);
@@ -1322,7 +1338,7 @@ static int _cmp_field_int(struct dm_report *rh, const char *field_id,
return 0;
}
-static int _cmp_field_double(struct dm_report *rh, const char *field_id,
+static int _cmp_field_double(struct dm_report *rh, uint32_t field_num, const char *field_id,
double a, double b, uint32_t flags)
{
switch(flags & FLD_CMP_MASK) {
@@ -1331,13 +1347,13 @@ static int _cmp_field_double(struct dm_report *rh, const char *field_id,
case FLD_CMP_NOT|FLD_CMP_EQUAL:
return !_close_enough(a, b);
case FLD_CMP_NUMBER|FLD_CMP_GT:
- return _check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_SIZE, &a) ? 0 : (a > b) && !_close_enough(a, b);
+ return _check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_SIZE, &a, &b) ? 0 : (a > b) && !_close_enough(a, b);
case FLD_CMP_NUMBER|FLD_CMP_GT|FLD_CMP_EQUAL:
- return _check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_SIZE, &a) ? 0 : (a > b) || _close_enough(a, b);
+ return _check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_SIZE, &a, &b) ? 0 : (a > b) || _close_enough(a, b);
case FLD_CMP_NUMBER|FLD_CMP_LT:
- return _check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_SIZE, &a) ? 0 : (a < b) && !_close_enough(a, b);
+ return _check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_SIZE, &a, &b) ? 0 : (a < b) && !_close_enough(a, b);
case FLD_CMP_NUMBER|FLD_CMP_LT|FLD_CMP_EQUAL:
- return _check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_SIZE, &a) ? 0 : a < b || _close_enough(a, b);
+ return _check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_SIZE, &a, &b) ? 0 : a < b || _close_enough(a, b);
default:
log_error(INTERNAL_ERROR "_cmp_field_double: unsupported number "
"comparison type for selection field %s", field_id);
@@ -1346,7 +1362,8 @@ static int _cmp_field_double(struct dm_report *rh, const char *field_id,
return 0;
}
-static int _cmp_field_string(struct dm_report *rh __attribute__((unused)), const char *field_id,
+static int _cmp_field_string(struct dm_report *rh __attribute__((unused)),
+ uint32_t field_num, const char *field_id,
const char *a, const char *b, uint32_t flags)
{
switch (flags & FLD_CMP_MASK) {
@@ -1440,7 +1457,7 @@ static int _cmp_field_string_list_any(const struct str_list_sort_value *val,
}
static int _cmp_field_string_list(struct dm_report *rh __attribute__((unused)),
- const char *field_id,
+ uint32_t field_num, const char *field_id,
const struct str_list_sort_value *value,
const struct selection_str_list *selection, uint32_t flags)
{
@@ -1510,16 +1527,16 @@ static int _compare_selection_field(struct dm_report *rh,
return 0;
/* fall through */
case DM_REPORT_FIELD_TYPE_NUMBER:
- r = _cmp_field_int(rh, field_id, *(const uint64_t *) f->sort_value, fs->v.i, fs->flags);
+ r = _cmp_field_int(rh, f->props->field_num, field_id, *(const uint64_t *) f->sort_value, fs->v.i, fs->flags);
break;
case DM_REPORT_FIELD_TYPE_SIZE:
- r = _cmp_field_double(rh, field_id, *(const uint64_t *) f->sort_value, fs->v.d, fs->flags);
+ r = _cmp_field_double(rh, f->props->field_num, field_id, *(double *) f->sort_value, fs->v.d, fs->flags);
break;
case DM_REPORT_FIELD_TYPE_STRING:
- r = _cmp_field_string(rh, field_id, (const char *) f->sort_value, fs->v.s, fs->flags);
+ r = _cmp_field_string(rh, f->props->field_num, field_id, (const char *) f->sort_value, fs->v.s, fs->flags);
break;
case DM_REPORT_FIELD_TYPE_STRING_LIST:
- r = _cmp_field_string_list(rh, field_id, (const struct str_list_sort_value *) f->sort_value,
+ r = _cmp_field_string_list(rh, f->props->field_num, field_id, (const struct str_list_sort_value *) f->sort_value,
fs->v.l, fs->flags);
break;
default:
@@ -2500,7 +2517,7 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
dm_pool_free(rh->selection->mem, s);
} else {
fs->v.s = s;
- if (_check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_STRING, fs->v.s)) {
+ if (_check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_STRING, fs->v.s, NULL)) {
log_error("String value %s found in selection is reserved.", fs->v.s);
goto error;
}
@@ -2515,7 +2532,7 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
log_error(_out_of_range_msg, s, field_id);
goto error;
}
- if (_check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_NUMBER, &fs->v.i)) {
+ if (_check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_NUMBER, &fs->v.i, NULL)) {
log_error("Numeric value %" PRIu64 " found in selection is reserved.", fs->v.i);
goto error;
}
@@ -2524,7 +2541,7 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
break;
case DM_REPORT_FIELD_TYPE_SIZE:
if (reserved)
- fs->v.d = (double) * (uint64_t *) _get_reserved_value(reserved);
+ fs->v.d = *(double *) _get_reserved_value(reserved);
else {
fs->v.d = strtod(s, NULL);
if (errno == ERANGE) {
@@ -2534,7 +2551,7 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
if (custom && (factor = *((uint64_t *)custom)))
fs->v.d *= factor;
fs->v.d /= 512; /* store size in sectors! */
- if (_check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_SIZE, &fs->v.d)) {
+ if (_check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_SIZE, &fs->v.d, NULL)) {
log_error("Size value %f found in selection is reserved.", fs->v.d);
goto error;
}
@@ -2553,7 +2570,7 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
fs->v.i = (dm_percent_t) (DM_PERCENT_1 * fs->v.d);
- if (_check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_PERCENT, &fs->v.i)) {
+ if (_check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_PERCENT, &fs->v.i, NULL)) {
log_error("Percent value %s found in selection is reserved.", s);
goto error;
}
@@ -2561,7 +2578,7 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
break;
case DM_REPORT_FIELD_TYPE_STRING_LIST:
fs->v.l = *(struct selection_str_list **)custom;
- if (_check_value_is_reserved(rh, DM_REPORT_FIELD_TYPE_STRING_LIST, fs->v.l)) {
+ if (_check_value_is_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_STRING_LIST, fs->v.l, NULL)) {
log_error("String list value found in selection is reserved.");
goto error;
}
7 years, 11 months
master - tests: fix md raid test on real /dev
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=de0ce46361d65a...
Commit: de0ce46361d65af7fb58699e4aba0b649551a6a8
Parent: 88534625282e8d533ae439ed308a285da10e3ef0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 23 20:26:19 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 23 20:28:44 2015 +0200
tests: fix md raid test on real /dev
Zero raid signatures when raid is stopped - so signatures
are not requiring wipe when pvcreate follows.
Handle real /dev
---
test/shell/lvmetad-pvscan-md.sh | 20 +++++++++++++-------
test/shell/pvcreate-operation-md.sh | 16 +++++++++-------
2 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/test/shell/lvmetad-pvscan-md.sh b/test/shell/lvmetad-pvscan-md.sh
index 653d18a..ff86fdd 100644
--- a/test/shell/lvmetad-pvscan-md.sh
+++ b/test/shell/lvmetad-pvscan-md.sh
@@ -38,6 +38,8 @@ cleanup_md() {
# see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25
aux udev_wait
mdadm --stop "$mddev" || true
+ # also remove singnatures
+ mdadm --zero-superblock "$dev1" "$dev2" || true
aux udev_wait
if [ -b "$mddev" ]; then
# mdadm doesn't always cleanup the device node
@@ -53,25 +55,29 @@ cleanup_md_and_teardown() {
# create 2 disk MD raid0 array (stripe_width=128K)
test -b "$mddev" && skip
-mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2"
trap 'cleanup_md_and_teardown' EXIT # cleanup this MD device at the end of the test
+mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2"
test -b "$mddev" || skip
-cp -LR "$mddev" "$DM_DEV_DIR" # so that LVM/DM can see the device
-lvmdev="$DM_DEV_DIR/md_lvm_test0"
-
+if test "$DM_DEV_DIR" != "/dev" ; then
+ cp -LR "$mddev" "$DM_DEV_DIR" # so that LVM/DM can see the device
+ pvdev="$DM_DEV_DIR/md_lvm_test0"
+else
+ pvdev=$(readlink -f "$mddev")
+fi
# TODO end MD-creation code
# maj=$(($(stat -L --printf=0x%t "$dev2")))
# min=$(($(stat -L --printf=0x%T "$dev2")))
-pvcreate $lvmdev
+pvcreate "$pvdev"
-pvscan --cache "$lvmdev"
+pvscan --cache "$pvdev"
# ensure that lvmetad can only see the toplevel MD device
pvscan --cache "$dev1" 2>&1 | grep "not found"
pvscan --cache "$dev2" 2>&1 | grep "not found"
-pvs | grep $lvmdev
+pvs | tee out
+grep "$pvdev" out
pvs | not grep "$dev1"
pvs | not grep "$dev2"
diff --git a/test/shell/pvcreate-operation-md.sh b/test/shell/pvcreate-operation-md.sh
index 87117d1..ec15c5d 100644
--- a/test/shell/pvcreate-operation-md.sh
+++ b/test/shell/pvcreate-operation-md.sh
@@ -40,6 +40,7 @@ cleanup_md() {
# see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25
aux udev_wait
mdadm --stop "$mddev" || true
+ mdadm --zero-superblock "$dev1" "$dev2" || true
aux udev_wait
if [ -b "$mddev" ]; then
# mdadm doesn't always cleanup the device node
@@ -55,10 +56,10 @@ cleanup_md_and_teardown() {
# create 2 disk MD raid0 array (stripe_width=128K)
test -b "$mddev" && skip
-mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2"
trap 'cleanup_md_and_teardown' EXIT # cleanup this MD device at the end of the test
+mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2"
test -b "$mddev" || skip
-cp -LR "$mddev" "$DM_DEV_DIR" # so that LVM/DM can see the device
+test "$DM_DEV_DIR" != "/dev" && cp -LR "$mddev" "$DM_DEV_DIR" # so that LVM/DM can see the device
lvmdev="$DM_DEV_DIR/md_lvm_test0"
# Test alignment of PV on MD without any MD-aware or topology-aware detection
@@ -113,7 +114,7 @@ EOF
# wait here for created device node on tmpfs
aux udev_wait "$mddev_p"
test -b "$mddev_p" || skip
- cp -LR "$mddev_p" "$DM_DEV_DIR"
+ test "$DM_DEV_DIR" != "/dev" && cp -LR "$mddev_p" "$DM_DEV_DIR"
lvmdev_p="$DM_DEV_DIR/$base_mddev_p"
# Checking for 'alignment_offset' in sysfs implies Linux >= 2.6.31
@@ -132,13 +133,14 @@ EOF
fi
fi
-# make sure we're clean for another test
-test -b "$mddev" && cleanup_md
-dd if=/dev/zero of="$dev1" bs=512 count=1
-dd if=/dev/zero of="$dev2" bs=512 count=1
# Test newer topology-aware alignment detection w/ --dataalignment override
if kernel_at_least 2 6 33 ; then
+ # make sure we're clean for another test
+ test -b "$mddev" && cleanup_md
+ dd if=/dev/zero of="$dev1" bs=512 count=1
+ dd if=/dev/zero of="$dev2" bs=512 count=1
+
pvcreate -f "$dev1"
pvcreate -f "$dev2"
7 years, 11 months
master - libdm: Add uuid/devno to ioctl failure log message.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=88534625282e8d...
Commit: 88534625282e8d533ae439ed308a285da10e3ef0
Parent: 19066191877029a1fe376a7d4a657e0dba1dd13d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Apr 23 19:26:52 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Apr 23 19:26:52 2015 +0100
libdm: Add uuid/devno to ioctl failure log message.
---
WHATS_NEW_DM | 1 +
libdm/ioctl/libdm-iface.c | 20 +++++++++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index c6a1619..cead126 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.96 -
=================================
+ Include uuid or device number in log message after ioctl failure.
Add DM_INTERNAL_SUSPEND_FLAG to dm-ioctl.h.
Install blkdeactivate script and its man page with make install_device-mapper.
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index f971519..1f301f9 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -1802,15 +1802,29 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */
else {
if (_log_suppress || errno == EINTR)
- log_verbose("device-mapper: %s ioctl "
+ log_verbose("device-mapper: %s ioctl on %s%s%s%.0d%s%.0d%s%s "
"failed: %s",
_cmd_data_v4[dmt->type].name,
+ dmi->name, dmi->uuid,
+ dmt->major > 0 ? "(" : "",
+ dmt->major > 0 ? dmt->major : 0,
+ dmt->major > 0 ? ":" : "",
+ dmt->minor > 0 ? dmt->minor : 0,
+ dmt->major > 0 && dmt->minor == 0 ? "0" : "",
+ dmt->major > 0 ? ")" : "",
strerror(errno));
else
- log_error("device-mapper: %s ioctl on %s "
+ log_error("device-mapper: %s ioctl on %s%s%s%.0d%s%.0d%s%s "
"failed: %s",
_cmd_data_v4[dmt->type].name,
- dmi->name, strerror(errno));
+ dmi->name, dmi->uuid,
+ dmt->major > 0 ? "(" : "",
+ dmt->major > 0 ? dmt->major : 0,
+ dmt->major > 0 ? ":" : "",
+ dmt->minor > 0 ? dmt->minor : 0,
+ dmt->major > 0 && dmt->minor == 0 ? "0" : "",
+ dmt->major > 0 ? ")" : "",
+ strerror(errno));
/*
* It's sometimes worth retrying after EBUSY in case
7 years, 11 months
master - libdm: Add DM_INTERNAL_SUSPEND_FLAG.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=19066191877029...
Commit: 19066191877029a1fe376a7d4a657e0dba1dd13d
Parent: 95da21cc18d87ba7ae921b54abe5f622d12abb31
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Apr 23 18:39:04 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Apr 23 18:39:04 2015 +0100
libdm: Add DM_INTERNAL_SUSPEND_FLAG.
Still needs to be reported by dmsetup.
---
WHATS_NEW_DM | 1 +
libdm/misc/dm-ioctl.h | 11 ++++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 5d168f1..c6a1619 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.96 -
=================================
+ Add DM_INTERNAL_SUSPEND_FLAG to dm-ioctl.h.
Install blkdeactivate script and its man page with make install_device-mapper.
Version 1.02.95 - 15th March 2015
diff --git a/libdm/misc/dm-ioctl.h b/libdm/misc/dm-ioctl.h
index 01a2b9e..cdb0c4c 100644
--- a/libdm/misc/dm-ioctl.h
+++ b/libdm/misc/dm-ioctl.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.
- * Copyright (C) 2004 - 2014 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004 - 2015 Red Hat, Inc. All rights reserved.
*
* This file is released under the LGPL.
*/
@@ -269,9 +269,9 @@ enum {
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
#define DM_VERSION_MAJOR 4
-#define DM_VERSION_MINOR 27
+#define DM_VERSION_MINOR 31
#define DM_VERSION_PATCHLEVEL 0
-#define DM_VERSION_EXTRA "-ioctl (2013-10-30)"
+#define DM_VERSION_EXTRA "-ioctl (2015-03-12)"
/* Status bits */
#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -354,4 +354,9 @@ enum {
*/
#define DM_DEFERRED_REMOVE (1 << 17) /* In/Out */
+/*
+ * If set, the device is suspended internally.
+ */
+#define DM_INTERNAL_SUSPEND_FLAG (1 << 18) /* Out */
+
#endif /* _LINUX_DM_IOCTL_H */
7 years, 11 months
master - config: fix check_options array
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=95da21cc18d87b...
Commit: 95da21cc18d87ba7ae921b54abe5f622d12abb31
Parent: a8bdfbe959a641da21d3baf27046deb8d2eaddb2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 23 10:35:34 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 23 10:35:34 2015 -0500
config: fix check_options array
The code used it as both a single string, and as
an array of strings in different places. Fix it
so that it's an array of strings everywhere.
---
lib/activate/dev_manager.c | 4 ++--
lib/config/config_settings.h | 4 ++--
lib/config/defaults.h | 8 +++++---
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index dcb2c5d..1171f4c 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1965,14 +1965,14 @@ static int _pool_register_callback(struct dev_manager *dm,
data->skip_zero = 1;
data->exec = global_thin_check_executable_CFG;
data->opts = global_thin_check_options_CFG;
- data->defaults = DEFAULT_THIN_CHECK_OPTIONS;
+ data->defaults = DEFAULT_THIN_CHECK_OPTION1 " " DEFAULT_THIN_CHECK_OPTION2;
data->global = "thin";
} else if (lv_is_cache(lv)) { /* cache pool */
data->pool_lv = first_seg(lv)->pool_lv;
data->skip_zero = dm->activation;
data->exec = global_cache_check_executable_CFG;
data->opts = global_cache_check_options_CFG;
- data->defaults = DEFAULT_CACHE_CHECK_OPTIONS;
+ data->defaults = DEFAULT_CACHE_CHECK_OPTION1;
data->global = "cache";
} else {
log_error(INTERNAL_ERROR "Registering unsupported pool callback.");
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 6db9cda..742fa19 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -812,7 +812,7 @@ cfg(global_thin_repair_executable_CFG, "thin_repair_executable", global_CFG_SECT
"Also see thin_repair_options.\n"
"(For thin tools, see thin_check_executable.)\n")
-cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_THIN_CHECK_OPTIONS, vsn(2, 2, 96), NULL,
+cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_THIN_CHECK_OPTION1 "#S" DEFAULT_THIN_CHECK_OPTION2, vsn(2, 2, 96), NULL,
"String of options passed to the thin_check command.\n"
"With thin_check version 2.1 or newer you can add\n"
"--ignore-non-fatal-errors to let it pass through\n"
@@ -857,7 +857,7 @@ cfg(global_cache_repair_executable_CFG, "cache_repair_executable", global_CFG_SE
"Also see cache_repair_options.\n"
"(For cache tools, see cache_check_executable.)\n")
-cfg_array(global_cache_check_options_CFG, "cache_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_CHECK_OPTIONS, vsn(2, 2, 108), NULL,
+cfg_array(global_cache_check_options_CFG, "cache_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_CHECK_OPTION1, vsn(2, 2, 108), NULL,
"String of options passed to the cache_check command.\n")
cfg_array(global_cache_repair_options_CFG, "cache_repair_options", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_REPAIR_OPTIONS, vsn(2, 2, 108), NULL,
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 8339c1a..b745662 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -76,9 +76,11 @@
#endif
#ifdef THIN_CHECK_NEEDS_CHECK
-# define DEFAULT_THIN_CHECK_OPTIONS "-q --clear-needs-check-flag"
+# define DEFAULT_THIN_CHECK_OPTION1 "-q"
+# define DEFAULT_THIN_CHECK_OPTION2 "--clear-needs-check-flag"
#else
-# define DEFAULT_THIN_CHECK_OPTIONS "-q"
+# define DEFAULT_THIN_CHECK_OPTION1 "-q"
+# define DEFAULT_THIN_CHECK_OPTION2 ""
#endif
#define DEFAULT_THIN_REPAIR_OPTIONS ""
@@ -93,7 +95,7 @@
#define DEFAULT_THIN_POOL_ZERO 1
#define DEFAULT_POOL_METADATA_SPARE 1 /* thin + cache */
-#define DEFAULT_CACHE_CHECK_OPTIONS "-q"
+#define DEFAULT_CACHE_CHECK_OPTION1 "-q"
#define DEFAULT_CACHE_REPAIR_OPTIONS ""
#define DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
#define DEFAULT_CACHE_POOL_CHUNK_SIZE 64 /* KB */
7 years, 11 months
master - config: thin_disabled_features default should be undefined
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a8bdfbe959a641...
Commit: a8bdfbe959a641da21d3baf27046deb8d2eaddb2
Parent: 3fc9615d156892efd8bb28b0306c2fe9c14738ff
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 23 10:19:00 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 23 10:19:00 2015 -0500
config: thin_disabled_features default should be undefined
An array that's empty by default should be flagged as
undefined.
---
lib/config/config_settings.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 1a0ebf7..6db9cda 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -823,7 +823,7 @@ cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTIO
cfg_array(global_thin_repair_options_CFG, "thin_repair_options", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, "#S" DEFAULT_THIN_REPAIR_OPTIONS, vsn(2, 2, 100), NULL,
"String of options passed to the thin_repair command.\n")
-cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(2, 2, 99), NULL,
+cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED | CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(2, 2, 99), NULL,
"Features to not use in the thin driver.\n"
"This can be helpful for testing, or to avoid\n"
"using a feature that is causing problems.\n"
7 years, 11 months
master - Improve duplicate PV handling
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3fc9615d156892...
Commit: 3fc9615d156892efd8bb28b0306c2fe9c14738ff
Parent: 92607ecfe62c2590c7816d53c709d3b96faa2357
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Apr 20 14:13:50 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Apr 22 13:22:14 2015 -0500
Improve duplicate PV handling
Make the processing of duplicate PVs the
same with and without lvmetad.
---
lib/cache/lvmcache.c | 9 ++++++---
lib/cache/lvmetad.c | 28 ++++++++++++++--------------
2 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 6f8c950..c5f78c8 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1610,10 +1610,13 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
//dm_is_dm_major(MAJOR(dev->dev)))
//
else if (!strcmp(pvid_s, existing->dev->pvid)) {
- log_error("Found duplicate PV %s: using %s not "
- "%s", pvid, dev_name(dev),
- dev_name(existing->dev));
+ log_error("Found duplicate PV %s: using %s not %s",
+ pvid_s,
+ dev_name(existing->dev),
+ dev_name(dev));
+ strncpy(dev->pvid, pvid_s, sizeof(dev->pvid));
_found_duplicate_pvs = 1;
+ return NULL;
}
}
if (strcmp(pvid_s, existing->dev->pvid))
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 5de571d..600a6cb 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -299,20 +299,6 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
if (!dev && fallback)
dev = dev_cache_get_by_devt(fallback, cmd->filter);
- if (alt_devices)
- alt_device = alt_devices->v;
-
- while (alt_device) {
- dev_alternate = dev_cache_get_by_devt(alt_device->v.i, cmd->filter);
- if (dev_alternate)
- log_warn("Found duplicate of PV %s on device %s.",
- pvid_txt, dev_name(dev_alternate));
- else
- log_warn("Duplicate of PV %s exists on unknown device %"PRId64 ":%" PRId64,
- pvid_txt, MAJOR(alt_device->v.i), MINOR(alt_device->v.i));
- alt_device = alt_device->next;
- }
-
if (!dev) {
log_warn("WARNING: Device for PV %s not found or rejected by a filter.", pvid_txt);
return NULL;
@@ -375,6 +361,20 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
++i;
} while (da);
+ if (alt_devices)
+ alt_device = alt_devices->v;
+
+ while (alt_device) {
+ dev_alternate = dev_cache_get_by_devt(alt_device->v.i, cmd->filter);
+ if (dev_alternate)
+ lvmcache_add(fmt->labeller, (const char *)&pvid, dev_alternate,
+ vgname, (const char *)&vgid, 0);
+ else
+ log_warn("Duplicate of PV %s dev %s exists on unknown device %"PRId64 ":%" PRId64,
+ pvid_txt, dev_name(dev), MAJOR(alt_device->v.i), MINOR(alt_device->v.i));
+ alt_device = alt_device->next;
+ }
+
return info;
}
7 years, 11 months