Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eadcea2dae8c56e9…
Commit: eadcea2dae8c56e96b694cb388999865d2678e22
Parent: b6fe906956cb7bdaa9b3ef43c14f8e6155483d7e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 30 11:01:04 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 30 12:15:13 2014 +0200
thin: repaired LV uses _meta%d
Don't leave 'regular' LV with reserved suffix for a user.
After succefull repair use 'normal' (non-reserved) LV name
for backup of original metadata.
---
WHATS_NEW | 1 +
man/lvconvert.8.in | 2 +-
tools/lvconvert.c | 8 ++++----
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 396dd07..b8b2951 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ Leave backup pool metadata with _meta%d suffix instead of reserved _tmeta%d.
Allow RAID repair to reuse PVs from same image that suffered a failure.
New RAID images now avoid allocation on any PVs in the same parent RAID LV.
Always reevaluate filters just before creating PV.
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index 76003b4..f96cee2 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -380,7 +380,7 @@ Only inactive thin pool volumes can be repaired.
There is no validation of metadata between kernel and lvm2.
This requires further manual work.
After successfull repair the old unmodified metadata are still
-available in \fB<pool>_tmeta<n>\fP LV.
+available in \fB<pool>_meta<n>\fP LV.
.TP
.B \-\-replace \fIPhysicalVolume
Remove the specified device (\fIPhysicalVolume\fP) and replace it with one
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index a2e02d4..9f2d114 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2468,8 +2468,8 @@ deactivate_pmslv:
if (!handle_pool_metadata_spare(pool_lv->vg, 0, NULL, 1))
stack;
- if (dm_snprintf(meta_path, sizeof(meta_path), "%s%%d", mlv->name) < 0) {
- log_error("Can't prepare new name for %s.", mlv->name);
+ if (dm_snprintf(meta_path, sizeof(meta_path), "%s_meta%%d", pool_lv->name) < 0) {
+ log_error("Can't prepare new metadata name for %s.", pool_lv->name);
return 0;
}
@@ -2488,7 +2488,7 @@ deactivate_pmslv:
if (!attach_pool_metadata_lv(first_seg(pool_lv), pmslv))
return_0;
- /* Used _tmeta will become visible _tmeta%d */
+ /* Used _tmeta will become visible _meta%d */
if (!lv_rename_update(cmd, mlv, pms_path, 0))
return_0;
@@ -2499,7 +2499,7 @@ deactivate_pmslv:
mlv->vg->name, mlv->name);
log_warn("WARNING: Use pvmove command to move \"%s/%s\" on the best fitting PV.",
- mlv->vg->name, first_seg(pool_lv)->metadata_lv->name);
+ pool_lv->vg->name, first_seg(pool_lv)->metadata_lv->name);
return 1;
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b41aa985d7f93ba9…
Commit: b41aa985d7f93ba9e2db6fab032e0cf3d7180cf8
Parent: ed3c2537b82be4e326a53c7e3e6d5eccdd833800
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 26 15:14:54 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 26 15:15:10 2014 +0200
man: do not mention '(i)nherited' for alloc policy in vg_attr field
VG has nothing to inherit from...
---
man/vgs.8.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/man/vgs.8.in b/man/vgs.8.in
index 2d4946f..de0ef9b 100644
--- a/man/vgs.8.in
+++ b/man/vgs.8.in
@@ -85,7 +85,7 @@ E(x)ported
(p)artial: one or more physical volumes belonging to the volume group
are missing from the system
.IP 5 3
-Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited
+Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere
.IP 6 3
(c)lustered
.RE
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ed3c2537b82be4e3…
Commit: ed3c2537b82be4e326a53c7e3e6d5eccdd833800
Parent: 7028fd31a0f2d2234ffdd1b94ea6ae6128ca9362
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Jun 25 22:26:06 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Jun 25 22:26:06 2014 -0500
raid: Allow repair to reuse PVs from same image that suffered a PV failure
When repairing RAID LVs that have multiple PVs per image, allow
replacement images to be reallocated from the PVs that have not
failed in the image if there is sufficient space.
This allows for scenarios where a 2-way RAID1 is spread across 4 PVs,
where each image lives on two PVs but doesn't use the entire space
on any of them. If one PV fails and there is sufficient space on the
remaining PV in the image, the image can be reallocated on just the
remaining PV.
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 127 ++++++++++++++++++++++++++++---
test/shell/lvconvert-raid-allocation.sh | 20 ++++-
3 files changed, 133 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 05b3c7c..396dd07 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ Allow RAID repair to reuse PVs from same image that suffered a failure.
New RAID images now avoid allocation on any PVs in the same parent RAID LV.
Always reevaluate filters just before creating PV.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 0303654..6fead9a 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1501,6 +1501,85 @@ int lv_raid_reshape(struct logical_volume *lv,
return 0;
}
+
+static int _remove_partial_multi_segment_image(struct logical_volume *lv,
+ struct dm_list *remove_pvs)
+{
+ uint32_t s, extents_needed;
+ struct lv_segment *rm_seg, *raid_seg = first_seg(lv);
+ struct logical_volume *rm_image = NULL;
+ struct physical_volume *pv;
+
+ if (!(lv->status & PARTIAL_LV))
+ return_0;
+
+ for (s = 0; s < raid_seg->area_count; s++) {
+ extents_needed = 0;
+ if ((seg_lv(raid_seg, s)->status & PARTIAL_LV) &&
+ lv_is_on_pvs(seg_lv(raid_seg, s), remove_pvs) &&
+ (dm_list_size(&(seg_lv(raid_seg, s)->segments)) > 1)) {
+ rm_image = seg_lv(raid_seg, s);
+
+ /* First, how many damaged extents are there */
+ if (seg_metalv(raid_seg, s)->status & PARTIAL_LV)
+ extents_needed += seg_metalv(raid_seg, s)->le_count;
+ dm_list_iterate_items(rm_seg, &rm_image->segments) {
+ /*
+ * segment areas are for stripe, mirror, raid,
+ * etc. We only need to check the first area
+ * if we are dealing with RAID image LVs.
+ */
+ if (seg_type(rm_seg, 0) != AREA_PV)
+ continue;
+ pv = seg_pv(rm_seg, 0);
+ if (pv->status & MISSING_PV)
+ extents_needed += rm_seg->len;
+ }
+ log_debug("%u extents needed to repair %s",
+ extents_needed, rm_image->name);
+
+ /* Second, do the other PVs have the space */
+ dm_list_iterate_items(rm_seg, &rm_image->segments) {
+ if (seg_type(rm_seg, 0) != AREA_PV)
+ continue;
+ pv = seg_pv(rm_seg, 0);
+ if (pv->status & MISSING_PV)
+ continue;
+
+ if ((pv->pe_count - pv->pe_alloc_count) >
+ extents_needed) {
+ log_debug("%s has enough space for %s",
+ pv_dev_name(pv),
+ rm_image->name);
+ goto has_enough_space;
+ }
+ log_debug("Not enough space on %s for %s",
+ pv_dev_name(pv), rm_image->name);
+ }
+ }
+ }
+
+ /*
+ * This is likely to be the normal case - single
+ * segment images.
+ */
+ return_0;
+
+has_enough_space:
+ /*
+ * Now we have a multi-segment, partial image that has enough
+ * space on just one of its PVs for the entire image to be
+ * replaced. So, we replace the image's space with an error
+ * target so that the allocator can find that space (along with
+ * the remaining free space) in order to allocate the image
+ * anew.
+ */
+ if (!replace_lv_with_error_segment(rm_image))
+ return_0;
+
+ return 1;
+}
+
/*
* lv_raid_replace
* @lv
@@ -1513,6 +1592,7 @@ int lv_raid_replace(struct logical_volume *lv,
struct dm_list *remove_pvs,
struct dm_list *allocate_pvs)
{
+ int partial_segment_removed = 0;
uint32_t s, sd, match_count = 0;
struct dm_list old_lvs;
struct dm_list new_meta_lvs, new_data_lvs;
@@ -1605,25 +1685,40 @@ int lv_raid_replace(struct logical_volume *lv,
try_again:
if (!_alloc_image_components(lv, allocate_pvs, match_count,
&new_meta_lvs, &new_data_lvs)) {
- log_error("Failed to allocate replacement images for %s/%s",
- lv->vg->name, lv->name);
-
- /*
- * If this is a repair, then try to
- * do better than all-or-nothing
- */
- if (match_count > 1) {
- log_error("Attempting replacement of %u devices"
- " instead of %u", match_count - 1, match_count);
- match_count--;
+ if (!(lv->status & PARTIAL_LV))
+ return 0;
+ /* This is a repair, so try to do better than all-or-nothing */
+ match_count--;
+ if (match_count > 0) {
+ log_error("Failed to replace %u devices."
+ " Attempting to replace %u instead.",
+ match_count, match_count+1);
/*
* Since we are replacing some but not all of the bad
* devices, we must set partial_activation
*/
lv->vg->cmd->partial_activation = 1;
goto try_again;
+ } else if (!match_count && !partial_segment_removed) {
+ /*
+ * We are down to the last straw. We can only hope
+ * that a failed PV is just one of several PVs in
+ * the image; and if we extract the image, there may
+ * be enough room on the image's other PVs for a
+ * reallocation of the image.
+ */
+ if (!_remove_partial_multi_segment_image(lv, remove_pvs))
+ return_0;
+
+ match_count = 1;
+ partial_segment_removed = 1;
+ lv->vg->cmd->partial_activation = 1;
+ goto try_again;
}
+ log_error("Failed to allocate replacement images for %s/%s",
+ lv->vg->name, lv->name);
+
return 0;
}
@@ -1632,9 +1727,17 @@ try_again:
* - If we did this before the allocate, we wouldn't have to rename
* the allocated images, but it'd be much harder to avoid the right
* PVs during allocation.
+ *
+ * - If this is a repair and we were forced to call
+ * _remove_partial_multi_segment_image, then the remove_pvs list
+ * is no longer relevant - _raid_extract_images is forced to replace
+ * the image with the error target. Thus, the full set of PVs is
+ * supplied - knowing that only the image with the error target
+ * will be affected.
*/
if (!_raid_extract_images(lv, raid_seg->area_count - match_count,
- remove_pvs, 0,
+ partial_segment_removed ?
+ &lv->vg->pvs : remove_pvs, 0,
&old_lvs, &old_lvs)) {
log_error("Failed to remove the specified images from %s/%s",
lv->vg->name, lv->name);
diff --git a/test/shell/lvconvert-raid-allocation.sh b/test/shell/lvconvert-raid-allocation.sh
index 804317b..aef786c 100644
--- a/test/shell/lvconvert-raid-allocation.sh
+++ b/test/shell/lvconvert-raid-allocation.sh
@@ -27,7 +27,8 @@ lvconvert -m 0 $vg/$lv1
# lvconvert --type raid1 -m 1 --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
lvremove -ff $vg
-# Setup 2-way RAID1 LV to spread across 4 devices.
+
+# Setup 2-way RAID1 LV, spread across 4 devices.
# For each image:
# - metadata LV + 1 image extent (2 total extents) on one PV
# - 2 image extents on the other PV
@@ -43,10 +44,8 @@ aux wait_for_sync $vg $lv1
# Should not be enough non-overlapping space.
not lvconvert -m +1 $vg/$lv1 \
"$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
-
lvconvert -m +1 $vg/$lv1 "$dev5"
lvconvert -m 0 $vg/$lv1
-
# Should work due to '--alloc anywhere'
# RAID conversion not honoring allocation policy!
#lvconvert -m +1 --alloc anywhere $vg/$lv1 \
@@ -54,4 +53,19 @@ lvconvert -m 0 $vg/$lv1
lvremove -ff $vg
+# Setup 2-way RAID1 LV, spread across 4 devices
+# - metadata LV + 1 image extent (2 total extents) on one PV
+# - 2 image extents on the other PV
+# Kill one PV. There should be enough space on the remaining
+# PV for that image to reallocate the entire image there and
+# still maintain redundancy.
+lvcreate --type raid1 -m 1 -l 3 -n $lv1 $vg \
+ "$dev1:0-1" "$dev2:0-1" "$dev3:0-1" "$dev4:0-1"
+aux wait_for_sync $vg $lv1
+aux disable_dev "$dev1"
+lvconvert --repair -y $vg/$lv1 "$dev1" "$dev2" "$dev3" "$dev4"
+#FIXME: ensure non-overlapping images (they should not share PVs)
+aux enable_dev "$dev1"
+lvremove -ff $vg
+
vgremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7028fd31a0f2d223…
Commit: 7028fd31a0f2d2234ffdd1b94ea6ae6128ca9362
Parent: b35fb0b15af1d87693be286f0630e95622056a77
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Jun 25 22:04:58 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Jun 25 22:04:58 2014 -0500
misc: after releasing a PV segment, merge it with any adjacent free space
Previously, the seg_pvs used to track free and allocated space where left
in place after 'release_pv_segment' was called to free space from an LV.
Now, an attempt is made to combine any adjacent seg_pvs that also track
free space. Usually, this doesn't provide much benefit, but in a case
where one command might free some space and then do an allocation, it
can make a difference. One such case is during a repair of a RAID LV,
where one PV of a multi-PV image fails. This new behavior is used when
the replacement image can be allocated from the remaining space of the
PV that did not fail. (First the entire image with the failed PV is
removed. Then the image is reallocated from the remaining PVs.)
---
lib/metadata/pv_manip.c | 67 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 64 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/pv_manip.c b/lib/metadata/pv_manip.c
index 2717031..2cc7892 100644
--- a/lib/metadata/pv_manip.c
+++ b/lib/metadata/pv_manip.c
@@ -246,8 +246,65 @@ int discard_pv_segment(struct pv_segment *peg, uint32_t discard_area_reduction)
return 1;
}
+static int _merge_free_pv_segment(struct pv_segment *peg)
+{
+ struct dm_list *l;
+ struct pv_segment *merge_peg;
+
+ if (peg->lvseg) {
+ log_error(INTERNAL_ERROR
+ "_merge_free_pv_seg called on a"
+ " segment that is not free.");
+ return 0;
+ }
+
+ /*
+ * FIXME:
+ * Should we free the list element once it is deleted
+ * from the list? I think not. It is likely part of
+ * a mempool.
+ */
+ /* Attempt to merge with Free space before */
+ if ((l = dm_list_prev(&peg->pv->segments, &peg->list))) {
+ merge_peg = dm_list_item(l, struct pv_segment);
+ if (!merge_peg->lvseg) {
+ merge_peg->len += peg->len;
+ dm_list_del(&peg->list);
+ peg = merge_peg;
+ }
+ }
+
+ /* Attempt to merge with Free space after */
+ if ((l = dm_list_next(&peg->pv->segments, &peg->list))) {
+ merge_peg = dm_list_item(l, struct pv_segment);
+ if (!merge_peg->lvseg) {
+ peg->len += merge_peg->len;
+ dm_list_del(&merge_peg->list);
+ }
+ }
+
+ return 1;
+}
+
+/*
+ * release_pv_segment
+ * @peg
+ * @area_reduction
+ *
+ * WARNING: When release_pv_segment is called, the freed space may be
+ * merged into the 'pv_segment's before and after it in the
+ * list if they are also free. Thus, any iterators of the
+ * 'pv->segments' list that call this function must be aware
+ * that the list can change in a way that is unsafe even for
+ * *_safe iterators. Restart the iterator in these cases.
+ *
+ * Returns: 1 on success, 0 on failure
+ */
int release_pv_segment(struct pv_segment *peg, uint32_t area_reduction)
{
+ struct dm_list *l;
+ struct pv_segment *merge_peg;
+
if (!peg->lvseg) {
log_error("release_pv_segment with unallocated segment: "
"%s PE %" PRIu32, pv_dev_name(peg->pv), peg->pe);
@@ -261,9 +318,7 @@ int release_pv_segment(struct pv_segment *peg, uint32_t area_reduction)
peg->lvseg = NULL;
peg->lv_area = 0;
- /* FIXME merge free space */
-
- return 1;
+ return _merge_free_pv_segment(peg);
}
if (!pv_split_segment(peg->lvseg->lv->vg->vgmem,
@@ -271,6 +326,12 @@ int release_pv_segment(struct pv_segment *peg, uint32_t area_reduction)
area_reduction, NULL))
return_0;
+ /* The segment after 'peg' now holds free space, try to merge it */
+ if ((l = dm_list_next(&peg->pv->segments, &peg->list))) {
+ merge_peg = dm_list_item(l, struct pv_segment);
+ return _merge_free_pv_segment(merge_peg);
+ }
+
return 1;
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b35fb0b15af1d876…
Commit: b35fb0b15af1d87693be286f0630e95622056a77
Parent: 1f1675b059d65768524398791b2e505b7dfe2497
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Jun 25 21:20:41 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Jun 25 21:20:41 2014 -0500
raid/misc: Allow creation of parallel areas by LV vs segment
I've changed build_parallel_areas_from_lv to take a new parameter
that allows the caller to build parallel areas by LV vs by segment.
Previously, the function created a list of parallel areas for each
segment in the given LV. When it came time for allocation, the
parallel areas were honored on a segment basis. This was problematic
for RAID because any new RAID image must avoid being placed on any
PVs used by other images in the RAID. For example, if we have a
linear LV that has half its space on one PV and half on another, we
do not want an up-convert to use either of those PVs. It should
especially not wind up with the following, where the first portion
of one LV is paired up with the second portion of the other:
------PV1------- ------PV2-------
[ 2of2 image_1 ] [ 1of2 image_1 ]
[ 1of2 image_0 ] [ 2of2 image_0 ]
---------------- ----------------
Previously, it was possible for this to happen. The change makes
it so that the returned parallel areas list contains one "super"
segment (seg_pvs) with a list of all the PVs from every actual
segment in the given LV and covering the entire logical extent range.
This change allows RAID conversions to function properly when there
are existing images that contain multiple segments that span more
than one PV.
---
WHATS_NEW | 1 +
lib/metadata/lv_alloc.h | 3 +-
lib/metadata/lv_manip.c | 55 +++++++++++++++++++++--------
lib/metadata/mirror.c | 6 ++--
lib/metadata/raid_manip.c | 2 +-
test/shell/lvconvert-raid-allocation.sh | 57 +++++++++++++++++++++++++++++++
test/shell/lvconvert-raid.sh | 22 ------------
7 files changed, 104 insertions(+), 42 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3ab7046..05b3c7c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ New RAID images now avoid allocation on any PVs in the same parent RAID LV.
Always reevaluate filters just before creating PV.
Version 2.02.107 - 23rd June 2014
diff --git a/lib/metadata/lv_alloc.h b/lib/metadata/lv_alloc.h
index f99e1a1..9824c67 100644
--- a/lib/metadata/lv_alloc.h
+++ b/lib/metadata/lv_alloc.h
@@ -86,6 +86,7 @@ int lv_add_virtual_segment(struct logical_volume *lv, uint64_t status,
void alloc_destroy(struct alloc_handle *ah);
struct dm_list *build_parallel_areas_from_lv(struct logical_volume *lv,
- unsigned use_pvmove_parent_lv);
+ unsigned use_pvmove_parent_lv,
+ unsigned create_single_list);
#endif
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 069e5a6..05293f1 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4664,15 +4664,30 @@ static int _add_pvs(struct cmd_context *cmd, struct pv_segment *peg,
}
/*
- * Construct dm_list of segments of LVs showing which PVs they use.
- * For pvmove we use the *parent* LV so we can pick up stripes & existing mirrors etc.
+ * build_parallel_areas_from_lv
+ * @lv
+ * @use_pvmove_parent_lv
+ * @create_single_list
+ *
+ * For each segment in an LV, create a list of PVs used by the segment.
+ * Thus, the returned list is really a list of segments (seg_pvs)
+ * containing a list of PVs that are in use by that segment.
+ *
+ * use_pvmove_parent_lv: For pvmove we use the *parent* LV so we can
+ * pick up stripes & existing mirrors etc.
+ * create_single_list : Instead of creating a list of segments that
+ * each contain a list of PVs, return a list
+ * containing just one segment (i.e. seg_pvs)
+ * that contains a list of all the PVs used by
+ * the entire LV and all it's segments.
*/
struct dm_list *build_parallel_areas_from_lv(struct logical_volume *lv,
- unsigned use_pvmove_parent_lv)
+ unsigned use_pvmove_parent_lv,
+ unsigned create_single_list)
{
struct cmd_context *cmd = lv->vg->cmd;
struct dm_list *parallel_areas;
- struct seg_pvs *spvs;
+ struct seg_pvs *spvs = NULL;
uint32_t current_le = 0;
uint32_t raid_multiple;
struct lv_segment *seg = first_seg(lv);
@@ -4685,19 +4700,20 @@ struct dm_list *build_parallel_areas_from_lv(struct logical_volume *lv,
dm_list_init(parallel_areas);
do {
- if (!(spvs = dm_pool_zalloc(cmd->mem, sizeof(*spvs)))) {
- log_error("allocation failed");
- return NULL;
- }
-
- dm_list_init(&spvs->pvs);
+ if (!spvs || !create_single_list) {
+ if (!(spvs = dm_pool_zalloc(cmd->mem, sizeof(*spvs)))) {
+ log_error("allocation failed");
+ return NULL;
+ }
+ dm_list_init(&spvs->pvs);
+ dm_list_add(parallel_areas, &spvs->list);
+ }
spvs->le = current_le;
spvs->len = lv->le_count - current_le;
- dm_list_add(parallel_areas, &spvs->list);
-
- if (use_pvmove_parent_lv && !(seg = find_seg_by_le(lv, current_le))) {
+ if (use_pvmove_parent_lv &&
+ !(seg = find_seg_by_le(lv, current_le))) {
log_error("Failed to find segment for %s extent %" PRIu32,
lv->name, current_le);
return 0;
@@ -4718,7 +4734,16 @@ struct dm_list *build_parallel_areas_from_lv(struct logical_volume *lv,
seg->area_count - seg->segtype->parity_devs : 1;
} while ((current_le * raid_multiple) < lv->le_count);
- /* FIXME Merge adjacent segments with identical PV lists (avoids need for contiguous allocation attempts between successful allocations) */
+ if (create_single_list) {
+ spvs->le = 0;
+ spvs->len = lv->le_count;
+ }
+
+ /*
+ * FIXME: Merge adjacent segments with identical PV lists
+ * (avoids need for contiguous allocation attempts between
+ * successful allocations)
+ */
return parallel_areas;
}
@@ -5165,7 +5190,7 @@ int split_parent_segments_for_layer(struct cmd_context *cmd,
uint32_t s;
struct dm_list *parallel_areas;
- if (!(parallel_areas = build_parallel_areas_from_lv(layer_lv, 0)))
+ if (!(parallel_areas = build_parallel_areas_from_lv(layer_lv, 0, 0)))
return_0;
/* Loop through all LVs except itself */
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 484b1f1..985bde0 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1687,7 +1687,7 @@ static int _add_mirrors_that_preserve_segments(struct logical_volume *lv,
uint32_t adjusted_region_size;
int r = 1;
- if (!(parallel_areas = build_parallel_areas_from_lv(lv, 1)))
+ if (!(parallel_areas = build_parallel_areas_from_lv(lv, 1, 0)))
return_0;
if (!(segtype = get_segtype_from_string(cmd, "mirror")))
@@ -1971,7 +1971,7 @@ int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
return 1;
}
- if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0)))
+ if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 0)))
return_0;
if (!(segtype = get_segtype_from_string(cmd, "mirror")))
@@ -2044,7 +2044,7 @@ int add_mirror_images(struct cmd_context *cmd, struct logical_volume *lv,
* allocate destination extents
*/
- if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0)))
+ if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 0)))
return_0;
if (!(segtype = get_segtype_from_string(cmd, "mirror")))
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index cdfbc84..0303654 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -392,7 +392,7 @@ static int _alloc_image_components(struct logical_volume *lv,
if (!lvl_array)
return_0;
- if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0)))
+ if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 1)))
return_0;
if (seg_is_linear(seg))
diff --git a/test/shell/lvconvert-raid-allocation.sh b/test/shell/lvconvert-raid-allocation.sh
new file mode 100644
index 0000000..804317b
--- /dev/null
+++ b/test/shell/lvconvert-raid-allocation.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/inittest
+
+aux have_raid 1 3 0 || skip
+
+aux prepare_pvs 5
+vgcreate -s 256k $vg $(cat DEVICES)
+
+# Start with linear on 2 PV and ensure that converting to
+# RAID is not allowed to reuse PVs for different images. (Bug 1113180)
+lvcreate -l 4 -n $lv1 $vg "$dev1:0-1" "$dev2:0-1"
+not lvconvert --type raid1 -m 1 $vg/$lv1 "$dev1" "$dev2"
+not lvconvert --type raid1 -m 1 $vg/$lv1 "$dev1" "$dev3:0-2"
+lvconvert --type raid1 -m 1 $vg/$lv1 "$dev3"
+lvconvert -m 0 $vg/$lv1
+# RAID conversions are not honoring allocation policy!
+# lvconvert --type raid1 -m 1 --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
+lvremove -ff $vg
+
+# Setup 2-way RAID1 LV to spread across 4 devices.
+# For each image:
+# - metadata LV + 1 image extent (2 total extents) on one PV
+# - 2 image extents on the other PV
+# Then attempt allocation of another image from 2 extents on
+# a 5th PV and the remainder of the rest of already used PVs.
+#
+# This should fail because there is insufficient space on the
+# non-parallel PV (i.e. there is not enough space for the image
+# if it doesn't share a PV with another image).
+lvcreate --type raid1 -m 1 -l 3 -n $lv1 $vg \
+ "$dev1:0-1" "$dev2:0-1" "$dev3:0-1" "$dev4:0-1"
+aux wait_for_sync $vg $lv1
+# Should not be enough non-overlapping space.
+not lvconvert -m +1 $vg/$lv1 \
+ "$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
+
+lvconvert -m +1 $vg/$lv1 "$dev5"
+lvconvert -m 0 $vg/$lv1
+
+# Should work due to '--alloc anywhere'
+# RAID conversion not honoring allocation policy!
+#lvconvert -m +1 --alloc anywhere $vg/$lv1 \
+# "$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
+lvremove -ff $vg
+
+
+vgremove -ff $vg
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 8bd56ec..6f17303 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -202,26 +202,4 @@ for i in {1..3}; do
lvremove -ff $vg
done
-# Setup 2-way RAID1 LV to spread across 4 devices.
-# For each image:
-# - metadata LV + 1 image extent (2 total extents) on one PV
-# - 2 image extents on the other PV
-# Then attempt allocation of another image from 2 extents on
-# a 5th PV and the remainder of the rest of already used PVs.
-#
-# This should fail because there is insufficient space on the
-# non-parallel PV (i.e. there is not enough space for the image
-# if it doesn't share a PV with another image).
-lvcreate --type raid1 -m 1 -l 3 -n $lv1 $vg \
- "$dev1:0-1" "$dev2:0-1" "$dev3:0-1" "$dev4:0-1"
-aux wait_for_sync $vg $lv1
-# Should not be enough non-overlapping space.
-not lvconvert -m +1 $vg/$lv1 \
- "$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
-# Should work due to '--alloc anywhere'
-lvconvert -m +1 --alloc anywhere $vg/$lv1 \
- "$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
-lvremove -ff $vg
-
-
vgremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1f1675b059d65768…
Commit: 1f1675b059d65768524398791b2e505b7dfe2497
Parent: e80884cd080cad7e10be4588e3493b9000649426
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Sat Jun 21 15:33:52 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Sat Jun 21 15:33:52 2014 -0500
test: Test addition to show incorrect allocator behavior
If a RAID LV has images that are spread across more than one PV
and you allocate a new image that requires more than one PV,
parallel_areas is only honored for one segment. This commit
adds a test for this condition.
---
test/shell/lvconvert-raid.sh | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 6f17303..8bd56ec 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -202,4 +202,26 @@ for i in {1..3}; do
lvremove -ff $vg
done
+# Setup 2-way RAID1 LV to spread across 4 devices.
+# For each image:
+# - metadata LV + 1 image extent (2 total extents) on one PV
+# - 2 image extents on the other PV
+# Then attempt allocation of another image from 2 extents on
+# a 5th PV and the remainder of the rest of already used PVs.
+#
+# This should fail because there is insufficient space on the
+# non-parallel PV (i.e. there is not enough space for the image
+# if it doesn't share a PV with another image).
+lvcreate --type raid1 -m 1 -l 3 -n $lv1 $vg \
+ "$dev1:0-1" "$dev2:0-1" "$dev3:0-1" "$dev4:0-1"
+aux wait_for_sync $vg $lv1
+# Should not be enough non-overlapping space.
+not lvconvert -m +1 $vg/$lv1 \
+ "$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
+# Should work due to '--alloc anywhere'
+lvconvert -m +1 --alloc anywhere $vg/$lv1 \
+ "$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
+lvremove -ff $vg
+
+
vgremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e80884cd080cad7e…
Commit: e80884cd080cad7e10be4588e3493b9000649426
Parent: e329c3146d91aba94f77a6d5da149e31b20ce60b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 25 16:19:27 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jun 25 16:24:28 2014 +0200
filters: always reevaluate filter before creating a PV
...to avoid using cached value (persistent filter) and therefore
not noticing any change made after last scan/filtering - the state
of the device may have changed, for example new signatures added.
$ lvm dumpconfig --type diff
allocation {
use_blkid_wiping=0
}
devices {
obtain_device_list_from_udev=0
}
$ cat /etc/lvm/cache/.cache | grep sda
$ vgscan
Reading all physical volumes. This may take a while...
Found volume group "fedora" using metadata type lvm2
$ cat /etc/lvm/cache/.cache | grep sda
"/dev/sda",
$ parted /dev/sda mklabel gpt
Information: You may need to update /etc/fstab.
$ parted /dev/sda print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 134MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
$ cat /etc/lvm/cache/.cache | grep sda
"/dev/sda",
====
Before this patch:
$ pvcreate /dev/sda
Physical volume "/dev/sda" successfully created
With this patch applied:
$ pvcreate /dev/sda
Physical volume /dev/sda not found
Device /dev/sda not found (or ignored by filtering).
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 7 +++++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9db42d2..3ab7046 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ Always reevaluate filters just before creating PV.
Version 2.02.107 - 23rd June 2014
=================================
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 599ebb6..0a6e9e9 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1337,6 +1337,13 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name,
/* FIXME Check partition type is LVM unless --force is given */
+ /*
+ * Make sure we don't overwrite any existing signature
+ * that may have been created after last time we did filtering.
+ */
+ if (cmd->filter->wipe)
+ cmd->filter->wipe(cmd->filter);
+
/* Is there a pv here already? */
pv = find_pv_by_name(cmd, name, 1, 1);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e329c3146d91aba9…
Commit: e329c3146d91aba94f77a6d5da149e31b20ce60b
Parent: 3208396ce5ef1c754e8e164f84dbc97727ddb5a4
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 25 08:51:37 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jun 25 08:51:37 2014 +0200
coverity: mark new switch cases with 'fall through' comment for coverity to stop complaining
---
libdm/libdm-report.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 180bb9b..00c3d3f 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -1354,6 +1354,7 @@ static int _compare_selection_field(struct dm_report *rh,
*/
if (*(const uint64_t *) f->sort_value > DM_PERCENT_100)
return 0;
+ /* fall through */
case DM_REPORT_FIELD_TYPE_NUMBER:
r = _cmp_field_int(field_id, *(const uint64_t *) f->sort_value, fs->v.i, fs->flags);
break;
@@ -1839,7 +1840,7 @@ static const char *_tok_value_regex(struct dm_report *rh,
case '(': c = ')'; break;
case '{': c = '}'; break;
case '[': c = ']'; break;
- case '"':
+ case '"': /* fall through */
case '\'': c = *s; break;
default: c = 0;
}
@@ -2075,7 +2076,9 @@ static const char *_tok_value(struct dm_report *rh,
break;
case DM_REPORT_FIELD_TYPE_NUMBER:
+ /* fall through */
case DM_REPORT_FIELD_TYPE_SIZE:
+ /* fall through */
case DM_REPORT_FIELD_TYPE_PERCENT:
if (!(s = _tok_value_number(s, begin, end))) {
log_error("Failed to parse numeric value "
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3cfd48c0960f99ec…
Commit: 3cfd48c0960f99eca3cd6b667c5b2980882a376b
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2014-06-23 13:51 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2014-06-23 13:51 +0000
annotated tag: v2_02_107 has been created
at 3cfd48c0960f99eca3cd6b667c5b2980882a376b (tag)
tagging 0bb6ffb81fac3b51fb7986aa29b84687499a1c78 (commit)
replaces v2_02_106
Release 2.02.107.
430 files changed, 9745 insertions(+), 4434 deletions(-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlOoMQEACgkQIoGRwVZ+LBeAngCePncRfLAS+058cy4pKZ4z11iS
CisAnjlEe5sS8yGBry1qP2c5IocoN7nO
=U2OG
-----END PGP SIGNATURE-----
Alasdair G Kergon (25):
post-release
alloc: Refactor area reservation code.
alloc: Access alloc_parms from alloc_state.
alloc: Introduce A_POSITIONAL_FILL.
alloc: Correct existing use of positional fill.
pvscan: Use lvmetad_used().
reports: Use X for unknown LV attr when no dm.
metadata: Fix unlock on VG recovery error path.
tools: Add --readonly support.
test: Fix default.profile path.
test: configurable write timeout
pvremove: Catch CTRL-c during prompts.
locking: Separate out flock and signal code.
signals: Move sigint handling out to lvm-signal.
signals: Add init_signals.
man: Fix man7 dir dependency.
allocation: Fix alloc anywhere with parity.
report: Add metadata_percent to lvs_cols.
pvmove: tidy
pvvmove: add a few comments
locking: Introduce LCK_ACTIVATION.
locking: fix cluster locking
man: More /dev/vg and /dev/mapper documentation.
pre-release
pre-release
David Teigland (3):
man: more lvmthin discard references
man: lvmthin cover snapshot merge and xfs
man: lvmthin
Dongmao Zhang (1):
systemd: use umask 022 for generated systemd units by lvm2-activation-generator
Jonathan Brassow (18):
vgsplit: Make vgsplit work on mirrors with leg and log on same PV
WHATS_NEW: Add message for commit 9ac858f
test/vgsplit-operation.sh: Add vgsplit tests for RAID
vgsplit: Make RAID 4/5/6 fail cleanly when too few PV specified
test: Move the RAID vgsplit test into a separate file
test: Add the new vgsplit RAID test file forgotten in the last commit
logging: Add LCK_REVERT_MODE to flags printed by decode_flags()
activation: Remove empty DM device when table fails to load.
test: use direct I/O when injecting bad data into RAID images
vgchange: Prompt when setting VG cluster attr if cluster is not setup
WHATS_NEW: For commit 9399b743 (prompt for VG cluster attr change)
vgchange: With '--yes', don't prompt the user
cache: Properly rename origin LV tree when adding "_corig"
poll_daemon: Cleanly exit polling if the LV is no longer active
pvmove: Enable all-or-nothing (atomic) pvmoves
test: Clean-up pvmove-basic for atomic pvmove test
pvmove: Clean-up iterator.
pvmove: Fix code that looks up the "move pv" for display
Marian Csontos (1):
test: add lvresize tests
Peter Rajnoha (79):
profiles: comment out thin_pool_chunk_size in default.profile
lvmdump: add -s to gather system info and context (currently systemd-related only)
lvmdump: list also inactive units for lvmdump -s
configure: use configure's --enable-udev-systemd-background-jobs by default
man: minor fixes in lvmetad man page
config: use devices/ignore_suspended_devices=0 by default
libdevmapper: add dm_units_to_factor for size unit parsing
cleanup: _move_pv is static
systemd: make sysinit.target to pull in lvm2-lvmetad.socket, not sockets.target
systemd: use lvm binary insetad of command symlink in lvm2-pvscan.service
cleanup: fix compiler warning
make: fix commit 1756bf6
report: export DM_REPORT_FIELD_RESERVED_NAME_{HELP,HELP_ALT} and show help on '<lvm_command> -O help'
config: add CONFIG_FILE_SPECIAL config source id
config: attach cft_check_handle to each config tree instead of global cmd_context
config: fix incorrect profile initialization on cmd context refresh
dumpconfig: fix dumpconfig --type diff used in lvm shell as second and later command
commands: do not register profile_ARG for lvcreate/lvchange separetely
config: add CFG_PROFILABLE_METADATA flag
config: differentiate command and metadata profiles and consolidate profile handling code
dumpconfig: add --type profilable-command/profilable-metadata, --metadataprofile/--commandprofile
tests: update profiles.sh test for latest changes
systemd: install lvm2-cluster-activation script as executable
cleanup: remove duplicate --commandprofile reference in dumpconfig's help string
man: update dumpconfig man page for latest changes
profiles: remove default.profile and add {command,metadata}_profile_template.profile
man: update lvm.conf man page for latest changes
man: more man page updates for --commandprofile and --metadataprofile split
man: missing space between option name and value name
lvm_init: don't use name mangling for LVM
cleanup: use const for endptr in dm_units_to_factor
udev: also print subsystem udev flags in debug message about udev flags + fix typo DM_SUBSSYTEM_UDEV_FLAG7 -> DM_SUBSYSTEM_UDEV_FLAG7
report: fix report field type for lv_kernel_major/minor
cleanup: commit c0f9c79 to work also with for non-clustered configuration
cleanup: default.profile is not used (and it was split in two and renamed anyway)
cleanup: move the "daemon is running" checks to lvm-wrappers
tests: some more renames lib/test -> lib/inittest
profile: add thin-generic.profile
spec: new thin-generic.profile
systemd: use RemoveOnStop for dm-event.socket and lvm2-lvmetad.socket
report: select: add DM_REPORT_FIELD_TYPE_SIZE to make a difference between NUMBER and SIZE
report: select: add structs for report selection
report: select: add supporting infrastucture for token parsing in report selections
report: select: add dm_report_init_with_selection to libdm
report: select: add _check_selection fn to support checking fields against given selections
report: select: use _check_report_selection in dm_report_object to report only objects that satisfy the report selection
report: select: add --select arg to dmsetup
report: select: add --select arg to pvs, vgs and lvs
report: select: add --select arg to pvdisplay, vgdisplay and lvdisplay
report: select: refactor: move str_list to libdm
report: select: add dm_report_field_string_list to libdm
report: select: add DM_REPORT_FIELD_TYPE_STRING_LIST to make a difference between STRING and STRING_LIST
report: select: add support for processing string lists in selection
report: select: add support for comparing string lists with selection defined
report: select: add help for creating selections
report: select: show field type in field list if in context of selection
report: select: add support for reserved value recognition in report selection string - add struct dm_report_reserved_value
report: select: refactor: move percent handling code to libdm for reuse
report: select: add support for percent selection
tests: select: add test for report selection feature
report: add support for implicit fields, add implicit "selected" field
report: select: add --select arg to lvm devtypes
report: select: add man pages for report selection feature
prop: update FIELD macro to accomodate the differentiation of number, size and percent field values
tests: update lvcreate-thin for latest changes
test: fix report_select test to work in cluster
WHATS_NEW: commits 7dbbc05a69c4cb9756464720cad29e3c1ed971c3..b16f5633ab199dedfd25f08562f686a6fb4aba9d
WHATS_NEW: commit 76467bdcfd297ffbe2c088b6340ecc7d17d56742
cleanup: gcc warnings and report-select test vs snap_percent 0%
man: add man page entry for dmsetup info -c -S/--select + minor cleanups
compilation: fix warnings: build_dm_uuid now accepts whole struct logical_volume, not lvid
select: add list of allowed types for each selection operator mentioned in help
report: make "help" and "?" field implicit
libdevmapper: revoke commit 7c86131233011c9fb81190bcb40d5d4ac54a533d
report: display explicit fields first, then implicit fields in field help
dmsetup: no need to check for "help" field name after report init
select: add FLD_UNCOMPARABLE flag for fields which can't be compared
select: also mark uncomparable/unselectable fields in field/selection help
select: add message about 'help' field to get more help on each error hit during selection parsing
Petr Rockai (13):
NIX: Fix failure mode for "make check".
NIX: Use VM images with the correct root module list.
metadata: Make it possible to write partial VGs obtained from lvmetad.
test: Make it possible to enable/disable devices silently.
test: Fail devices silently in lvconvert-repair-transient.sh.
test: Fix the vgck test after vg_write change.
lvm1: Fail vg_write graciously when devices are missing.
test: Try harder to vgremove in lvmetad-lvm1.sh.
lvmetad: Avoid "connect failed" spamming when lvmetad is not available.
pvremove: Update lvmcache => avoid spurious error messages.
test: Reflect that --sysinit only treats lvmetad specially with -aay (not -ay).
libdaemon: Keep track of client threads, wait before shutdown.
lvmetad: Drop active connection upon lvmetad_set_active(0).
Zdenek Kabelac (197):
polldaemon: ret invalid cmd for negative interval
pvmove: remove locked flag from error pvmove0
memlock: ignore more libraries
clvmd: fix test mode race
clvmd: move mutex init and detroy
clvmd: set finished flag with mutex
clvmd: drop reply_mutex
clvmd: improve mutex usage in request_timed_out
clvmd: skip adding reply when finished
clvmd: use thread-safe ctime_r when debugging
cleanup: clvmd reindent local_pipe_callback
cleanup: clvmd drop unused enum state
cleanup: corrent indent level
tests: implement lv_attr_bit
tests: check there is really pvmove lv
tests: correct test condition
unknown: fix mempool used for name allocation
thin: dmeventd plugins support more minors
asprintf: fix test for error result
dmeventd: check for list size within lock
devmapper-event: always initialize timeout
makefiles: wait till include is populated
makefiles: clear targets in with make clean
makefiles: compile files on make
makefiles: drop linking of deamon libs to plugins
makefiles: move subdir into same section
libdaemon: header cleanup
cleanup: include stdarg.h where needed.
cleanup: reduce inclusion of unnecessary headers
cleanup: drop inclusion of devmap - merge
cleanup: set _REENTRANT in header
cleanup: skip zeroing of cleared areas
cleanup: add some comment indents...
cleanup: dmeventd abstract lvm2cmd interface
cleanup: dmeventd reorder _fill_device_data
cleanup: dmeventd simplify status processing
cleanup: dmeventd simplify buffer write loop
cleanup: dmeventd improve _get_status
cleanup: dmeventd set next_time when registering
cleanup: dmeventd improve _clien_write code
cleanup: dmeventd improve _handle_request
cleanup: dmeventd drop setting of size
cleanup: dmeventd simplify restart message parsing
tests: fix creation of scsi debug
display: use Virtual for virtual LV
display: show monitoring status
thin: display info when -tpool is running
thin: move segment info display to correct code section
lvscan: drop test for snapshosts
cleanup: put all tests within switch
tests: improve coverage
display: check for dmeventd support
configure: corrected ioctl option
libdm: cleanup complation without DM_IOCTLS
devmapper: fix compilation without devmapper
devmapper-event: always initialize timeout
lv: show X attr when lv_info fails
makefile: fix regression
unknown: add_target_line is not needed
cleanup: indent in devmapper-event
cleanup: indent
cleanup: modules_needed only for devmapper
tests: lets the test continue
locking: use sigaction signal handling
debug: add more debug message for signal handling
signals: better nesting support
cache: avoid expression overflow
coverity: check for profile
coverity: error for undefined origin
coverity: ignore ret val
cleanup: drop uneeded headers
cleanup: cosmetics.
cleanup: missed conversion to dm_malloc/free usage
clenaup: drop unused assigns
cleanup: constify pointers
cleanup: use enum return codes
configure: drop siginterrupt
configure: improve needs_check thin_check test
coverity: catch unwanted path
conf: document new thin_check option
cleanup: cast int to typedef
cleanup: drop unused header
tests: replance hostname call
tests: updates
cleanup: improve error message
man:misc updates
tests: speedup
display: print skipped prompt
man: lvmcache
debug: backtrace error path
cleanup: device extent_size first
man: lvmcache
tests: drop nosync
thin: lvconvert warn before conversion
lvconvert: check ret code of mirror_remove_missing
debug: fix backtracing
man: cleanup style
cleanup: unneeded initialization
cleanup: indent
cleanup: use print when displaying info
thin: improve lvconvert messages
tests: update lvconvert test
tests: wait before down-convert
tests: add have_cache and have_raid
tests: rebuild paths when Makefile is updated
spec: configurable cache build
tests: lvconvert needs --yes
tests: checking mirror_remove_missing
man: call installers only when there are set vars.
tests: notify lvmetad after udev transation
tests: notify loop needs maj:min
tests: skips on unsupported systems
tests: restore disable_dev behavior
vgcfgrestore: return invalid cmd line
cleanup: indent
cleanup: make error message more readable
tests: more vgcfgrestore testing
tests: more pvchange tests
tests: raid and dmeventd
cleanup: use y/n instead of y|n
tests: detect raid presence
tests: add check vg_attr_bit
tests: swap tests
tests: check more things with vgchange
dev_manager: disable extra udev loop
cleanup: add seg_is_pool macro
cleanup: use directly segtype->name
cleanup: indent
vgextend: allow --yes to skip prompt
tests: increase min version for raid testing
tests: add unusable kernel for raid5 testing
tests: improve command coverage
dmsetup: add warning
man: cleanup dmsetup
cleanup: internal error for impossible path
tests: update aux disable_dev
tests: support thin_restore configurable
activate: cleanup lv_check_not_in_use
raid: cleanup error messages
tests: detect same uuid on PV
tests: raid syncaction activation race
tests: dd needs to hit disk
revert: restore original timeout
tests: rename test
man: document DM_DEFAULT_NAME_MANGLING_MODE
configure: accept 'none' as mangling mode
configure: cleanups
configure: reconfigure
tests: fix use of double apostrophes in get
tests: use shell arrays to keep device names
tests: add get_devs function
tests: use manglename none for dmsetup
tests: use get_devs
tests: typo
configure: do not exit with error code
tests: adapt test for newline delimit
tests: fix test compare
tests: disable python failing test
configure: update libcpg test
activation: retry cleanup deactivation
cleanup: drop inline keyword
cleanup: add missing log_error
tests: make timeouts longer
tests: rename test to inittest
man: advertise lvmcache, lvmthin
man: use bullets
man: properly escape -
man: more compliant
man: update lvmthin
man: kiB uppercase
man: dmsetup manglename
tests: update vgchange -c
tests: change to inittest
report: avoid passing NULL label
libdm: dm_report_object avoid duplicat strlen call
libdm: dm_report_object report error for no data
test: pvs bz1108394
snapshot: check it's still snapshot
snapshot: check snapshot exists
snapshot: do not spawn when origin is not active
snapshot: report proper error message
snapshot: %ORIGIN is relative to data size
cleanup: use stack for small buffer
cleanup: we already know max device name size
tests: wait for udev
tests: detect version of thin_restore command
tests: check new snapshot skills
lvconvert: print warning when not convert thinpool
cleanup: use insert_layer_for_lv implicit rename
lvchange: better --refresh of raid and mirrors
cleanup: more readable
cleanup: rename variable wait
tests: remove dmeventd usage
memlock: skip more entries
cleanup: use simplier test
tests: add udev sync point
lv: fix lv_is_raid
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8d27f8e00392e3bd…
Commit: 8d27f8e00392e3bd748cf7ba743a8652e6e7b2f1
Parent: 867b92b031b4913213c335bd0bf7363e934f379d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jun 23 14:03:32 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jun 23 14:03:32 2014 +0100
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 12 ++++++++----
WHATS_NEW_DM | 4 ++--
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/VERSION b/VERSION
index bcbb09e..59da36c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.107(2)-git (2014-04-10)
+2.02.107(2)-git (2014-06-23)
diff --git a/VERSION_DM b/VERSION_DM
index 8b95ed0..d519151 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.86-git (2014-04-10)
+1.02.86-git (2014-06-23)
diff --git a/WHATS_NEW b/WHATS_NEW
index c2b443c..7ab7422 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,5 @@
-Version 2.02.107 -
-==================================
+Version 2.02.107 - 23rd June 2014
+=================================
Introduce LCK_ACTIVATION to avoid concurrent activation of basic LV types.
Fix open_count test for lvchange --refresh or mirrors and raids.
Update pvs,vgs,lvs and lvm man page for selection support.
@@ -12,8 +12,12 @@ Version 2.02.107 -
When converting RAID origin to cache LV, properly rename sub-LVs.
Use RemoveOnStop for lvm2-lvmetad.socket systemd unit.
Add thin-generic configuration profile for generic thin settings.
- Fix crash when reporting of empty labels on pvs.
+ Fix crash when reporting empty labels on pvs.
Use retry_deactivation also when cleaning orphan devices.
+ Wait for client threads when shutting down lvmetad.
+ Remove PV from cache on pvremove.
+ Avoid repeatedly reporting of failure to connect to lvmetad.
+ Introduce MDA_FAILED to permit metadata updates even if some mdas are missing.
Prompt when setting the VG cluster attr if the cluster is not setup.
Allow --yes to skip prompt in vgextend (worked only with -f).
Don't use name mangling for LVM - it never uses dm names with wrong char set.
@@ -27,7 +31,7 @@ Version 2.02.107 -
Strictly separate command profiles and per-VG/LV profiles referenced in mda.
Fix dumpconfig --type diff when run as second and later cmd in lvm shell.
Fix wrong profile reuse from previous run if another cmd is run in lvm shell.
- Move cache description from lvm(8) to lvmcache(7) man page.
+ Move cache description from lvm(8) to new lvmcache(7) man page.
Display skipped prompt in silent mode.
Make reporting commands show help about possible sort keys on '-O help'.
Add metadata_percent to lvs_cols.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 119016a..fddc996 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,5 @@
-Version 1.02.88 -
-=================================
+Version 1.02.88 - 23rd June 2014
+================================
Make "help" and "?" reporting fields implicit.
Recognize implicit "selected" field if using dm_report_init_with_selection.
Add support for implicit reporting fields which are predefined in libdm.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=867b92b031b49132…
Commit: 867b92b031b4913213c335bd0bf7363e934f379d
Parent: 9c3c35787423b3b3d29fdb6a86cf796a1847cce4
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jun 23 14:01:31 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jun 23 14:01:31 2014 +0100
man: More /dev/vg and /dev/mapper documentation.
---
man/dmsetup.8.in | 8 +++++++-
man/lvchange.8.in | 13 ++++++++++++-
man/lvm.8.in | 9 +++++++++
man/vgchange.8.in | 9 +++++++++
4 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/man/dmsetup.8.in b/man/dmsetup.8.in
index b545dcf..b18b0b0 100644
--- a/man/dmsetup.8.in
+++ b/man/dmsetup.8.in
@@ -502,7 +502,13 @@ Sets the device geometry to C/H/S.
.RI [ subsystem ]
.br
Splits given device name into subsystem constituents.
-Default subsystem is LVM.
+The default subsystem is LVM.
+LVM currently generates device names by concatenating the names of the Volume
+Group, Logical Volume and any internal Layer with a hyphen as separator.
+Any hyphens within the names are doubled to escape them.
+The precise encoding might change without notice in any future
+release, so we recommend you always decode using the current version of
+this command.
.br
.TP
.B status
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index 5c896e0..f7aee8f 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -72,7 +72,18 @@ See \fBlvm\fP(8) for common options.
Controls the availability of the logical volumes for use.
Communicates with the kernel device-mapper driver via
libdevmapper to activate (\-ay) or deactivate (\-an) the
-logical volumes. If autoactivation option is used (\-aay),
+logical volumes.
+.IP
+Activation of a logical volume creates a symbolic link
+/dev/VolumeGroupName/LogicalVolumeName pointing to the device node.
+This link is removed on deactivation.
+All software and scripts should access the device through
+this symbolic link and present this as the name of the device.
+The location and name of the underlying device node may depend on
+the distribution and configuration (e.g. udev) and might change
+from release to release.
+.IP
+If autoactivation option is used (\-aay),
the logical volume is activated only if it matches an item in
the activation/auto_activation_volume_list set in lvm.conf.
If this list is not set, then all volumes are considered for
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 0a5c69c..76d1237 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -347,6 +347,14 @@ There are also various reserved names that are used internally by lvm that can n
A VG cannot be called anything that exists in /dev/ at the time of creation, nor can it be called '.' or '..'.
A LV cannot be called '.' '..' 'snapshot' or 'pvmove'. The LV name may also not contain
the strings '_mlog', '_mimage', '_rimage', '_tdata', '_tmeta'.
+A directory bearing the name of each Volume Group is created under /dev when any of its Logical Volumes are activated.
+Each active Logical Volume is accessible from this directory as a symbolic link leading to a device node.
+Links or nodes in /dev/mapper are intended only for internal use and the precise format and escaping might change between releases and distributions.
+Other software and scripts should use the
+/dev/VolumeGroupName/LogicalVolumeName format to reduce the chance of needing
+amendment when the software is updated. Should you need to process the node
+names in /dev/mapper, you may use \fBdmsetup splitname\fP to separate out the
+original VG, LV and internal layer names.
.SH ALLOCATION
When an operation needs to allocate Physical Extents for one or more
Logical Volumes, the tools proceed as follows:
@@ -500,6 +508,7 @@ All tools return a status code of zero on success or non-zero on failure.
.BR lvmthin (7),
.BR lvm\ dumpconfig (8),
.BR clvmd (8),
+.BR dmsetup (8),
.BR lvchange (8),
.BR lvcreate (8),
.BR lvdisplay (8),
diff --git a/man/vgchange.8.in b/man/vgchange.8.in
index 284a655..9ea2f65 100644
--- a/man/vgchange.8.in
+++ b/man/vgchange.8.in
@@ -83,6 +83,15 @@ The \-aay option should be also used during system boot so it's
possible to select which volumes to activate using the
activation/auto_activation_volume_list settting.
.IP
+Activation of a logical volume creates a symbolic link
+/dev/VolumeGroupName/LogicalVolumeName pointing to the device node.
+This link is removed on deactivation.
+All software and scripts should access the device through
+this symbolic link and present this as the name of the device.
+The location and name of the underlying device node may depend on
+the distribution and configuration (e.g. udev) and might change
+from release to release.
+.IP
If clustered locking is enabled, add 'e' to activate/deactivate
exclusively on one node or 'l' to activate/deactivate only
on the local node.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=93597bcbdc791daf…
Commit: 93597bcbdc791daf7308c839f245f6951900d7a7
Parent: 548269a1ddeb8fa2cfc6a9fd95c5fb2c398914a7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 20 11:11:39 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 20 11:14:29 2014 +0200
tests: add udev sync point
Missed synchronization with udev may lead to error on vgcreate,
if previous vgremove was not handled fast enough by udev.
---
test/shell/snapshot-usage.sh | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/test/shell/snapshot-usage.sh b/test/shell/snapshot-usage.sh
index c0a14c6..dcf2886 100644
--- a/test/shell/snapshot-usage.sh
+++ b/test/shell/snapshot-usage.sh
@@ -213,6 +213,12 @@ vgremove -ff $vg1
# Can't test >= 16T devices on 32bit
test "$TSIZE" = 15P || exit 0
+# synchronize with udev activity
+# FIXME - otherwise sequence of vgremove followed by vgcreate may fail...
+# as there could be still remaing links in /dev
+# Unusure if 'vgcreate' should do this type of detection in udev mode.
+aux udev_wait
+
# Check usability with largest extent size
pvcreate "$DM_DEV_DIR/$vg/$lv"
vgcreate -s 4G $vg1 "$DM_DEV_DIR/$vg/$lv"
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=32ad8ab5a4a6cd00…
Commit: 32ad8ab5a4a6cd00f15beb947568a7a5b702f545
Parent: 59ed4d3bf6b1aaf7c3db837251c60ff9004f0879
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 20 11:10:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 20 11:13:41 2014 +0200
memlock: skip more entries
Add more entries for memlock skipping - since those are never
used by lvm code in critical section (suspend state).
---
lib/mm/memlock.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 84b93db..7d9a8f3 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -100,8 +100,10 @@ static const char * const _blacklist_maps[] = {
"/libselinux.so.", /* not using selinux during mlock */
"/libsepol.so.", /* not using sepol during mlock */
"/libtinfo.so.", /* not using tinfo during mlock */
- "/libuuid.so.", /* not using uuid during mlock (blkid) */
+ "/libudev.so.", /* not using udev during mlock */
+ "/libuuid.so.", /* not using uuid during mlock (blkid) */
"/libdl-", /* not using dlopen,dlsym during mlock */
+ "/etc/selinux", /* not using selinux during mlock */
/* "/libdevmapper-event.so" */
};
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=59ed4d3bf6b1aaf7…
Commit: 59ed4d3bf6b1aaf7c3db837251c60ff9004f0879
Parent: c6d82c992b4a4271287233dbedc3a075fa03ca43
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 19 18:20:30 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 19 18:22:51 2014 +0200
dmsetup: no need to check for "help" field name after report init
The "help" field (as well as "?") is implicit now - libdevmapper
takes care of it completely.
---
tools/dmsetup.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 454141e..c679c52 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -2948,9 +2948,6 @@ static int _report_init(const struct command *cmd)
r = 1;
out:
- if (!strcasecmp(options, "help") || !strcmp(options, "?"))
- r = 1;
-
if (len)
dm_free(options);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3964a1a89f525848…
Commit: 3964a1a89f52584878c09cf93bc971b96c0d3de1
Parent: f16da6ef23c75b966f94a27b45ca57bacaa13d20
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Jun 19 10:52:09 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Thu Jun 19 10:52:09 2014 -0500
pvmove: Clean-up iterator.
In 'find_pvmove_lv', separate the code that searches the atomic
pvmove LVs from the code that searches the normal pvmove LVs. This
cleans up the segment iterator code a bit.
---
lib/metadata/mirror.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index ca0c2a1..484b1f1 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1559,14 +1559,29 @@ struct logical_volume *find_pvmove_lv(struct volume_group *vg,
if (!(lv->status & lv_type))
continue;
- /* Check segment origins point to pvname */
+ /*
+ * If this is an atomic pvmove, the first
+ * segment will be a mirror containing
+ * mimages (i.e. AREA_LVs)
+ */
+ if (seg_type(first_seg(lv), 0) == AREA_LV) {
+ seg = first_seg(lv); /* the mirror segment */
+ seg = first_seg(seg_lv(seg, 0)); /* mimage_0 segment0 */
+ if (seg_dev(seg, 0) != dev)
+ continue;
+ return lv;
+ }
+
+ /*
+ * If this is a normal pvmove, check all the segments'
+ * first areas for the requested device
+ */
dm_list_iterate_items(seg, &lv->segments) {
- if (seg_type(seg, 0) == AREA_LV) /* Atomic pvmove */
- seg = first_seg(seg_lv(seg, 0));
- if (seg_type(seg, 0) != AREA_PV) /* Segment pvmove */
+ if (seg_type(seg, 0) != AREA_PV)
continue;
if (seg_dev(seg, 0) != dev)
continue;
+
return lv;
}
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f16da6ef23c75b96…
Commit: f16da6ef23c75b966f94a27b45ca57bacaa13d20
Parent: a40bc36b2e360ad357820e6de2f5ec9fa64a6772
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 19 15:54:22 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 19 16:14:53 2014 +0200
report: display explicit fields first, then implicit fields in field help
It's better to have implicit fields at the very end of the output
so users can see them without scrolling back if the list of fields
is long (the "help" is also an implicit field now so it should be
easily visible).
---
libdm/libdm-report.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 012dca4..fd03052 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -653,11 +653,12 @@ static void _display_fields(struct dm_report *rh, int display_all_fields_item,
if ((tmp = _get_longest_field_id_len(rh->fields)) > id_len)
id_len = tmp;
- _display_fields_more(rh, _implicit_report_fields, id_len,
- display_all_fields_item, display_field_types);
- log_warn(" ");
_display_fields_more(rh, rh->fields, id_len, display_all_fields_item,
display_field_types);
+ log_warn(" ");
+ _display_fields_more(rh, _implicit_report_fields, id_len,
+ display_all_fields_item, display_field_types);
+
}
/*
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a40bc36b2e360ad3…
Commit: a40bc36b2e360ad357820e6de2f5ec9fa64a6772
Parent: cd7325f18d6869452447b7e1d08d8ada7703e0de
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 19 15:47:24 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 19 16:09:32 2014 +0200
libdevmapper: revoke commit 7c86131233011c9fb81190bcb40d5d4ac54a533d
We have "help" and "?" defined as implicit fields now. As such, we
don't need to export these names in libdevmapper (as it was introduced
by commit 7c86131233011c9fb81190bcb40d5d4ac54a533d within this release).
If anyone uses these field names by mistake, the libdevmapper code can
error out correctly if it detects that the set of explicit field names
(the ones supplied by "fields" arg in dm_report_init/dm_report_init_with_selection)
contains any of the implicit field names (the ones defined internally
by libdevmapper itself).
---
WHATS_NEW_DM | 1 -
libdm/libdevmapper.h | 4 ----
libdm/libdm-report.c | 8 ++++----
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 3d1eee1..119016a 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -19,7 +19,6 @@ Version 1.02.88 -
Document env var 'DM_DEFAULT_NAME_MANGLING_MODE' in dmsetup man page.
Warn user about incorrect use of cookie with 'dmsetup remove --force'.
Also recognize 'help'/'?' as reserved sort key name to show help.
- Export recognized DM_REPORT_FIELD_RESERVED_NAME_{HELP,HELP_ALT} to show help.
Add dm_units_to_factor for size unit parsing.
Increase bitset size for minors for thin dmeventd plugin.
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index fab1071..90e0b51 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1642,10 +1642,6 @@ struct dm_report_field;
#define DM_REPORT_FIELD_TYPE_ID_LEN 32
#define DM_REPORT_FIELD_TYPE_HEADING_LEN 32
-/* Reserved field names for special purposes. */
-#define DM_REPORT_FIELD_RESERVED_NAME_HELP "help" /* shows help */
-#define DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT "?" /* shows help */
-
struct dm_report;
struct dm_report_field_type {
uint32_t type; /* object type id */
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 8e46f78..012dca4 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -194,8 +194,8 @@ struct row {
*/
#define COMMON_REPORT_TYPE 0x80000000
#define COMMON_FIELD_SELECTED_ID "selected"
-#define COMMON_FIELD_HELP_ID DM_REPORT_FIELD_RESERVED_NAME_HELP
-#define COMMON_FIELD_HELP_ALT_ID DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT
+#define COMMON_FIELD_HELP_ID "help"
+#define COMMON_FIELD_HELP_ALT_ID "?"
static void *_null_returning_fn(void *obj __attribute__((unused)))
{
@@ -2663,8 +2663,8 @@ struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
}
rh->reserved_values = reserved_values;
- if (!strcasecmp(selection, DM_REPORT_FIELD_RESERVED_NAME_HELP) ||
- !strcmp(selection, DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT)) {
+ if (!strcasecmp(selection, COMMON_FIELD_HELP_ID) ||
+ !strcmp(selection, COMMON_FIELD_HELP_ALT_ID)) {
_display_fields(rh, 0, 1);
log_warn(" ");
_display_selection_help(rh);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=57faf97e6fe9a8d7…
Commit: 57faf97e6fe9a8d7be859db2edb1ba2ad855113d
Parent: e96a4856e678d84054e6c11532628e55830f2fc4
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Jun 18 15:40:06 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Jun 18 15:40:06 2014 -0500
test: Clean-up pvmove-basic for atomic pvmove test
The way I was testing for the existence of pvmove mimages was
incorrect for rhel5. This patch makes it more generic/universal.
---
test/shell/pvmove-basic.sh | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/test/shell/pvmove-basic.sh b/test/shell/pvmove-basic.sh
index bdfb79a..c326dc3 100644
--- a/test/shell/pvmove-basic.sh
+++ b/test/shell/pvmove-basic.sh
@@ -71,7 +71,7 @@ check_and_cleanup_lvs_() {
vgchange -an $vg
lvremove -ff $vg
(dm_table | not grep $vg) || \
- die "ERROR: lvremove did leave some some mappings in DM behind!"
+ die "ERROR: lvremove did leave some mappings in DM behind!"
}
# ---------------------------------------------------------------------
@@ -346,16 +346,13 @@ pvmove $mode "$dev1"
#COMM "pvmove fails activating mirror, properly restores state before pvmove"
dmsetup create $vg-pvmove0 --notable
not pvmove $mode -i 1 "$dev2"
-echo BARF
-dmsetup ls
dmsetup info --noheadings -c -o suspended $vg-$lv1
test $(dmsetup info --noheadings -c -o suspended $vg-$lv1) = "Active"
-if [ -e /dev/mapper/$vg-pvmove0_mimage_0 ]; then
- dmsetup remove $vg-pvmove0 /dev/mapper/$vg-pvmove0_mimage*
+if dmsetup info $vg-pvmove0_mimage_0 > /dev/null; then
+ dmsetup remove $vg-pvmove0 $vg-pvmove0_mimage_0 $vg-pvmove0_mimage_1
else
dmsetup remove $vg-pvmove0
fi
-dmsetup ls
lvremove -ff $vg
done
\ No newline at end of file
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e96a4856e678d840…
Commit: e96a4856e678d84054e6c11532628e55830f2fc4
Parent: 597de5c807c4d5bdd7070359cb62222f454ec1f0
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jun 18 14:28:50 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jun 18 14:30:57 2014 -0500
man: lvmthin
Clean up inconsistencies in the last change.
Improve some bad formatting.
---
man/lvmthin.7.in | 333 +++++++++++++++++++++++++++---------------------------
1 files changed, 169 insertions(+), 164 deletions(-)
diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in
index 7d2ef45..fbd7a91 100644
--- a/man/lvmthin.7.in
+++ b/man/lvmthin.7.in
@@ -103,7 +103,7 @@ Create an LV that will hold thin pool data.
.I Example
.br
-.B # lvcreate \-n pool0 \-L 10G vg
+# lvcreate \-n pool0 \-L 10G vg
.SS 2. create ThinMetaLV
@@ -113,7 +113,7 @@ Create an LV that will hold thin pool metadata.
.I Example
.br
-.B # lvcreate \-n pool0meta \-L 1G vg
+# lvcreate \-n pool0meta \-L 1G vg
# lvs
LV VG Attr LSize
@@ -122,16 +122,18 @@ Create an LV that will hold thin pool metadata.
.SS 3. create ThinPoolLV
+.nf
Combine the data and metadata LVs into a thin pool LV.
ThinDataLV is renamed to hidden ThinPoolLV_tdata.
ThinMetaLV is renamed to hidden ThinPoolLV_tmeta.
The new ThinPoolLV takes the previous name of ThinDataLV.
+.fi
.B lvconvert \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV
.I Example
.br
-.B # lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta
+# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta
# lvs vg/pool0
LV VG Attr LSize Pool Origin Data% Meta%
@@ -145,26 +147,26 @@ The new ThinPoolLV takes the previous name of ThinDataLV.
.SS 4. create ThinLV
+.nf
Create a new thin LV from the thin pool LV.
The thin LV is created with a virtual size.
Multiple new thin LVs may be created in the thin pool.
Thin LV names must be unique in the VG.
The thinpool argument specifies which thin pool will
contain the ThinLV.
+.fi
.B lvcreate \-n ThinLV \-V VirtualSize \-\-thinpool VG/ThinPoolLV
-.br
-.B lvcreate \-T \-n ThinLV \-V VirtualSize VG/ThinPoolLV
.I Example
.br
Create a thin LV in a thin pool:
.br
-.B # lvcreate \-T \-n thin1 \-V 1T vg/pool0
+# lvcreate \-n thin1 \-V 1T \-\-thinpool vg/pool0
Create another thin LV in the same thin pool:
.br
-.B # lvcreate \-n thin2 \-V 1T \-\-thinpool vg/pool0
+# lvcreate \-n thin2 \-V 1T \-\-thinpool vg/pool0
# lvs vg/thin1 vg/thin2
LV VG Attr LSize Pool Origin Data%
@@ -174,9 +176,12 @@ Create another thin LV in the same thin pool:
.SS 5. create SnapLV
Create snapshots of an existing ThinLV or SnapLV.
-Do not \fBNOT\fP specify
+.br
+Do not specify
.BR \-L ", " \-\-size
-since this would not create thin snapshot, but old COW volume.
+when creating a thin snapshot.
+.br
+A size argument will cause an old COW snapshot to be created.
.B lvcreate \-n SnapLV \-s VG/ThinLV
.br
@@ -186,15 +191,15 @@ since this would not create thin snapshot, but old COW volume.
.br
Create first snapshot of an existing ThinLV:
.br
-.B # lvcreate \-n thin1s1 \-s vg/thin1
+# lvcreate \-n thin1s1 \-s vg/thin1
Create second snapshot of the same ThinLV:
.br
-.B # lvcreate \-n thin1s2 \-s vg/thin1
+# lvcreate \-n thin1s2 \-s vg/thin1
Create a snapshot of the first snapshot:
.br
-.B # lvcreate \-n thin1s1s1 \-s vg/thin1s1
+# lvcreate \-n thin1s1s1 \-s vg/thin1s1
# lvs vg/thin1s1 vg/thin1s2 vg/thin1s1s1
LV VG Attr LSize Pool Origin
@@ -202,7 +207,6 @@ Create a snapshot of the first snapshot:
thin1s2 vg Vwi---tz-k 1.00t pool0 thin1
thin1s1s1 vg Vwi---tz-k 1.00t pool0 thin1s1
-
.SS 6. activate SnapLV
Thin snapshots are created with the persistent "activation skip"
@@ -213,7 +217,7 @@ or vgchange to activate thin snapshots with the "k" attribute.
.I Example
.br
-.B # lvchange \-ay \-K vg/thin1s1
+# lvchange \-ay \-K vg/thin1s1
# lvs vg/thin1s1
LV VG Attr LSize Pool Origin
@@ -286,11 +290,11 @@ to use fast devices for the metadata LV.
.I Example
.br
-.B # lvcreate \-n pool0 \-L 10G vg /dev/sdA
-.br
-.B # lvcreate \-n pool0meta \-L 1G vg /dev/sdB
-.br
-.B # lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta
+.nf
+# lvcreate \-n pool0 \-L 10G vg /dev/sdA
+# lvcreate \-n pool0meta \-L 1G vg /dev/sdB
+# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta
+.fi
.BR lvm.conf (5)
.B thin_pool_metadata_require_separate_pvs
@@ -314,11 +318,11 @@ pool metadata LV. This is especially recommended for pool metadata LVs.
.I Example
.br
-.B # lvcreate \-\-type raid1 \-m 1 \-n pool0 \-L 10G vg /dev/sdA /dev/sdB
-.br
-.B # lvcreate \-\-type raid1 \-m 1 \-n pool0meta \-L 1G vg /dev/sdC /dev/sdD
-.br
-.B # lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta
+.nf
+# lvcreate \-\-type raid1 \-m 1 \-n pool0 \-L 10G vg /dev/sdA /dev/sdB
+# lvcreate \-\-type raid1 \-m 1 \-n pool0meta \-L 1G vg /dev/sdC /dev/sdD
+# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta
+.fi
.SS Spare metadata LV
@@ -339,17 +343,18 @@ One pmspare LV is kept in a VG to be used for any thin pool.
The pmspare LV cannot be created explicitly, but may be removed
explicitly.
+.I Example
+.br
.nf
-Example
# lvcreate \-n pool0 \-L 10G vg
-# lvcreate \-n pool0meta \-L 10G vg
+# lvcreate \-n pool0meta \-L 1G vg
# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta
# lvs \-a
-[lvol0_pmspare] vg ewi------- 10.00g
-pool0 vg twi---tz-- 10.00g
-[pool0_tdata] vg Twi------- 10.00g
-[pool0_tmeta] vg ewi------- 1.00g
+ [lvol0_pmspare] vg ewi------- 10.00g
+ pool0 vg twi---tz-- 10.00g
+ [pool0_tdata] vg Twi------- 10.00g
+ [pool0_tmeta] vg ewi------- 1.00g
.fi
The "Metadata check and repair" section describes the use of
@@ -383,9 +388,8 @@ the thin pool LV is not activated, and the thin pool metadata should
be repaired.
Command to repair a thin pool:
-.nf
-lvconvert \-\-repair VG/ThinPoolLV
-.fi
+.br
+.B lvconvert \-\-repair VG/ThinPoolLV
Repair performs the following steps:
@@ -413,9 +417,7 @@ If metadata is manually restored with thin_repair directly,
the pool metadata LV can be manually swapped with another LV
containing new metadata:
-.nf
-lvconvert \-\-thinpool VG/ThinPoolLV \-\-poolmetadata VG/NewThinMetaLV
-.fi
+.B lvconvert \-\-thinpool VG/ThinPoolLV \-\-poolmetadata VG/NewThinMetaLV
.SS Automatic pool metadata LV
@@ -426,18 +428,20 @@ A thin data LV can be converted to a thin pool LV without
specifying a thin pool metadata LV. LVM will automatically
create a metadata LV from the same VG.
-.nf
-lvcreate \-n ThinDataLV \-L LargeSize VG
-lvconvert \-\-thinpool VG/ThinDataLV
+.B lvcreate \-n ThinDataLV \-L LargeSize VG
+.br
+.B lvconvert \-\-thinpool VG/ThinDataLV
-Example
+.I Example
+.br
+.nf
# lvcreate \-n pool0 \-L 10G vg
# lvconvert \-\-thinpool vg/pool0
# lvs \-a
-pool0 vg twi-a-tz-- 10.00g
-[pool0_tdata] vg Twi-ao---- 10.00g
-[pool0_tmeta] vg ewi-ao---- 16.00m
+ pool0 vg twi-a-tz-- 10.00g
+ [pool0_tdata] vg Twi-ao---- 10.00g
+ [pool0_tmeta] vg ewi-ao---- 16.00m
.fi
@@ -451,8 +455,8 @@ displayed by lvs:
.nf
# lvs vg/thin1s1
-LV VG Attr LSize Pool Origin
-thin1s1 vg Vwi---tz-k 1.00t pool0 thin1
+ LV VG Attr LSize Pool Origin
+ thin1s1 vg Vwi---tz-k 1.00t pool0 thin1
.fi
This flag causes the snapshot LV to be skipped, i.e. not activated,
@@ -464,9 +468,8 @@ the \-K (or \-\-ignoreactivationskip) option in addition to the
standard \-ay (or \-\-activate y) option.
Command to activate a thin snapshot LV:
-.nf
-lvchange \-ay \-K VG/SnapLV
-.fi
+.br
+.B lvchange \-ay \-K VG/SnapLV
The persistent "activation skip" flag can be turned off during
lvcreate, or later with lvchange using the \-kn
@@ -478,14 +481,12 @@ commands will activate the LV, and the \-K activation option is
not needed.
Command to create snapshot LV without the activation skip flag:
-.nf
-lvcreate \-\-type thin \-n SnapLV \-kn \-s ThinLV \-\-thinpool VG/ThinPoolLV
-.fi
+.br
+.B lvcreate \-kn \-n SnapLV \-s VG/ThinLV
Command to remove the activation skip flag from a snapshot LV:
-.nf
-lvchange \-kn VG/SnapLV
-.fi
+.br
+.B lvchange \-kn VG/SnapLV
.BR lvm.conf (5)
.B auto_set_activation_skip
@@ -518,24 +519,25 @@ The available free space in a thin pool LV can be displayed
with the lvs command. Free space can be added by extending
the thin pool LV.
-.nf
Command to extend thin pool data space:
-lvextend \-L Size VG/ThinPoolLV
-
-Example
+.br
+.B lvextend \-L Size VG/ThinPoolLV
+.I Example
+.br
+.nf
1. A thin pool LV is using 26.96% of its data blocks.
# lvs
-LV VG Attr LSize Pool Origin Data%
-pool0 vg twi-a-tz-- 10.00g 26.96
+ LV VG Attr LSize Pool Origin Data%
+ pool0 vg twi-a-tz-- 10.00g 26.96
2. Double the amount of physical space in the thin pool LV.
# lvextend \-L+10G vg/pool0
3. The percentage of used data blocks is half the previous value.
# lvs
-LV VG Attr LSize Pool Origin Data%
-pool0 vg twi-a-tz-- 20.00g 13.48
+ LV VG Attr LSize Pool Origin Data%
+ pool0 vg twi-a-tz-- 20.00g 13.48
.fi
Other methods of increasing free data space in a thin pool LV
@@ -551,26 +553,25 @@ The available metadata space in a thin pool LV can be displayed
with the lvs \-o+metadata_percent command.
Command to extend thin pool metadata space:
-.nf
-lvextend \-L Size VG/ThinPoolLV_tmeta
-.fi
-
-Example
+.br
+.B lvextend \-L Size VG/ThinPoolLV_tmeta
+.I Example
+.br
1. A thin pool LV is using 12.40% of its metadata blocks.
.nf
# lvs \-oname,size,data_percent,metadata_percent vg/pool0
-LV LSize Data% Meta%
-pool0 20.00g 13.48 12.40
+ LV LSize Data% Meta%
+ pool0 20.00g 13.48 12.40
.fi
2. Display a thin pool LV with its component thin data LV and thin metadata LV.
.nf
# lvs \-a \-oname,attr,size vg
-LV Attr LSize
-pool0 twi-a-tz-- 20.00g
-[pool0_tdata] Twi-ao---- 20.00g
-[pool0_tmeta] ewi-ao---- 12.00m
+ LV Attr LSize
+ pool0 twi-a-tz-- 20.00g
+ [pool0_tdata] Twi-ao---- 20.00g
+ [pool0_tmeta] ewi-ao---- 12.00m
.fi
3. Double the amount of physical space in the thin metadata LV.
@@ -581,10 +582,10 @@ pool0 twi-a-tz-- 20.00g
4. The percentage of used metadata blocks is half the previous value.
.nf
# lvs \-a \-oname,size,data_percent,metadata_percent vg
-LV LSize Data% Meta%
-pool0 20.00g 13.48 6.20
-[pool0_tdata] 20.00g
-[pool0_tmeta] 24.00m
+ LV LSize Data% Meta%
+ pool0 20.00g 13.48 6.20
+ [pool0_tdata] 20.00g
+ [pool0_tmeta] 24.00m
.fi
@@ -598,8 +599,8 @@ the fstrim command can return space back to the thin pool that had
been used by removed files. fstrim uses discards and will not work
if the thin pool LV has discards mode set to ignore.
-Example
-
+.I Example
+.br
A thin pool has 10G of physical data space, and a thin LV has a virtual
size of 100G. Writing a 1G file to the file system reduces the
free space in the thin pool by 10% and increases the virtual usage
@@ -658,9 +659,7 @@ LVs.
Command to enable or disable the monitoring and automatic extension
of an existing thin pool LV:
-.nf
-lvchange \-\-monitor {y|n} VG/ThinPoolLV
-.fi
+.B lvchange \-\-monitor {y|n} VG/ThinPoolLV
.BR lvm.conf (5)
.B thin_pool_autoextend_threshold thin_pool_autoextend_percent
@@ -679,8 +678,8 @@ be added to the thin pool, in percent of its current size.
Warnings are emitted through syslog when the use of a pool reaches 80%,
85%, 90% and 95%.
-Example
-
+.I Example
+.br
If thin_pool_autoextend_threshold is 70 and thin_pool_autoextend_percent is 20,
whenever a pool exceeds 70% usage, it will be extended by another 20%.
For a 1G pool, using 700M will trigger a resize to 1.2G. When the usage exceeds
@@ -699,8 +698,8 @@ the thin pool LV:
.nf
# lvs vg/pool0
-LV VG Attr LSize Pool Origin Data%
-pool0 vg twi-a-tz-- 512.00m 100.00
+ LV VG Attr LSize Pool Origin Data%
+ pool0 vg twi-a-tz-- 512.00m 100.00
.fi
A thin pool can run out of data blocks for any of the following reasons:
@@ -735,8 +734,8 @@ for the thin pool LV:
.nf
# lvs \-o lv_name,size,data_percent,metadata_percent vg/pool0
-LV LSize Data% Meta%
-pool0 100.00
+ LV LSize Data% Meta%
+ pool0 100.00
.fi
The same reasons for thin pool data space exhaustion apply to thin pool
@@ -769,14 +768,12 @@ indicated by the "z" attribute displayed by lvs. The option \-Z
(or \-\-zero) can be added to commands to specify the zeroing mode.
Command to set the zeroing mode when creating a thin pool LV:
-.nf
-lvconvert \-Z{y|n} \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV
-.fi
+.br
+.B lvconvert \-Z{y|n} \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV
Command to change the zeroing mode of an existing thin pool LV:
-.nf
-lvchange \-Z{y|n} VG/ThinPoolLV
-.fi
+.br
+.B lvchange \-Z{y|n} VG/ThinPoolLV
If zeroing mode is changed from "n" to "y", previously provisioned
blocks are not zeroed.
@@ -808,23 +805,22 @@ pass the discards down the the underlying device. This is the default
mode.
Command to display the current discard mode of a thin pool LV:
-.nf
-lvs \-o+discards VG/ThinPoolLV
-.fi
+.br
+.B lvs \-o+discards VG/ThinPoolLV
Command to set the discard mode when creating a thin pool LV:
-.nf
-lvconvert \-\-discards {ignore|nopassdown|passdown}
- \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV
-.fi
+.br
+.B lvconvert \-\-discards {ignore|nopassdown|passdown}
+.br
+.B " " \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV
Command to change the discard mode of an existing thin pool LV:
-.nf
-lvchange \-\-discards {ignore|nopassdown|passdown} VG/ThinPoolLV
-.fi
+.br
+.B lvchange \-\-discards {ignore|nopassdown|passdown} VG/ThinPoolLV
+.I Example
+.br
.nf
-Example
# lvs \-o name,discards vg/pool0
pool0 passdown
@@ -851,12 +847,14 @@ a larger value is optimal. To optimize for a lot of snapshotting,
a smaller value reduces copying time and consumes less space.
Command to display the thin pool LV chunk size:
-.nf
-lvs \-o+chunksize VG/ThinPoolLV
+.br
+.B lvs \-o+chunksize VG/ThinPoolLV
-Example
+.I Example
+.br
+.nf
# lvs \-o name,chunksize
-pool0 64.00k
+ pool0 64.00k
.fi
.BR lvm.conf (5)
@@ -895,19 +893,19 @@ to take thin snapshots of external, read only LVs. Writes to the
snapshot are stored in the thin pool, and the external LV is used
to read unwritten parts of the thin snapshot.
-.nf
-lvcreate \-\-type thin \-n SnapLV \-s VG/ExternalOriginLV
- \-\-thinpool VG/ThinPoolLV
+.B lvcreate \-n SnapLV \-s VG/ExternalOriginLV \-\-thinpool VG/ThinPoolLV
-Example
+.I Example
+.br
+.nf
# lvchange \-an vg/lve
# lvchange \-\-permission r vg/lve
-# lvcreate \-\-type thin \-n snaplve \-s vg/lve \-\-thinpool vg/pool0
+# lvcreate \-n snaplve \-s vg/lve \-\-thinpool vg/pool0
# lvs vg/lve vg/snaplve
-LV VG Attr LSize Pool Origin Data%
-lve vg ori------- 10.00g
-snaplve vg Vwi-a-tz-- 10.00g pool0 lve 0.00
+ LV VG Attr LSize Pool Origin Data%
+ lve vg ori------- 10.00g
+ snaplve vg Vwi-a-tz-- 10.00g pool0 lve 0.00
.fi
@@ -927,23 +925,25 @@ Convert ExampleLV into a read only external LV with the new name
NewExternalOriginLV, and create a new thin LV that is given the previous
name of ExampleLV.
-.nf
-lvconvert \-\-type thin \-\-thinpool VG/ThinPoolLV
- \-\-originname NewExternalOriginLV \-\-thin VG/ExampleLV
+.B lvconvert \-\-type thin \-\-thinpool VG/ThinPoolLV
+.br
+.B " " \-\-originname NewExternalOriginLV \-\-thin VG/ExampleLV
-Example
+.I Example
+.br
+.nf
# lvcreate \-n lv_example \-L 10G vg
# lvs
-lv_example vg -wi-a----- 10.00g
+ lv_example vg -wi-a----- 10.00g
# lvconvert \-\-type thin \-\-thinpool vg/pool0
\-\-originname lv_external \-\-thin vg/lv_example
# lvs
-LV VG Attr LSize Pool Origin
-lv_example vg Vwi-a-tz-- 10.00g pool0 lv_external
-lv_external vg ori------- 10.00g
+ LV VG Attr LSize Pool Origin
+ lv_example vg Vwi-a-tz-- 10.00g pool0 lv_external
+ lv_external vg ori------- 10.00g
.fi
@@ -956,20 +956,21 @@ rather than using lvconvert on existing LVs.
This one command creates a thin data LV, a thin metadata LV,
and combines the two into a thin pool LV.
-.nf
-lvcreate \-L LargeSize \-\-thinpool VG/ThinPoolLV
+.B lvcreate \-L LargeSize \-\-thinpool VG/ThinPoolLV
-Example
+.I Example
+.br
+.nf
# lvcreate \-L8M \-\-thinpool vg/pool0
# lvs vg/pool0
-LV VG Attr LSize Pool Origin Data%
-pool0 vg twi-a-tz-- 8.00m 0.00
+ LV VG Attr LSize Pool Origin Data%
+ pool0 vg twi-a-tz-- 8.00m 0.00
# lvs \-a
-pool0 vg twi-a-tz-- 8.00m
-[pool0_tdata] vg Twi-ao---- 8.00m
-[pool0_tmeta] vg ewi-ao---- 8.00m
+ pool0 vg twi-a-tz-- 8.00m
+ [pool0_tdata] vg Twi-ao---- 8.00m
+ [pool0_tmeta] vg ewi-ao---- 8.00m
.fi
@@ -986,21 +987,24 @@ and creates a thin LV in the new pool.
.br
\-V VirtualSize specifies the virtual size of the thin LV.
-.nf
-lvcreate \-L LargeSize \-V VirtualSize \-n ThinLV \-\-thinpool VG/ThinPoolLV
+.B lvcreate \-L LargeSize \-V VirtualSize \-n ThinLV \-\-thinpool VG/ThinPoolLV
Equivalent to:
-lvcreate \-L LargeSize \-\-thinpool VG/ThinPoolLV
-lvcreate \-\-type thin \-n ThinLV \-V VirtualSize \-\-thinpool VG/ThinPoolLV
+.br
+.B lvcreate \-L LargeSize \-\-thinpool VG/ThinPoolLV
+.br
+.B lvcreate \-n ThinLV \-V VirtualSize \-\-thinpool VG/ThinPoolLV
-Example
+.I Example
+.br
+.nf
# lvcreate \-L8M \-V2G \-n thin1 \-\-thinpool vg/pool0
# lvs \-a
-pool0 vg twi-a-tz-- 8.00m
-[pool0_tdata] vg Twi-ao---- 8.00m
-[pool0_tmeta] vg ewi-ao---- 8.00m
-thin1 vg Vwi-a-tz-- 2.00g pool0
+ pool0 vg twi-a-tz-- 8.00m
+ [pool0_tdata] vg Twi-ao---- 8.00m
+ [pool0_tmeta] vg ewi-ao---- 8.00m
+ thin1 vg Vwi-a-tz-- 2.00g pool0
.fi
@@ -1018,34 +1022,35 @@ LVs are open, e.g. mounted. If a merge is initiated while the LVs are open,
the effect of the merge is delayed until the origin thin LV is next
activated.
-.nf
-lvconvert \-\-merge VG/SnapLV
+.B lvconvert \-\-merge VG/SnapLV
-Example
+.I Example
+.br
+.nf
# lvs vg
-LV VG Attr LSize Pool Origin
-pool0 vg twi-a-tz-- 10.00g
-thin1 vg Vwi-a-tz-- 100.00g pool0
-thin1s1 vg Vwi-a-tz-k 100.00g pool0 thin1
+ LV VG Attr LSize Pool Origin
+ pool0 vg twi-a-tz-- 10.00g
+ thin1 vg Vwi-a-tz-- 100.00g pool0
+ thin1s1 vg Vwi-a-tz-k 100.00g pool0 thin1
# lvconvert \-\-merge vg/thin1s1
# lvs vg
-LV VG Attr LSize Pool Origin
-pool0 vg twi-a-tz-- 10.00g
-thin1 vg Vwi-a-tz-- 100.00g pool0
+ LV VG Attr LSize Pool Origin
+ pool0 vg twi-a-tz-- 10.00g
+ thin1 vg Vwi-a-tz-- 100.00g pool0
.fi
+.I Example
+.br
.nf
-Example
-
Delayed merging of open LVs.
# lvs vg
-LV VG Attr LSize Pool Origin
-pool0 vg twi-a-tz-- 10.00g
-thin1 vg Vwi-aotz-- 100.00g pool0
-thin1s1 vg Vwi-aotz-k 100.00g pool0 thin1
+ LV VG Attr LSize Pool Origin
+ pool0 vg twi-a-tz-- 10.00g
+ thin1 vg Vwi-aotz-- 100.00g pool0
+ thin1s1 vg Vwi-aotz-k 100.00g pool0 thin1
# df
/dev/mapper/vg-thin1 100G 33M 100G 1% /mnt/X
@@ -1065,12 +1070,12 @@ Merging of thin snapshot thin1s1 will occur on next activation.
# umount /mnt/Xs
# lvs \-a vg
-LV VG Attr LSize Pool Origin
-pool0 vg twi-a-tz-- 10.00g
-[pool0_tdata] vg Twi-ao---- 10.00g
-[pool0_tmeta] vg ewi-ao---- 1.00g
-thin1 vg Owi-a-tz-- 100.00g pool0
-[thin1s1] vg Swi-a-tz-k 100.00g pool0 thin1
+ LV VG Attr LSize Pool Origin
+ pool0 vg twi-a-tz-- 10.00g
+ [pool0_tdata] vg Twi-ao---- 10.00g
+ [pool0_tmeta] vg ewi-ao---- 1.00g
+ thin1 vg Owi-a-tz-- 100.00g pool0
+ [thin1s1] vg Swi-a-tz-k 100.00g pool0 thin1
# lvchange \-an vg/thin1
# lvchange \-ay vg/thin1
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fc6e2a703b604ea5…
Commit: fc6e2a703b604ea5c69f7ea2e00a871c70514b73
Parent: 0548a82e630dc0bf24943ec49a15b86834268b57
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 18 13:48:27 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jun 18 13:48:27 2014 +0200
man: add man page entry for dmsetup info -c -S/--select + minor cleanups
---
man/dmsetup.8.in | 12 ++++++++++++
man/lvs.8.in | 8 ++++----
man/pvs.8.in | 8 ++++----
man/vgs.8.in | 8 ++++----
4 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/man/dmsetup.8.in b/man/dmsetup.8.in
index 10c63ab..b545dcf 100644
--- a/man/dmsetup.8.in
+++ b/man/dmsetup.8.in
@@ -40,6 +40,8 @@ dmsetup \(em low level logical volume management
.IR fields ]
.RB [ \-O | \-\-sort
.IR sort_fields ]
+.RB [ \-S | \-\-select
+.IR Selection ]
.RI [ device_name ]
.RE
.br
@@ -244,6 +246,16 @@ The value \fInone\fP is equivalent to specifying zero.
.BR \-r | \-\-readonly
Set the table being loaded read-only.
.TP
+.BR \-S | \-\-select \ \fISelection
+Display only rows that match Selection criteria. All rows are displayed
+with the additional "selected" column (-o selected) showing 1 if the row
+matches the Selection and 0 otherwise. The Selection criteria are defined
+by specifying column names and their valid values while making use of
+supported comparison operators. As a quick help and to see full list of
+column names that can be used in Selection and the set of supported
+selection operators, check the output of \fBdmsetup info -c -S help\fP
+command.
+.TP
.IR \fB\-\-table \ < table >
Specify a one-line table directly on the command line.
.TP
diff --git a/man/lvs.8.in b/man/lvs.8.in
index 371aaf6..1afd63d 100644
--- a/man/lvs.8.in
+++ b/man/lvs.8.in
@@ -198,14 +198,14 @@ selection. Precede any column with '\fI\-\fP' for a reverse sort on that column.
Output columns as rows.
.TP
.BR \-S ", " \-\-select " " \fISelection
-Display only rows that match selection criteria. All rows are displayed with
+Display only rows that match Selection criteria. All rows are displayed with
the additional "selected" column (\fB-o selected\fP) showing 1 if the row
-matches the Selection and 0 otherwise. The selection criteria are defined
+matches the Selection and 0 otherwise. The Selection criteria are defined
by specifying column names and their valid values (that can include reserved
values) while making use of supported comparison operators. See \fBlvm\fP(8)
and \fB\-S\fP, \fB\-\-select\fP description for more detailed information
-about constructing the selection criteria. As a quick help and to see full
-list of columns names that can be used in selection including the list of
+about constructing the Selection criteria. As a quick help and to see full
+list of column names that can be used in Selection including the list of
reserved values and the set of supported selection operators, check the
output of \fBlvs -S help\fP command.
.TP
diff --git a/man/pvs.8.in b/man/pvs.8.in
index ea32d78..ccd84a5 100644
--- a/man/pvs.8.in
+++ b/man/pvs.8.in
@@ -82,14 +82,14 @@ Physical Volume, showing the start (pvseg_start) and length (pvseg_size) in
units of physical extents.
.TP
.BR \-S ", " \-\-select " " \fISelection
-Display only rows that match selection criteria. All rows are displayed with
+Display only rows that match Selection criteria. All rows are displayed with
the additional "selected" column (\fB-o selected\fP) showing 1 if the row
-matches the Selection and 0 otherwise. The selection criteria are defined
+matches the Selection and 0 otherwise. The Selection criteria are defined
by specifying column names and their valid values (that can include reserved
values) while making use of supported comparison operators. See \fBlvm\fP(8)
and \fB\-S\fP, \fB\-\-select\fP description for more detailed information
-about constructing the selection criteria. As a quick help and to see full
-list of columns names that can be used in selection including the list of
+about constructing the Selection criteria. As a quick help and to see full
+list of column names that can be used in Selection including the list of
reserved values and the set of supported selection operators, check the
output of \fBpvs -S help\fP command.
.TP
diff --git a/man/vgs.8.in b/man/vgs.8.in
index 2f71d26..2d4946f 100644
--- a/man/vgs.8.in
+++ b/man/vgs.8.in
@@ -99,14 +99,14 @@ column.
Output columns as rows.
.TP
.BR \-S ", " \-\-select " " \fISelection
-Display only rows that match selection criteria. All rows are displayed with
+Display only rows that match Selection criteria. All rows are displayed with
the additional "selected" column (\fB-o selected\fP) showing 1 if the row
-matches the Selection and 0 otherwise. The selection criteria are defined
+matches the Selection and 0 otherwise. The Selection criteria are defined
by specifying column names and their valid values (that can include reserved
values) while making use of supported comparison operators. See \fBlvm\fP(8)
and \fB\-S\fP, \fB\-\-select\fP description for more detailed information
-about constructing the selection criteria. As a quick help and to see full
-list of columns names that can be used in selection including the list of
+about constructing the Selection criteria. As a quick help and to see full
+list of column names that can be used in Selection including the list of
reserved values and the set of supported selection operators, check the
output of \fBvgs -S help\fP command.
.TP
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ca1abe70ff6f6efc…
Commit: ca1abe70ff6f6efc6bd49c648aa3e6b8fab184fd
Parent: 63f5be01702f3344fe2e95eea74c5149bab2d78d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 18 12:30:34 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jun 18 12:30:34 2014 +0200
WHATS_NEW: commit 76467bdcfd297ffbe2c088b6340ecc7d17d56742
Ordering string list items on reports is also new compared to
previous state where items were not ordered at all and they
got reported simply as they appeared/were processed.
---
WHATS_NEW_DM | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index d1b05cb..9e6f92e 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -7,6 +7,7 @@ Version 1.02.88 -
Add dm_report_reserved_value to libdevmapper for reserved value definition.
Also display field types when listing all fields in selection help.
Recognize "help" keyword in selection string to show brief help for selection.
+ Always order items reported as string list field lexicographically.
Add dm_report_field_string_list to libdevmapper for direct string list report.
Add DM_REPORT_FIELD_TYPE_STRING_LIST: separate string and string list fields.
Add dm_str_list to libdevmapper for string list type definition and its reuse.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=63f5be01702f3344…
Commit: 63f5be01702f3344fe2e95eea74c5149bab2d78d
Parent: 5ebff6cc9f631b7409d99b72fa0b39ccec30bf1f
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 18 10:48:53 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jun 18 10:48:53 2014 +0200
WHATS_NEW: commits 7dbbc05a69c4cb9756464720cad29e3c1ed971c3..b16f5633ab199dedfd25f08562f686a6fb4aba9d
Report selection support...
---
WHATS_NEW | 5 +++++
WHATS_NEW_DM | 13 +++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5a9a498..5d59845 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,10 @@
Version 2.02.107 -
==================================
+ Update pvs,vgs,lvs and lvm man page for selection support.
+ Add -S/--select to lvm devtypes for report selection.
+ Add -S/--select to pvs,vgs,lvs and {pv,vg,lv}display -C for report selection.
+ Use dm_report_init_with_selection now, implicit "selected" field appears.
+ Make use of libdm's DM_REPORT_FIELD_TYPE{SIZE,PERCENT,STRING_LIST} for fields.
Add support for all-or-nothing (atomic) pvmove.
Automatically add snapshot metadata size for -l %ORIGIN calculation.
When converting RAID origin to cache LV, properly rename sub-LVs.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 90dd5f5..d1b05cb 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,18 @@
Version 1.02.88 -
=================================
+ Recognize implicit "selected" field if using dm_report_init_with_selection.
+ Add support for implicit reporting fields which are predefined in libdm.
+ Add DM_REPORT_FIELD_TYPE_PERCENT: separate number and percent fields.
+ Add dm_percent_range_t,dm_percent_to_float,dm_make_percent to libdm for reuse.
+ Add dm_report_reserved_value to libdevmapper for reserved value definition.
+ Also display field types when listing all fields in selection help.
+ Recognize "help" keyword in selection string to show brief help for selection.
+ Add dm_report_field_string_list to libdevmapper for direct string list report.
+ Add DM_REPORT_FIELD_TYPE_STRING_LIST: separate string and string list fields.
+ Add dm_str_list to libdevmapper for string list type definition and its reuse.
+ Add dmsetup -S/--select to define selection criteria for dmsetup reports.
+ Add dm_report_init_with_selection to intialize report with selection criteria.
+ Add DM_REPORT_FIELD_TYPE_SIZE: separate number and size reporting fields.
Use RemoveOnStop for dm-event.socket systemd unit.
Document env var 'DM_DEFAULT_NAME_MANGLING_MODE' in dmsetup man page.
Warn user about incorrect use of cookie with 'dmsetup remove --force'.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ef43a50926d05909…
Commit: ef43a50926d0590910798dd366f6b8da548b05a3
Parent: d09590c4b601f261d164fd253c7f2b9864cbf7ab
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 17 18:19:59 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jun 17 18:20:08 2014 +0200
tests: update lvcreate-thin for latest changes
With recent changes introduced with the report selection support,
the content of lv_modules field is of string list type (before
it was just string type).
String list elements are always ordered now so update lvcreate-thin
test to expect the elements to be ordered.
---
test/shell/lvcreate-thin.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvcreate-thin.sh b/test/shell/lvcreate-thin.sh
index 9712652..215bfac 100644
--- a/test/shell/lvcreate-thin.sh
+++ b/test/shell/lvcreate-thin.sh
@@ -146,7 +146,7 @@ lvcreate --type snapshot $vg/lv1 --name lv4
lvcreate --type snapshot $vg/lv1 --name $vg/lv5
lvdisplay --maps $vg
-check_lv_field_modules_ thin-pool,thin lv1 snap_lv1 lv2 lv3 lv4 lv5 lv6
+check_lv_field_modules_ thin,thin-pool lv1 snap_lv1 lv2 lv3 lv4 lv5 lv6
check vg_field $vg lv_count 8
lvremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=94316dfe9d61a7b4…
Commit: 94316dfe9d61a7b46c88458e4a8232667fde192a
Parent: 40e0f444955690d4c5a5c5da8320a65e23a50553
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Jun 16 16:23:55 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jun 17 16:27:21 2014 +0200
report: select: add man pages for report selection feature
---
man/lvdisplay.8.in | 2 +
man/lvm.8.in | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++
man/lvs.8.in | 14 ++++++++++
man/pvdisplay.8.in | 2 +
man/pvs.8.in | 14 ++++++++++
man/vgdisplay.8.in | 2 +
man/vgs.8.in | 14 ++++++++++
7 files changed, 117 insertions(+), 0 deletions(-)
diff --git a/man/lvdisplay.8.in b/man/lvdisplay.8.in
index 5593752..1283d58 100644
--- a/man/lvdisplay.8.in
+++ b/man/lvdisplay.8.in
@@ -40,6 +40,8 @@ lvdisplay \(em display attributes of a logical volume
.RI [ + | \- ] Key1 [ , [ + | \- ] Key2 ...]]
.RB [ \-P | \-\-partial ]
.RB [ \-\-segments ]
+.RB [ \-S | \-\-select
+.IR Selection ]
.RB [ \-\-separator
.IR Separator ]
.RB [ \-\-unbuffered ]
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 5449e20..0a5c69c 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -207,6 +207,13 @@ changed with this option. To insert a replacement Physical Volume
of the same or large size use \fBpvcreate \-u\fP to set the uuid to
match the original followed by \fBvgcfgrestore\fP(8).
.TP
+.BR \-S ", " \-\-select " " \fISelection
+For reporting commands, display only rows that match selection criteria.
+All rows are displayed with the additional "selected" column (\fB-o selected\fP)
+showing 1 if the row matches the Selection and 0 otherwise.
+See \fBSELECTION CRITERIA\fP section of this man page for more
+information about the way the selection criteria are constructed.
+.TP
.BR \-M ", " \-\-metadatatype " " \fIType
Specifies which type of on-disk metadata to use, such as \fIlvm1\fP
or \fIlvm2\fP, which can be abbreviated to \fI1\fP or \fI2\fP respectively.
@@ -419,6 +426,68 @@ volume types are an example of this. Other logical volume types may
require more than one command to create. The cache (\fBlvmcache\fP(7))
and thin provisioning (\fBlvmthin\fP(7)) types are examples of this.
+.SH SELECTION CRITERIA
+.LP
+The selection criteria are a set of \fBstatements\fP combined by \fBlogical
+and grouping operators\fP. The \fBstatement\fP consists of \fBcolumn\fP
+name for which a set of valid \fBvalues\fP is defined using
+\fBcomparison operators\fP. For complete list of column names (fields)
+that can be used in selection, see the output of \fB<lvm reporting command> -S help\fP.
+.LP
+\fBComparison operators\fP (cmp_op):
+.IP
+\fB=~\fP \(em Matching regular expression.
+.IP
+\fB!~\fP \(em Not matching regular expression.
+.IP
+\fB=\fP \(em Equal to.
+.IP
+\fB!=\fP \(em Not equal to.
+.IP
+\fB>=\fP \(em Greater than or equal to.
+.IP
+\fB>\fP \(em Greater than
+.IP
+\fB<=\fP \(em Less than or equal to.
+.IP
+\fB<\fP \(em Less than.
+.LP
+\fBBinary logical operators\fP (cmp_log):
+.IP
+\fB&&\fP \(em All fields must match
+.IP
+\fB,\fP \(em All fields must match
+.IP
+\fB||\fP \(em At least one field must match
+.IP
+\fB#\fP \(em At least one field must match
+.LP
+\fBUnary logical operators\fP:
+.IP
+\fB!\fP \(em Logical negation
+.LP
+\fBGrouping operators\fP:
+.IP
+\fB(\fP \(em Left parenthesis
+.IP
+\fB)\fP \(em Right parenthesis
+.IP
+\fB[\fP \(em List start
+.IP
+\fB]\fP \(em List end
+.LP
+\fBInformal grammar specification\fP:
+.IP
+.BR STATEMENT " = " column " cmp_op " VALUE " | " STATEMENT " log_op " STATEMENT " | " (STATEMENT) " | " !(STATEMENT)
+.IP
+.BR VALUE " = " [VALUE " log_op " VALUE]
+.br
+For list-based types: string list. The log_op must always be of one type within the whole list value.
+.IP
+.BR VALUE " = " value
+.br
+For scalar types: number (integer), size (floating point number with size unit suffix), percent (floating point number with or without % suffix), string.
+
.SH DIAGNOSTICS
All tools return a status code of zero on success or non-zero on failure.
.SH FILES
diff --git a/man/lvs.8.in b/man/lvs.8.in
index 2467306..371aaf6 100644
--- a/man/lvs.8.in
+++ b/man/lvs.8.in
@@ -20,6 +20,8 @@ lvs \(em report information about logical volumes
.RI [ + | \- ] Key1 [,[ + | \- ] Key2 [,...]]]
.RB [ \-P | \-\-partial ]
.RB [ \-\-rows ]
+.RB [ \-S | \-\-select
+.IR Selection ]
.RB [ \-\-separator
.IR Separator ]
.RB [ \-\-segments ]
@@ -195,6 +197,18 @@ selection. Precede any column with '\fI\-\fP' for a reverse sort on that column.
.B \-\-rows
Output columns as rows.
.TP
+.BR \-S ", " \-\-select " " \fISelection
+Display only rows that match selection criteria. All rows are displayed with
+the additional "selected" column (\fB-o selected\fP) showing 1 if the row
+matches the Selection and 0 otherwise. The selection criteria are defined
+by specifying column names and their valid values (that can include reserved
+values) while making use of supported comparison operators. See \fBlvm\fP(8)
+and \fB\-S\fP, \fB\-\-select\fP description for more detailed information
+about constructing the selection criteria. As a quick help and to see full
+list of columns names that can be used in selection including the list of
+reserved values and the set of supported selection operators, check the
+output of \fBlvs -S help\fP command.
+.TP
.B \-\-segments
Use default columns that emphasize segment information.
.TP
diff --git a/man/pvdisplay.8.in b/man/pvdisplay.8.in
index aab65ca..0399c1e 100644
--- a/man/pvdisplay.8.in
+++ b/man/pvdisplay.8.in
@@ -39,6 +39,8 @@ pvdisplay \- display attributes of a physical volume
.RB [ \-O | \-\-sort
.RI [ + | \- ] Key1 [ , [ + | \- ] Key2 ...
.RI ]]
+.RB [ \-S | \-\-select
+.IR Selection ]
.RB [ \-\-separator
.IR Separator ]
.RB [ \-\-unbuffered ]
diff --git a/man/pvs.8.in b/man/pvs.8.in
index ed57980..ea32d78 100644
--- a/man/pvs.8.in
+++ b/man/pvs.8.in
@@ -21,6 +21,8 @@ pvs \(em report information about physical volumes
.RB [ \-P | \-\-partial ]
.RB [ \-\-rows ]
.RB [ \-\-segments ]
+.RB [ \-S | \-\-select
+.IR Selection ]
.RB [ \-\-separator
.IR Separator ]
.RB [ \-\-unbuffered ]
@@ -79,6 +81,18 @@ Produces one line of output for each contiguous allocation of space on each
Physical Volume, showing the start (pvseg_start) and length (pvseg_size) in
units of physical extents.
.TP
+.BR \-S ", " \-\-select " " \fISelection
+Display only rows that match selection criteria. All rows are displayed with
+the additional "selected" column (\fB-o selected\fP) showing 1 if the row
+matches the Selection and 0 otherwise. The selection criteria are defined
+by specifying column names and their valid values (that can include reserved
+values) while making use of supported comparison operators. See \fBlvm\fP(8)
+and \fB\-S\fP, \fB\-\-select\fP description for more detailed information
+about constructing the selection criteria. As a quick help and to see full
+list of columns names that can be used in selection including the list of
+reserved values and the set of supported selection operators, check the
+output of \fBpvs -S help\fP command.
+.TP
.BR \-O ", " \-\-sort
Comma-separated ordered list of columns to sort by. Replaces the default
selection. Precede any column with '\fI\-\fP' for a reverse sort on that
diff --git a/man/vgdisplay.8.in b/man/vgdisplay.8.in
index d1ea89a..97cb314 100644
--- a/man/vgdisplay.8.in
+++ b/man/vgdisplay.8.in
@@ -39,6 +39,8 @@ vgdisplay \(em display attributes of volume groups
.RB [ \-O | \-\-sort
.RI [ + | \- ] Key1 [ , [ + | \- ] Key2 ...]]
.RB [ \-P | \-\-partial ]
+.RB [ \-S | \-\-select
+.IR Selection ]
.RB [ \-\-separator
.IR Separator ]
.RB [ \-\-unbuffered ]
diff --git a/man/vgs.8.in b/man/vgs.8.in
index b389ea2..2f71d26 100644
--- a/man/vgs.8.in
+++ b/man/vgs.8.in
@@ -20,6 +20,8 @@ vgs \(em report information about volume groups
.RI [ + | \- ] Key1 [ , [ + | \- ] Key2 ...]]
.RB [ \-P | \-\-partial ]
.RB [ \-\-rows ]
+.RB [ \-S | \-\-select
+.IR Selection ]
.RB [ \-\-separator
.IR Separator ]
.RB [ \-\-unbuffered ]
@@ -96,6 +98,18 @@ column.
.B \-\-rows
Output columns as rows.
.TP
+.BR \-S ", " \-\-select " " \fISelection
+Display only rows that match selection criteria. All rows are displayed with
+the additional "selected" column (\fB-o selected\fP) showing 1 if the row
+matches the Selection and 0 otherwise. The selection criteria are defined
+by specifying column names and their valid values (that can include reserved
+values) while making use of supported comparison operators. See \fBlvm\fP(8)
+and \fB\-S\fP, \fB\-\-select\fP description for more detailed information
+about constructing the selection criteria. As a quick help and to see full
+list of columns names that can be used in selection including the list of
+reserved values and the set of supported selection operators, check the
+output of \fBvgs -S help\fP command.
+.TP
.B \-\-separator \fISeparator
String to use to separate each column. Useful if grepping the output.
.TP
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=03a3f6078de3790a…
Commit: 03a3f6078de3790a6fca3db8deb4bd204df611f1
Parent: 8faa4ded9cd12005df9ba71a2c3464eb7b69de71
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu May 29 09:42:02 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jun 17 16:27:20 2014 +0200
report: select: add support for comparing string lists with selection defined
---
libdm/libdm-report.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 73 insertions(+), 0 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 64e0e8e..380c4dc 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -1004,6 +1004,75 @@ static int _cmp_field_string(const char *field_id, const char *a, const char *b,
return 0;
}
+/* Matches if all items from selection string list match. */
+static int _cmp_field_string_list_all(const struct str_list_sort_value *val,
+ const struct selection_str_list *sel)
+{
+ struct dm_str_list *sel_item;
+ unsigned int i = 1;
+
+ /* if item count differs, it's clear the lists do not match */
+ if (val->items[0].len != dm_list_size(sel->list))
+ return 0;
+
+ /* both lists are sorted so they either match 1:1 or not */
+ dm_list_iterate_items(sel_item, sel->list) {
+ if (strncmp(sel_item->str, val->value + val->items[i].pos, val->items[i].len))
+ return 0;
+ i++;
+ }
+
+ return 1;
+}
+
+/* Matches if any item from selection string list matches. */
+static int _cmp_field_string_list_any(const struct str_list_sort_value *val,
+ const struct selection_str_list *sel)
+{
+ struct dm_str_list *sel_item;
+ unsigned int i;
+
+ /* if value has no items and selection has at least one, it's clear there's no match */
+ if ((val->items[0].len == 0) && dm_list_size(sel->list))
+ return 0;
+
+ dm_list_iterate_items(sel_item, sel->list) {
+ /*
+ * TODO: Optimize this so we don't need to compare the whole lists' content.
+ * Make use of the fact that the lists are sorted!
+ */
+ for (i = 1; i <= val->items[0].len; i++) {
+ if (!strncmp(sel_item->str, val->value + val->items[i].pos, val->items[i].len))
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int _cmp_field_string_list(const char *field_id,
+ const struct str_list_sort_value *value,
+ const struct selection_str_list *selection, uint32_t flags)
+{
+ int r;
+
+ switch (selection->type & SEL_MASK) {
+ case SEL_AND:
+ r = _cmp_field_string_list_all(value, selection);
+ break;
+ case SEL_OR:
+ r = _cmp_field_string_list_any(value, selection);
+ break;
+ default:
+ log_error(INTERNAL_ERROR "_cmp_field_string_list: unsupported string "
+ "list type found, expecting either AND or OR list for "
+ "selection field %s", field_id);
+ return 0;
+ }
+
+ return flags & FLD_CMP_NOT ? !r : r;
+}
+
static int _cmp_field_regex(const char *s, struct dm_regex *r, uint32_t flags)
{
int match = dm_regex_match(r, s) >= 0;
@@ -1036,6 +1105,10 @@ static int _compare_selection_field(struct dm_report *rh,
case DM_REPORT_FIELD_TYPE_STRING:
r = _cmp_field_string(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(field_id, (const struct str_list_sort_value *) f->sort_value,
+ fs->v.l, fs->flags);
+ break;
default:
log_error(INTERNAL_ERROR "_compare_selection_field: unknown field type for field %s", field_id);
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=76467bdcfd297ffb…
Commit: 76467bdcfd297ffbe2c088b6340ecc7d17d56742
Parent: 5abdb52fdc66316d3e7d54085d4e79160024b95e
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu May 29 09:41:18 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jun 17 16:27:20 2014 +0200
report: select: add dm_report_field_string_list to libdm
Add a separate dm_report_field_string_list fn to libdevmapper to
support reporting string lists. Before, the code used libdevmappers's
dm_report_field_string fn which required formatting the list to a
single string. This functionality is now moved to libdevmapper
and the code that needs to report the string list just needs
to pass the list itself and libdevmapper will take care of this.
This also enhances code reuse.
The dm_report_field_string_list also accepts an argument to define
custom delimiter to use. If not defined, a default "," (comma) is
used as item delimiter in the string list reported.
The dm_report_field_string_list automatically sorts the items in
the list before formatting it to a final string. It also encodes
the position and length within the final string where each element
can be found. This can be used to support checking against each
list item reported since since when formatted as a single string
for the actual report, we would lose this information otherwise
(we don't want to copy each item, the position and length within
the final string is enough for us to get the original items back).
When such lists are checked against the selection tree, we can check
each item individually this way and we can support operators like
"match any" and "match all".
---
libdm/libdevmapper.h | 2 +
libdm/libdm-report.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 129 insertions(+), 0 deletions(-)
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index f3e2b92..e007b9b 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1676,6 +1676,8 @@ int dm_report_set_output_field_name_prefix(struct dm_report *rh,
*/
int dm_report_field_string(struct dm_report *rh, struct dm_report_field *field,
const char *const *data);
+int dm_report_field_string_list(struct dm_report *rh, struct dm_report_field *field,
+ const struct dm_list *data, const char *delimiter);
int dm_report_field_int32(struct dm_report *rh, struct dm_report_field *field,
const int32_t *data);
int dm_report_field_uint32(struct dm_report *rh, struct dm_report_field *field,
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 93cba9f..0feef17 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -204,6 +204,133 @@ int dm_report_field_string(struct dm_report *rh,
return 1;
}
+static int _str_cmp(const void *a, const void *b)
+{
+ const char **str_a = (const char **) a;
+ const char **str_b = (const char **) b;
+
+ return strcmp(*str_a, *str_b);
+}
+
+struct str_list_sort_value_item {
+ unsigned pos;
+ size_t len;
+};
+
+struct str_list_sort_value {
+ const char *value;
+ struct str_list_sort_value_item *items;
+};
+
+int dm_report_field_string_list(struct dm_report *rh,
+ struct dm_report_field *field,
+ const struct dm_list *data,
+ const char *delimiter)
+{
+ static const char _string_list_grow_object_failed_msg[] = "dm_report_field_string_list: dm_pool_grow_object_failed";
+ struct str_list_sort_value *sort_value = NULL;
+ unsigned int list_size, pos, i;
+ const char **arr = NULL;
+ struct dm_str_list *sl;
+ size_t delimiter_len, len;
+ void *object;
+ int r = 0;
+
+ if (!(sort_value = dm_pool_zalloc(rh->mem, sizeof(struct str_list_sort_value)))) {
+ log_error("dm_report_field_string_list: dm_pool_zalloc failed for sort_value");
+ return 0;
+ }
+
+ list_size = dm_list_size(data);
+
+ /*
+ * Sort value stores the pointer to the report_string and then
+ * position and length for each list element withing the report_string.
+ * The first element stores number of elements in 'len' (therefore
+ * list_size + 1 is used below for the extra element).
+ */
+ if (!(sort_value->items = dm_pool_zalloc(rh->mem, (list_size + 1) * sizeof(struct str_list_sort_value_item)))) {
+ log_error("dm_report_fiel_string_list: dm_pool_zalloc failed for sort value items");
+ goto out;
+ }
+ sort_value->items[0].len = list_size;
+
+ /* zero items */
+ if (!list_size) {
+ sort_value->value = field->report_string = "";
+ sort_value->items[1].pos = 0;
+ sort_value->items[1].len = 0;
+ field->sort_value = sort_value;
+ return 1;
+ }
+
+ /* one item */
+ if (list_size == 1) {
+ sl = (struct dm_str_list *) dm_list_first(data);
+ if (!(sort_value->value = field->report_string = dm_pool_strdup(rh->mem, sl->str))) {
+ log_error("dm_report_field_string_list: dm_pool_strdup failed");
+ goto out;
+ }
+ sort_value->items[1].pos = 0;
+ sort_value->items[1].len = strlen(sl->str);
+ field->sort_value = sort_value;
+ return 1;
+ }
+
+ /* more than one item - sort the list */
+ if (!(arr = dm_malloc(sizeof(char *) * list_size))) {
+ log_error("dm_report_field_string_list: dm_malloc failed");
+ goto out;
+ }
+ i = 0;
+ dm_list_iterate_items(sl, data)
+ arr[i++] = sl->str;
+ qsort(arr, i, sizeof(char *), _str_cmp);
+
+ if (!(dm_pool_begin_object(rh->mem, 256))) {
+ log_error(_string_list_grow_object_failed_msg);
+ goto out;
+ }
+
+ if (!delimiter)
+ delimiter = ",";
+ delimiter_len = strlen(delimiter);
+
+ /* start from 1 - the item 0 stores the list size! */
+ for (i = 1, pos = 0; i <= list_size; i++) {
+ len = strlen(arr[i-1]);
+ if (!dm_pool_grow_object(rh->mem, arr[i-1], len) ||
+ (i != list_size && !dm_pool_grow_object(rh->mem, delimiter, delimiter_len))) {
+ log_error(_string_list_grow_object_failed_msg);
+ goto out;
+ }
+ /*
+ * save position and length of the string
+ * element in report_string for sort_value
+ */
+ sort_value->items[i].pos = pos;
+ sort_value->items[i].len = len;
+ pos = i == list_size ? pos+len : pos+len+1;
+ }
+
+ if (!dm_pool_grow_object(rh->mem, "\0", 1)) {
+ log_error(_string_list_grow_object_failed_msg);
+ goto out;
+ }
+
+ object = dm_pool_end_object(rh->mem);
+ sort_value->value = object;
+ field->sort_value = sort_value;
+ field->report_string = object;
+ r = 1;
+out:
+ if (!r && sort_value)
+ dm_pool_free(rh->mem, sort_value);
+ if (arr)
+ dm_free(arr);
+ return r;
+}
+
int dm_report_field_int(struct dm_report *rh,
struct dm_report_field *field, const int *data)
{
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2c3e84a68d1f991b…
Commit: 2c3e84a68d1f991bfe47637017723b7cf0435dff
Parent: 4118dd8da3d2603bafffb024739e5033e9f6543d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu May 29 09:37:54 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jun 17 16:27:20 2014 +0200
report: select: add supporting infrastucture for token parsing in report selections
This is rebased and edited version of the original design and
patch proposed by Jun'ichi Nomura:
http://www.redhat.com/archives/dm-devel/2007-April/msg00025.html
Add support for parsing numbers, strings (quoted or unquoted), regexes
and operators amogst these operands in selection condition supplied.
---
libdm/libdm-report.c | 281 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 279 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index ae1c701..882bf3e 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -102,8 +102,8 @@ static struct op_def _op_cmp[] = {
{ "!=", FLD_CMP_NOT|FLD_CMP_EQUAL, "Not equal to." },
{ ">=", FLD_CMP_NUMBER|FLD_CMP_GT|FLD_CMP_EQUAL, "Greater than or equal to." },
{ ">", FLD_CMP_NUMBER|FLD_CMP_GT, "Greater than" },
- { "<=", FLD_CMP_NUMBER|FLD_CMP_LT|FLD_CMP_EQUAL, "Lesser than or equal to." },
- { "<", FLD_CMP_NUMBER|FLD_CMP_LT, "Lesser than." },
+ { "<=", FLD_CMP_NUMBER|FLD_CMP_LT|FLD_CMP_EQUAL, "Less than or equal to." },
+ { "<", FLD_CMP_NUMBER|FLD_CMP_LT, "Less than." },
{ NULL, 0, NULL }
};
@@ -854,6 +854,283 @@ int dm_report_object(struct dm_report *rh, void *object)
}
/*
+ * Selection parsing
+ */
+
+/*
+ * Other tokens (FIELD, VALUE, STRING, NUMBER, REGEX)
+ * FIELD := <strings of alphabet, number and '_'>
+ * VALUE := NUMBER | STRING
+ * REGEX := <strings quoted by '"', '\'', '(', '{', '[' or unquoted>
+ * NUMBER := <strings of [0-9]> (because sort_value is unsigned)
+ * STRING := <strings quoted by '"', '\'' or unquoted>
+ */
+
+static const char * _skip_space(const char *s)
+{
+ while (*s && isspace(*s))
+ s++;
+ return s;
+}
+
+static int _tok_op(struct op_def *t, const char *s, const char **end,
+ uint32_t expect)
+{
+ size_t len;
+
+ s = _skip_space(s);
+
+ for (; t->string; t++) {
+ if (expect && !(t->flags & expect))
+ continue;
+
+ len = strlen(t->string);
+ if (!strncmp(s, t->string, len)) {
+ if (end)
+ *end = s + len;
+ return t->flags;
+ }
+ }
+
+ if (end)
+ *end = s;
+ return 0;
+}
+
+static int _tok_op_log(const char *s, const char **end, uint32_t expect)
+{
+ return _tok_op(_op_log, s, end, expect);
+}
+
+static int _tok_op_cmp(const char *s, const char **end)
+{
+ return _tok_op(_op_cmp, s, end, 0);
+}
+
+ /*
+ *
+ * Input:
+ * s - a pointer to the parsed string
+ * Output:
+ * begin - a pointer to the beginning of the token
+ * end - a pointer to the end of the token + 1
+ * or undefined if return value is NULL
+ * return value - a starting point of the next parsing or
+ * NULL if 's' doesn't match with token type
+ * (the parsing should be terminated)
+ */
+static const char *_tok_value_number(const char *s,
+ const char **begin, const char **end)
+
+{
+ int is_float = 0;
+
+ *begin = s;
+ while (*s && ((!is_float && *s=='.' && (is_float=1)) || isdigit(*s)))
+ s++;
+ *end = s;
+
+ if (*begin == *end)
+ return NULL;
+
+ return s;
+}
+
+/*
+ * Input:
+ * s - a pointer to the parsed string
+ * endchar - terminating character
+ * end_op_flags - terminating operator flags (see _op_log)
+ * (if endchar is non-zero then endflags is ignored)
+ * Output:
+ * begin - a pointer to the beginning of the token
+ * end - a pointer to the end of the token + 1
+ * end_op_flag_hit - the flag from endflags hit during parsing
+ * return value - a starting point of the next parsing
+ */
+static const char *_tok_value_string(const char *s,
+ const char **begin, const char **end,
+ const char endchar, uint32_t end_op_flags,
+ uint32_t *end_op_flag_hit)
+{
+ uint32_t flag_hit = 0;
+
+ *begin = s;
+
+ /*
+ * If endchar is defined, scan the string till
+ * the endchar or the end of string is hit.
+ * This is in case the string is quoted and we
+ * know exact character that is the stopper.
+ */
+ if (endchar) {
+ while (*s && *s != endchar)
+ s++;
+ if (*s != endchar) {
+ log_error("Missing end quote.");
+ return NULL;
+ }
+ *end = s;
+ s++;
+ } else {
+ /*
+ * If endchar is not defined then endchar is/are the
+ * operator/s as defined by 'endflags' arg or space char.
+ * This is in case the string is not quoted and
+ * we don't know which character is the exact stopper.
+ */
+ while (*s) {
+ if ((flag_hit = _tok_op(_op_log, s, NULL, end_op_flags)) || *s == ' ')
+ break;
+ s++;
+ }
+ *end = s;
+ /*
+ * If we hit one of the strings as defined by 'endflags'
+ * and if 'endflag_hit' arg is provided, save the exact
+ * string flag that was hit.
+ */
+ if (end_op_flag_hit)
+ *end_op_flag_hit = flag_hit;
+ }
+
+ return s;
+}
+
+/*
+ * Input:
+ * ft - field type for which the value is parsed
+ * s - a pointer to the parsed string
+ * Output:
+ * begin - a pointer to the beginning of the token
+ * end - a pointer to the end of the token + 1
+ * flags - parsing flags
+ */
+static const char *_tok_value_regex(const struct dm_report_field_type *ft,
+ const char *s, const char **begin,
+ const char **end, uint32_t *flags)
+{
+ char c;
+
+ s = _skip_space(s);
+
+ if (!*s) {
+ log_error("Regular expression expected for selection field %s", ft->id);
+ return NULL;
+ }
+
+ switch (*s) {
+ case '(': c = ')'; break;
+ case '{': c = '}'; break;
+ case '[': c = ']'; break;
+ case '"':
+ case '\'': c = *s; break;
+ default: c = 0;
+ }
+
+ if (!(s = _tok_value_string(c ? s + 1 : s, begin, end, c, SEL_AND | SEL_OR | SEL_PRECEDENCE_PE, NULL))) {
+ log_error("Failed to parse regex value for selection field %s.", ft->id);
+ return NULL;
+ }
+
+ *flags |= DM_REPORT_FIELD_TYPE_STRING;
+ return s;
+}
+
+/*
+ * Input:
+ * ft - field type for which the value is parsed
+ * s - a pointer to the parsed string
+ * mem - memory pool to allocate from
+ * Output:
+ * begin - a pointer to the beginning of the token
+ * end - a pointer to the end of the token + 1
+ * flags - parsing flags
+ * custom - custom data specific to token type
+ * (e.g. size unit factor)
+ */
+static const char *_tok_value(const struct dm_report_field_type *ft,
+ const char *s, const char **begin,
+ const char **end, uint32_t *flags,
+ struct dm_pool *mem, void *custom)
+{
+ int expected_type = ft->flags & DM_REPORT_FIELD_TYPE_MASK;
+ uint64_t *factor;
+ const char *tmp;
+ char c = 0;
+
+ s = _skip_space(s);
+
+ switch (expected_type) {
+
+ case DM_REPORT_FIELD_TYPE_STRING:
+ if (*s == '"' || *s == '\'') {
+ c = *s;
+ s++;
+ }
+ if (!(s = _tok_value_string(s, begin, end, c, SEL_AND | SEL_OR | SEL_PRECEDENCE_PE, NULL))) {
+ log_error("Failed to parse string value "
+ "for selection field %s.", ft->id);
+ return NULL;
+ }
+ *flags |= DM_REPORT_FIELD_TYPE_STRING;
+ break;
+
+ case DM_REPORT_FIELD_TYPE_NUMBER:
+ case DM_REPORT_FIELD_TYPE_SIZE:
+ if (!(s = _tok_value_number(s, begin, end))) {
+ log_error("Failed to parse numeric value "
+ "for selection field %s.", ft->id);
+ return NULL;
+ }
+ factor = (uint64_t *) custom;
+ *factor = dm_units_to_factor(s, &c, 0, &tmp);
+
+ if (expected_type == DM_REPORT_FIELD_TYPE_NUMBER) {
+ if (*factor) {
+ log_error("Found size unit specifier but "
+ "only numeric value expected for "
+ "selection field %s.",ft->id);
+ return NULL;
+ }
+ *flags |= DM_REPORT_FIELD_TYPE_NUMBER;
+ } else {
+ s = tmp;
+ *flags |= DM_REPORT_FIELD_TYPE_SIZE;
+ }
+ }
+
+ return s;
+}
+
+/*
+ * Input:
+ * s - a pointer to the parsed string
+ * Output:
+ * begin - a pointer to the beginning of the token
+ * end - a pointer to the end of the token + 1
+ */
+static const char *_tok_field_name(const char *s,
+ const char **begin, const char **end)
+{
+ char c;
+ s = _skip_space(s);
+
+ *begin = s;
+ while ((c = *s) &&
+ (isalnum(c) || c == '_' || c == '-'))
+ s++;
+ *end = s;
+
+ if (*begin == *end)
+ return NULL;
+
+ return s;
+}
+
+
+
+/*
* Print row of headings
*/
static int _report_headings(struct dm_report *rh)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=494db110040cdc88…
Commit: 494db110040cdc88ebf60abee87b04c6c8718cea
Parent: cd6d6fc24e8093d437543613ddbcbdb0e9c5f8c8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 17 13:33:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 17 13:41:01 2014 +0200
snapshot: %ORIGIN is relative to data size
Let's use the size of origin as the real base for percenta calculation,
and 'silenly' add needed metadata space for snapshot.
So now command 'lvcreate -s -l100%ORIGIN vg/lv' should always create a
snapshot to handle full device overwrite.
---
WHATS_NEW | 1 +
man/lvcreate.8.in | 12 +++++++++---
tools/lvcreate.c | 4 +++-
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5d83a66..77dfdcf 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
+ Automatically add snapshot metadata size for -l %ORIGIN calculation.
When converting RAID origin to cache LV, properly rename sub-LVs.
Use RemoveOnStop for lvm2-lvmetad.socket systemd unit.
Add thin-generic configuration profile for generic thin settings.
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index 9301063..4ae2b9a 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -240,7 +240,8 @@ remaining free space in the Volume Group with the suffix \fI%FREE\fR, as a
percentage of the remaining free space for the specified
PhysicalVolume(s) with the suffix \fI%PVS\fR, or (for a snapshot) as a
percentage of the total space in the Origin Logical Volume with the
-suffix \fI%ORIGIN\fR. When expressed as a percentage, the number is treated
+suffix \fI%ORIGIN\fR (i.e. \fI100%ORIGIN\fR provides space for the whole origin).
+When expressed as a percentage, the number is treated
as an approximate upper limit for the total number of physical extents
to be allocated (including extents used by any mirrors, for example).
.TP
@@ -492,8 +493,8 @@ This operation would require 2 devices - the log is "in-memory":
.sp
.B lvcreate \-m1 \-\-mirrorlog core \-L 500M vg00
-Creates a snapshot logical volume named /dev/vg00/snap which has access to the
-contents of the original logical volume named /dev/vg00/lvol1
+Creates a snapshot logical volume named "vg00/snap" which has access to the
+contents of the original logical volume named "vg00/lvol1"
at snapshot logical volume creation time. If the original logical volume
contains a file system, you can mount the snapshot logical volume on an
arbitrary directory in order to access the contents of the filesystem to run
@@ -501,6 +502,11 @@ a backup while the original filesystem continues to get updated:
.sp
.B lvcreate \-\-size 100m \-\-snapshot \-\-name snap /dev/vg00/lvol1
+Creates a snapshot logical volume named "vg00/snap" with size
+for overwriting 20% of the original logical volume named "vg00/lvol1".:
+.sp
+.B lvcreate \-s \-l 20%ORIGIN \-\-name snap vg00/lvol1
+
Creates a sparse device named /dev/vg1/sparse of size 1TiB with space for just
under 100MiB of actual data on it:
.sp
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 1fa5aef..86264f3 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -394,7 +394,9 @@ static int _update_extents_params(struct volume_group *vg,
log_error(INTERNAL_ERROR "Couldn't find origin volume.");
return 0;
}
- extents = percent_of_extents(lp->extents, origin->le_count, 0);
+ /* Add whole metadata size estimation */
+ extents = cow_max_extents(origin, lp->chunk_size) - origin->le_count +
+ percent_of_extents(lp->extents, origin->le_count, 1);
break;
case PERCENT_NONE:
extents = lp->extents;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=15e7066fe3ea7ca9…
Commit: 15e7066fe3ea7ca9129b68e3b39e9667348a02cc
Parent: c46d4a745dc8c5cb4cfc0c94863e555387e9af75
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 16 12:43:22 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 17 13:36:07 2014 +0200
snapshot: do not spawn when origin is not active
Since the code is not doing anything when origin is not active,
avoid spawning polling thread.
---
tools/toollib.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index add20e3..c619d9b 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1455,7 +1455,7 @@ int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
* - fortunately: polldaemon will immediately shutdown if the
* origin doesn't have a status with a snapshot percentage
*/
- if (background_polling() && lv_is_merging_origin(lv))
+ if (background_polling() && lv_is_merging_origin(lv) && lv_is_active_locally(lv))
lv_spawn_background_polling(cmd, lv);
return 1;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a20de8af208725ff…
Commit: a20de8af208725ff2054209aa7ff7f41cc770db6
Parent: 962a40b98134417f27e89709625ba2ec662204c2
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Jun 16 18:56:32 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Mon Jun 16 18:56:32 2014 -0500
poll_daemon: Cleanly exit polling if the LV is no longer active
If the we are polling an LV due to some sort of conversion and it
becomes inactive, a rather worrisome message is produced, e.g.:
" ABORTING: Mirror percentage check failed."
We can cleanly exit if we do a simple check to see if the LV is
active before performing the check. This eliminates the scary
message.
---
tools/polldaemon.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index be8a5a3..0765930 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -152,6 +152,16 @@ static int _wait_for_single_lv(struct cmd_context *cmd, const char *name, const
return 0;
}
+ /*
+ * If the LV is not active locally, the kernel cannot be
+ * queried for its status. We must exit in this case.
+ */
+ if (!lv_is_active_locally(lv)) {
+ log_print_unless_silent("%s: Interrupted: No longer active.", name);
+ unlock_and_release_vg(cmd, vg, vg->name);
+ return 1;
+ }
+
if (!_check_lv_status(cmd, vg, lv, name, parms, &finished)) {
unlock_and_release_vg(cmd, vg, vg->name);
return_0;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fea8abe56ae506e8…
Commit: fea8abe56ae506e8c924a317cd701e159aab824c
Parent: 4c9fbe048fa9a7b9c21ef96aa431a28151acdb1d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jun 13 15:45:25 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jun 13 15:45:25 2014 +0200
systemd: use RemoveOnStop for dm-event.socket and lvm2-lvmetad.socket
Systemd version 214 introduced new "RemoveOnStop" option for socket
units to remove the socket/FIFO when the particular unit is stopped.
Also https://bugzilla.redhat.com/show_bug.cgi?id=802748.
---
WHATS_NEW | 1 +
WHATS_NEW_DM | 1 +
scripts/dm_event_systemd_red_hat.socket.in | 1 +
scripts/lvm2_lvmetad_systemd_red_hat.socket.in | 1 +
4 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6791f34..dcde550 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
+ Use RemoveOnStop for lvm2-lvmetad.socket systemd unit.
Add thin-generic configuration profile for generic thin settings.
Fix crash when reporting of empty labels on pvs.
Use retry_deactivation also when cleaning orphan devices.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 976f927..90dd5f5 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.88 -
=================================
+ Use RemoveOnStop for dm-event.socket systemd unit.
Document env var 'DM_DEFAULT_NAME_MANGLING_MODE' in dmsetup man page.
Warn user about incorrect use of cookie with 'dmsetup remove --force'.
Also recognize 'help'/'?' as reserved sort key name to show help.
diff --git a/scripts/dm_event_systemd_red_hat.socket.in b/scripts/dm_event_systemd_red_hat.socket.in
index b27c68d..80bcbb9 100644
--- a/scripts/dm_event_systemd_red_hat.socket.in
+++ b/scripts/dm_event_systemd_red_hat.socket.in
@@ -7,6 +7,7 @@ DefaultDependencies=no
ListenFIFO=@DEFAULT_DM_RUN_DIR@/dmeventd-server
ListenFIFO=@DEFAULT_DM_RUN_DIR@/dmeventd-client
SocketMode=0600
+RemoveOnStop=true
[Install]
WantedBy=sockets.target
diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in b/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
index 071fd64..9575f98 100644
--- a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
@@ -6,6 +6,7 @@ DefaultDependencies=no
[Socket]
ListenStream=@DEFAULT_RUN_DIR@/lvmetad.socket
SocketMode=0600
+RemoveOnStop=true
[Install]
WantedBy=sysinit.target
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8e0687ca690f9c5a…
Commit: 8e0687ca690f9c5aa009e4b1963d46a03f8ba54c
Parent: cf4d5ead0210aa12dfd73fed2061d4d9febce827
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jun 13 09:45:26 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jun 13 09:56:29 2014 +0200
profile: add thin-generic.profile
The thin-generic.profile contains settings for thin/thin pool volumes
suitable for generic environment/use containing default settings.
This allows users to change the global lvm.conf settings at will
and still keep the original settings for volumes that have this
thin profile assigned already.
---
WHATS_NEW | 1 +
conf/Makefile.in | 2 +-
conf/thin-generic.profile | 4 ++++
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b77d404..6791f34 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
+ Add thin-generic configuration profile for generic thin settings.
Fix crash when reporting of empty labels on pvs.
Use retry_deactivation also when cleaning orphan devices.
Prompt when setting the VG cluster attr if the cluster is not setup.
diff --git a/conf/Makefile.in b/conf/Makefile.in
index 54852e2..e56b25e 100644
--- a/conf/Makefile.in
+++ b/conf/Makefile.in
@@ -19,7 +19,7 @@ CONFSRC=example.conf
CONFDEST=lvm.conf
PROFILE_TEMPLATES=command_profile_template.profile metadata_profile_template.profile
-PROFILES=$(PROFILE_TEMPLATES) $(srcdir)/thin-performance.profile
+PROFILES=$(PROFILE_TEMPLATES) $(srcdir)/thin-generic.profile $(srcdir)/thin-performance.profile
include $(top_builddir)/make.tmpl
diff --git a/conf/thin-generic.profile b/conf/thin-generic.profile
new file mode 100644
index 0000000..229a7fc
--- /dev/null
+++ b/conf/thin-generic.profile
@@ -0,0 +1,4 @@
+allocation {
+ thin_pool_chunk_size_policy = "generic"
+ thin_pool_zero = 1
+}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f845afe7cfc98ac1…
Commit: f845afe7cfc98ac1cde86e25d60c6eeeb530eebe
Parent: 4db71422a243ac915ec835a46031f8458f0a8648
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 11 10:52:16 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 11 11:11:10 2014 +0200
man: dmsetup manglename
More updates to manglename option.
Add reference to LVM2 resource page, since for a long time,
this is the right places for sources for libdevmapper....
---
man/dmsetup.8.in | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/man/dmsetup.8.in b/man/dmsetup.8.in
index b257c89..10c63ab 100644
--- a/man/dmsetup.8.in
+++ b/man/dmsetup.8.in
@@ -192,13 +192,16 @@ When returning any table information from the kernel report on the
inactive table instead of the live table.
Requires kernel driver version 4.16.0 or above.
.TP
-.IR \fB\-\-manglename \ < mangling_mode >
+.IR \fB\-\-manglename \ { none | hex | auto }
Mangle any character not on a whitelist using mangling_mode when
processing device-mapper device names and UUIDs. The names and UUIDs
-are mangled on input and unmangled on output where the mangling_mode
-is one of: none (no mangling), hex (always do the mangling) and auto
-(only do the mangling if not mangled yet, do nothing if already
-mangled, error on mixed; this is used by default).
+are mangled on input and unmangled on output where the mangling mode
+is one of:
+\fInone\fP (no mangling),
+\fIhex\fP (always do the mangling) and
+\fIauto\fP (only do the mangling if not mangled yet, do nothing
+if already mangled, error on mixed)
+Default mode is \fI#DEFAULT_MANGLING#\fP.
Character whitelist: 0-9, A-Z, a-z, #+-.:=@_. This whitelist is
also supported by udev. Any character not on a whitelist is replaced
with its hex value (two digits) prefixed by \\x.
@@ -386,7 +389,7 @@ If neither is supplied, reads a table from standard input.
.br
Wait for any I/O in-flight through the device to complete, then
replace the table with a new table that fails any new I/O
-sent to the device. If successful, this should release any devices
+sent to the device. If successful, this should release any devices
held open by the device's table(s).
.br
.HP
@@ -612,7 +615,7 @@ Each line of the table specifies a single target and is of the form:
.B target_type
.RI < target_args >
.P
-Simple target types and <target_args> include:
+Simple target types and <target_args> include:
.HP
.B linear
.I destination_device start_sector
@@ -683,8 +686,8 @@ Supports snapshots of devices.
.P
To find out more about the various targets and their table formats and status
lines, please read the files in the Documentation/device-mapper directory in
-the kernel source tree.
-(Your distribution might include a copy of this information in the
+the kernel source tree.
+(Your distribution might include a copy of this information in the
documentation directory for the device-mapper package.)
.SH EXAMPLES
@@ -718,11 +721,13 @@ A cookie to use for all relevant commands to synchronize with udev processing.
It is an alternative to using \fB\-\-udevcookie\fP option.
.TP
.B DM_DEFAULT_NAME_MANGLING_MODE
-A default mangling mode. Defaults to "#DEFAULT_MANGLING#"
+A default mangling mode. Defaults to "\fI#DEFAULT_MANGLING#\fP"
and it is an alternative to using \fB\-\-manglename\fP option.
.SH AUTHORS
Original version: Joe Thornber (thornber(a)redhat.com)
.SH SEE ALSO
+LVM2 resource page https://www.sourceware.org/lvm2/
+.br
Device-mapper resource page: http://sources.redhat.com/dm/
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4db71422a243ac91…
Commit: 4db71422a243ac915ec835a46031f8458f0a8648
Parent: d13efac51b7a191e02106fcf467b64f3929eeb2d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 11 10:54:19 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 11 11:10:56 2014 +0200
man: kiB uppercase
---
man/lvchange.8.in | 4 ++--
man/lvcreate.8.in | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index ce10012..5c896e0 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -154,13 +154,13 @@ immediately poll a logical volume when it is activated, use
.IR \fB\-\-[raid]maxrecoveryrate " " \fIRate [ bBsSkKmMgG ]
Sets the maximum recovery rate for a RAID logical volume. \fIRate\fP
is specified as an amount per second for each device in the array.
-If no suffix is given, then kiB/sec/device is assumed. Setting the
+If no suffix is given, then KiB/sec/device is assumed. Setting the
recovery rate to 0 means it will be unbounded.
.TP
.IR \fB\-\-[raid]minrecoveryrate " " \fIRate [ bBsSkKmMgG ]
Sets the minimum recovery rate for a RAID logical volume. \fIRate\fP
is specified as an amount per second for each device in the array.
-If no suffix is given, then kiB/sec/device is assumed. Setting the
+If no suffix is given, then KiB/sec/device is assumed. Setting the
recovery rate to 0 means it will be unbounded.
.TP
.BR \-\-[raid]syncaction " {" \fIcheck | \fIrepair }
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index 64468a0..9892c21 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -316,13 +316,13 @@ Without this option a default name of "lvol#" will be generated where
.IR \fB\-\-[raid]maxrecoveryrate " " \fIRate [ bBsSkKmMgG ]
Sets the maximum recovery rate for a RAID logical volume. \fIRate\fP
is specified as an amount per second for each device in the array.
-If no suffix is given, then kiB/sec/device is assumed. Setting the
+If no suffix is given, then KiB/sec/device is assumed. Setting the
recovery rate to 0 means it will be unbounded.
.TP
.IR \fB\-\-[raid]minrecoveryrate " " \fIRate [ bBsSkKmMgG ]
Sets the minimum recovery rate for a RAID logical volume. \fIRate\fP
is specified as an amount per second for each device in the array.
-If no suffix is given, then kiB/sec/device is assumed. Setting the
+If no suffix is given, then KiB/sec/device is assumed. Setting the
recovery rate to 0 means it will be unbounded.
.TP
.B \-\-noudevsync