master - vg_validate: only reject min_recovery_rate in case max_recovery_rate is set and smaller
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=43f455589377cb...
Commit: 43f455589377cb5e3b21434a58226a7365fe1d6f
Parent: d46de28a6c6107dceec1c61b76234e84c421b840
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Jul 27 23:20:58 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Jul 27 23:20:58 2016 +0200
vg_validate: only reject min_recovery_rate in case max_recovery_rate is set and smaller
---
lib/metadata/merge.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 33aa421..12c3829 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -118,8 +118,9 @@ static void _check_raid_region_recovery(struct lv_segment *seg, int *error_count
raid_seg_error("zero region_size");
if (!is_power_of_2(seg->region_size))
raid_seg_error_val("non power of 2 region size", seg->region_size);
- /* min/max recovery rate may be zero but min may not be larger than max*/
- if (seg->min_recovery_rate > seg->max_recovery_rate)
+ /* min/max recovery rate may be zero but min may not be larger than max if set */
+ if (seg->max_recovery_rate &&
+ seg->min_recovery_rate > seg->max_recovery_rate)
raid_seg_error_val("min recovery larger than max recovery larger", seg->min_recovery_rate);
}
7 years, 9 months
master - vg_validate: add missing check for raid6 segment types
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d46de28a6c6107...
Commit: d46de28a6c6107dceec1c61b76234e84c421b840
Parent: df02917d7eef511f16edb195198f5f85583b44f0
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Jul 27 23:14:46 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Jul 27 23:14:46 2016 +0200
vg_validate: add missing check for raid6 segment types
---
lib/metadata/merge.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 681ec72..33aa421 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -308,6 +308,7 @@ static void _check_raid_seg(struct lv_segment *seg, int *error_count)
_check_raid1_seg(seg, error_count);
else if (seg_is_raid4(seg) ||
seg_is_any_raid5(seg) ||
+ seg_is_any_raid6(seg) ||
seg_is_raid10(seg))
_check_raid45610_seg(seg, error_count);
else
7 years, 9 months
master - vg_validate: fix seg->extents_copied check introduced with commit 8f62b7bfe5 and add comment for the member to 'struct lv_segment'
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=df02917d7eef51...
Commit: df02917d7eef511f16edb195198f5f85583b44f0
Parent: ea90a3d622319fd15a3e85d772b25cd352a3544b
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Jul 27 23:09:54 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Jul 27 23:09:54 2016 +0200
vg_validate: fix seg->extents_copied check introduced with commit 8f62b7bfe5 and add comment for the member to 'struct lv_segment'
---
lib/metadata/merge.c | 5 +++--
lib/metadata/metadata-exported.h | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 8e7d107..681ec72 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -192,8 +192,6 @@ static void _check_non_raid_seg_members(struct lv_segment *seg, int *error_count
raid_seg_error("non-zero cow LV");
if (!dm_list_empty(&seg->origin_list)) /* snap */
raid_seg_error("non-zero origin_list");
- if (seg->extents_copied)
- raid_seg_error("non-zero extents_copied");
if (seg->log_lv)
raid_seg_error("non-zero log LV");
if (seg->segtype_private)
@@ -256,6 +254,9 @@ static void _check_raid_seg(struct lv_segment *seg, int *error_count)
if (!seg->areas)
raid_seg_error("zero areas");
+ if (seg->extents_copied > seg->area_len)
+ raid_seg_error_val("extents_copied too large", seg->extents_copied);
+
/* Default still 8, change! */
if (seg->area_count > DEFAULT_RAID_MAX_IMAGES) {
log_error("LV %s invalid: maximum supported areas %u (is %u) for %s segment",
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index ff879bb..a8cbfa2 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -463,7 +463,7 @@ struct lv_segment {
struct logical_volume *cow;
struct dm_list origin_list;
uint32_t region_size; /* For mirrors, replicators - in sectors */
- uint32_t extents_copied;
+ uint32_t extents_copied;/* Number of extents synced for raids/mirrors */
struct logical_volume *log_lv;
struct lv_segment *pvmove_source_seg;
void *segtype_private;
7 years, 9 months
master - vgsplit: restore check for thin pool external origin
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ea90a3d622319f...
Commit: ea90a3d622319fd15a3e85d772b25cd352a3544b
Parent: 17fb64b569742a2d247f20d198a8b6facdd12a0c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jul 27 14:00:57 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jul 27 14:00:57 2016 -0500
vgsplit: restore check for thin pool external origin
Fix a regression from commit 4420d41f, in which the
check was skipped for splitting a thin pool and an
external origin.
---
tools/vgsplit.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 909a786..fd43650a 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -331,7 +331,8 @@ static int _move_thins(struct volume_group *vg_from,
data_lv = seg_lv(first_seg(seg->pool_lv), 0);
/* Ignore, if no allocations on PVs of @vg_to */
- if (!lv_is_on_pvs(data_lv, &vg_to->pvs))
+ if (!lv_is_on_pvs(data_lv, &vg_to->pvs) &&
+ !lv_is_on_pvs(seg->external_lv, &vg_to->pvs))
continue;
if ((_lv_is_in_vg(vg_to, data_lv) ||
7 years, 9 months
master - man: lvmthin clean up syntax example
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=17fb64b569742a...
Commit: 17fb64b569742a2d247f20d198a8b6facdd12a0c
Parent: c7b2654c25b8953c55638e7fab2cd0268845cbb3
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jul 27 13:13:59 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jul 27 13:13:59 2016 -0500
man: lvmthin clean up syntax example
The syntax for converting an LV to a thin LV
included an unnecessary --thin option. I was
probably still confused about these options
when writing this.
---
man/lvmthin.7.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in
index c142f56..ce86974 100644
--- a/man/lvmthin.7.in
+++ b/man/lvmthin.7.in
@@ -1173,7 +1173,7 @@ name of ExampleLV.
.B lvconvert \-\-type thin \-\-thinpool VG/ThinPoolLV
.br
.RS
-.B \-\-originname NewExternalOriginLV \-\-thin VG/ExampleLV
+.B \-\-originname NewExternalOriginLV VG/ExampleLV
.RE
.I Example
7 years, 9 months
master - lvcreate.c: respect DEFAULT_RAID_MAX_IMAGES on creation of any RaidLV
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c7b2654c25b895...
Commit: c7b2654c25b8953c55638e7fab2cd0268845cbb3
Parent: 8f62b7bfe56c25efbbff5fea26ce29ac6378f08a
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Jul 27 18:20:48 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Jul 27 18:20:48 2016 +0200
lvcreate.c: respect DEFAULT_RAID_MAX_IMAGES on creation of any RaidLV
---
tools/lvcreate.c | 23 ++++++++---------------
1 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 88e43e4..1ed39e2 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -529,25 +529,12 @@ static int _read_mirror_and_raid_params(struct cmd_context *cmd,
struct lvcreate_params *lp)
{
int pagesize = lvm_getpagesize();
- unsigned max_images;
- const char *segtype_name;
+ unsigned max_images = segtype_is_raid(lp->segtype) ? DEFAULT_RAID_MAX_IMAGES :
+ DEFAULT_MIRROR_MAX_IMAGES;
/* Common mirror and raid params */
if (arg_is_set(cmd, mirrors_ARG)) {
lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0) + 1;
- if (segtype_is_raid1(lp->segtype)) {
- segtype_name = SEG_TYPE_NAME_RAID1;
- max_images = DEFAULT_RAID_MAX_IMAGES;
- } else {
- segtype_name = SEG_TYPE_NAME_MIRROR;
- max_images = DEFAULT_MIRROR_MAX_IMAGES;
- }
-
- if (lp->mirrors > max_images) {
- log_error("Only up to %u images in %s supported currently.",
- max_images, segtype_name);
- return 0;
- }
if ((lp->mirrors > 2) && segtype_is_raid10(lp->segtype)) {
/*
@@ -571,6 +558,12 @@ static int _read_mirror_and_raid_params(struct cmd_context *cmd,
/* Default to 2 mirrored areas if '--type mirror|raid1|raid10' */
lp->mirrors = seg_is_mirrored(lp) ? 2 : 1;
+ if (max(lp->mirrors, lp->stripes) > max_images) {
+ log_error("Only up to %u images in %s supported currently.",
+ max_images, lp->segtype->name);
+ return 0;
+ }
+
lp->nosync = arg_is_set(cmd, nosync_ARG);
if (!(lp->region_size = arg_uint_value(cmd, regionsize_ARG, 0)) &&
7 years, 9 months
master - vg_validate: segment check enhancements for raids to catch bogus metadata
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8f62b7bfe56c25...
Commit: 8f62b7bfe56c25efbbff5fea26ce29ac6378f08a
Parent: 9ad30b0b38a212a51af5c25b0783cb595fa3ab76
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Jul 27 18:17:29 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Jul 27 18:17:29 2016 +0200
vg_validate: segment check enhancements for raids to catch bogus metadata
General RAID and RAID segment type specific checks are added
to merge.c. New static _check_raid_seg() is called on each segment
of a RaidLV (which have just one) from check_lv_segments().
New checks caught some unititialized segment members
which are addressed here as well:
- initialize seg->region_size to 0 in lvcreate.c for raid0/raid0_meta
- initialize list seg->origin_list in lv_manip.c
---
lib/metadata/lv_manip.c | 1 +
lib/metadata/merge.c | 248 +++++++++++++++++++++++++++++++++++++++++++++++
tools/lvcreate.c | 4 +-
3 files changed, 252 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 2a55be7..a465c4c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -949,6 +949,7 @@ struct lv_segment *alloc_lv_segment(const struct segment_type *segtype,
seg->extents_copied = extents_copied;
seg->pvmove_source_seg = pvmove_source_seg;
dm_list_init(&seg->tags);
+ dm_list_init(&seg->origin_list);
dm_list_init(&seg->thin_messages);
if (log_lv && !attach_mirror_log(seg, log_lv))
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 7aed002..8e7d107 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -14,6 +14,7 @@
*/
#include "lib.h"
+#include <defaults.h>
#include "metadata.h"
#include "lv_alloc.h"
#include "pv_alloc.h"
@@ -71,6 +72,249 @@ int lv_merge_segments(struct logical_volume *lv)
goto out
/*
+ * RAID segment property checks.
+ *
+ * Checks in here shall catch any
+ * bogus segment structure setup.
+ */
+#define raid_seg_error(msg) { \
+ log_error("LV %s invalid: %s for %s segment", \
+ seg->lv->name, (msg), lvseg_name(seg)); \
+ if ((*error_count)++ > ERROR_MAX) \
+ return; \
+}
+
+#define raid_seg_error_val(msg, val) { \
+ log_error("LV %s invalid: %s (is %u) for %s segment", \
+ seg->lv->name, (msg), (val), lvseg_name(seg)); \
+ if ((*error_count)++ > ERROR_MAX) \
+ return; \
+}
+
+/* Check raid0 segment properties in @seg */
+static void _check_raid0_seg(struct lv_segment *seg, int *error_count)
+{
+ if (seg_is_raid0_meta(seg) &&
+ !seg->meta_areas)
+ raid_seg_error("no meta areas");
+ if (!seg->stripe_size)
+ raid_seg_error("zero stripe size");
+ if (!is_power_of_2(seg->stripe_size))
+ raid_seg_error_val("non power of 2 stripe size", seg->stripe_size);
+ if (seg->region_size)
+ raid_seg_error_val("non-zero region_size", seg->region_size);
+ if (seg->writebehind)
+ raid_seg_error_val("non-zero write behind", seg->writebehind);
+ if (seg->min_recovery_rate)
+ raid_seg_error_val("non-zero min recovery rate", seg->min_recovery_rate);
+ if (seg->max_recovery_rate)
+ raid_seg_error_val("non-zero max recovery rate", seg->max_recovery_rate);
+}
+
+/* Check RAID @seg for non-zero, power of 2 region size and min recovery rate <= max */
+static void _check_raid_region_recovery(struct lv_segment *seg, int *error_count)
+{
+ if (!seg->region_size)
+ raid_seg_error("zero region_size");
+ if (!is_power_of_2(seg->region_size))
+ raid_seg_error_val("non power of 2 region size", seg->region_size);
+ /* min/max recovery rate may be zero but min may not be larger than max*/
+ if (seg->min_recovery_rate > seg->max_recovery_rate)
+ raid_seg_error_val("min recovery larger than max recovery larger", seg->min_recovery_rate);
+}
+
+/* Check raid1 segment properties in @seg */
+static void _check_raid1_seg(struct lv_segment *seg, int *error_count)
+{
+ if (!seg->meta_areas)
+ raid_seg_error("no meta areas");
+ if (seg->stripe_size)
+ raid_seg_error_val("non-zero stripe size", seg->stripe_size);
+ _check_raid_region_recovery(seg, error_count);
+}
+
+/* Check raid4/5/6/10 segment properties in @seg */
+static void _check_raid45610_seg(struct lv_segment *seg, int *error_count)
+{
+ /* Checks applying to any raid4/5/6/10 */
+ if (!seg->meta_areas)
+ raid_seg_error("no meta areas");
+ if (!seg->stripe_size)
+ raid_seg_error("zero stripe size");
+ if (!is_power_of_2(seg->stripe_size))
+ raid_seg_error_val("non power of 2 stripe size", seg->stripe_size);
+ _check_raid_region_recovery(seg, error_count);
+ /* END: checks applying to any raid4/5/6/10 */
+
+ /* Specific checks per raid level */
+ if (seg_is_raid4(seg) ||
+ seg_is_any_raid5(seg)) {
+ /*
+ * To allow for takeover between the MD raid1 and
+ * raid4/5 personalities, exactly 2 areas (i.e. DataLVs)
+ * can be mirrored by all raid1, raid4 and raid5 personalities.
+ * Hence allow a minimum of 2 areas.
+ */
+ if (seg->area_count < 2)
+ raid_seg_error_val("minimum 2 areas required", seg->area_count);
+ } else if (seg_is_any_raid6(seg)) {
+ /*
+ * FIXME: MD raid6 supports a minimum of 4 areas.
+ * LVM requests a minimum of 5 due to easier
+ * processing of SubLVs to replace.
+ *
+ * Once that obstacle got removed, allow for a minimum of 4.
+ */
+ if (seg->area_count < 5)
+ raid_seg_error_val("minimum 5 areas required", seg->area_count);
+ } else if (seg_is_raid10(seg)) {
+ /*
+ * FIXME: raid10 area_count minimum has to change to 2 once we
+ * support data_copies and odd numbers of stripes
+ */
+ if (seg->area_count < 4)
+ raid_seg_error_val("minimum 4 areas required", seg->area_count);
+ if (seg->writebehind)
+ raid_seg_error_val("non-zero writebehind", seg->writebehind);
+ }
+}
+
+/* Check any non-RAID segment struct members in @seg and increment @error_count for any bogus ones */
+static void _check_non_raid_seg_members(struct lv_segment *seg, int *error_count)
+{
+ if (seg->origin) /* snap and thin */
+ raid_seg_error("non-zero origin LV");
+ if (seg->indirect_origin) /* thin */
+ raid_seg_error("non-zero indirect_origin LV");
+ if (seg->merge_lv) /* thin */
+ raid_seg_error("non-zero merge LV");
+ if (seg->cow) /* snap */
+ raid_seg_error("non-zero cow LV");
+ if (!dm_list_empty(&seg->origin_list)) /* snap */
+ raid_seg_error("non-zero origin_list");
+ if (seg->extents_copied)
+ raid_seg_error("non-zero extents_copied");
+ if (seg->log_lv)
+ raid_seg_error("non-zero log LV");
+ if (seg->segtype_private)
+ raid_seg_error("non-zero segtype_private");
+ /* thin members */
+ if (seg->metadata_lv)
+ raid_seg_error("non-zero metadata LV");
+ if (seg->transaction_id)
+ raid_seg_error("non-zero transaction_id");
+ if (seg->zero_new_blocks)
+ raid_seg_error("non-zero zero_new_blocks");
+ if (seg->discards)
+ raid_seg_error("non-zero discards");
+ if (!dm_list_empty(&seg->thin_messages))
+ raid_seg_error("non-zero thin_messages list");
+ if (seg->external_lv)
+ raid_seg_error("non-zero external LV");
+ if (seg->pool_lv)
+ raid_seg_error("non-zero pool LV");
+ if (seg->device_id)
+ raid_seg_error("non-zero device_id");
+ /* cache members */
+ if (seg->cache_mode)
+ raid_seg_error("non-zero cache_mode");
+ if (seg->policy_name)
+ raid_seg_error("non-zero policy_name");
+ if (seg->policy_settings)
+ raid_seg_error("non-zero policy_settings");
+ if (seg->cleaner_policy)
+ raid_seg_error("non-zero cleaner_policy");
+ /* replicator members (deprecated) */
+ if (seg->replicator)
+ raid_seg_error("non-zero replicator");
+ if (seg->rlog_lv)
+ raid_seg_error("non-zero rlog LV");
+ if (seg->rlog_type)
+ raid_seg_error("non-zero rlog type");
+ if (seg->rdevice_index_highest)
+ raid_seg_error("non-zero rdevice_index_highests");
+ if (seg->rsite_index_highest)
+ raid_seg_error("non-zero rsite_index_highests");
+ /* .... more members? */
+}
+
+/*
+ * Check RAID segment sruct members of @seg for acceptable
+ * properties and increment @error_count for any bogus ones.
+ */
+static void _check_raid_seg(struct lv_segment *seg, int *error_count)
+{
+ uint32_t area_len, s;
+
+ /* General checks applying to all RAIDs */
+ if (!seg_is_raid(seg))
+ raid_seg_error("erroneous RAID check");
+
+ if (!seg->area_count)
+ raid_seg_error("zero area count");
+
+ if (!seg->areas)
+ raid_seg_error("zero areas");
+
+ /* Default still 8, change! */
+ if (seg->area_count > DEFAULT_RAID_MAX_IMAGES) {
+ log_error("LV %s invalid: maximum supported areas %u (is %u) for %s segment",
+ seg->lv->name, DEFAULT_RAID_MAX_IMAGES, seg->area_count, lvseg_name(seg));
+ if ((*error_count)++ > ERROR_MAX)
+ return;
+ }
+
+ if (seg->chunk_size)
+ raid_seg_error_val("non-zero chunk_size", seg->chunk_size);
+
+ /* FIXME: should we check any non-RAID segment struct members at all? */
+ _check_non_raid_seg_members(seg, error_count);
+
+ /* Check for any DataLV flaws like non-existing ones or size variations */
+ for (area_len = s = 0; s < seg->area_count; s++) {
+ if (seg_type(seg, s) != AREA_LV)
+ raid_seg_error("no DataLV");
+ if (!lv_is_raid_image(seg_lv(seg, s)))
+ raid_seg_error("DataLV without RAID image flag");
+ if (area_len &&
+ area_len != seg_lv(seg, s)->le_count) {
+ raid_seg_error_val("DataLV size variations",
+ seg_lv(seg, s)->le_count);
+ } else
+ area_len = seg_lv(seg, s)->le_count;
+ }
+
+ /* Check for any MetaLV flaws like non-existing ones or size variations */
+ if (seg->meta_areas)
+ for (area_len = s = 0; s < seg->area_count; s++) {
+ if (seg_metatype(seg, s) != AREA_LV)
+ raid_seg_error("no MetaLV");
+ if (!lv_is_raid_metadata(seg_metalv(seg, s)))
+ raid_seg_error("MetaLV without RAID metadata flag");
+ if (area_len &&
+ area_len != seg_metalv(seg, s)->le_count) {
+ raid_seg_error_val("MetaLV size variations",
+ seg_metalv(seg, s)->le_count);
+ } else
+ area_len = seg_metalv(seg, s)->le_count;
+ }
+ /* END: general checks applying to all RAIDs */
+
+ /* Specific segment type checks from here on */
+ if (seg_is_any_raid0(seg))
+ _check_raid0_seg(seg, error_count);
+ else if (seg_is_raid1(seg))
+ _check_raid1_seg(seg, error_count);
+ else if (seg_is_raid4(seg) ||
+ seg_is_any_raid5(seg) ||
+ seg_is_raid10(seg))
+ _check_raid45610_seg(seg, error_count);
+ else
+ raid_seg_error("bogus RAID segment type");
+}
+/* END: RAID segment property checks. */
+
+/*
* Verify that an LV's segments are consecutive, complete and don't overlap.
*/
int check_lv_segments(struct logical_volume *lv, int complete_vg)
@@ -143,6 +387,10 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
dm_list_iterate_items(seg, &lv->segments) {
seg_count++;
+
+ if (seg_is_raid(seg))
+ _check_raid_seg(seg, &error_count);
+
if (seg->le != le) {
log_error("LV %s invalid: segment %u should begin at "
"LE %" PRIu32 " (found %" PRIu32 ").",
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index a365fe9..88e43e4 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -506,7 +506,9 @@ static int _read_raid_params(struct cmd_context *cmd,
return 0;
}
- if (!seg_is_any_raid0(lp)) {
+ if (seg_is_any_raid0(lp))
+ lp->region_size = 0;
+ else {
/* Rates are recorded in kiB/sec/disk, not sectors/sec/disk */
lp->min_recovery_rate = arg_uint_value(cmd, minrecoveryrate_ARG, 0) / 2;
lp->max_recovery_rate = arg_uint_value(cmd, maxrecoveryrate_ARG, 0) / 2;
7 years, 9 months
master - tests: check we don't warn when converting to thin LV
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9ad30b0b38a212...
Commit: 9ad30b0b38a212a51af5c25b0783cb595fa3ab76
Parent: 0c3a09f1d7423c077ae513baecd2260928500ade
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 27 15:59:48 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 27 16:20:57 2016 +0200
tests: check we don't warn when converting to thin LV
Tool produced warning for non-zeroing thin-pools.
---
test/shell/lvconvert-thin-external.sh | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-thin-external.sh b/test/shell/lvconvert-thin-external.sh
index 712e368..470e87c 100644
--- a/test/shell/lvconvert-thin-external.sh
+++ b/test/shell/lvconvert-thin-external.sh
@@ -167,5 +167,13 @@ lvcreate -l100 -n thin $vg
lvconvert --yes --thin --thinpool $vg/pool $vg/thin --originname thin-origin
check lv_field $vg/thin segtype thin
check lv_field $vg/thin-origin segtype linear
+lvremove -ff $vg
+
+# Test conversion with non-zeroing thin-pool, should not WARN about zeroing
+lvcreate -l50 -n pool $vg
+lvcreate -l100 -n thin $vg
+lvconvert --yes --thin --thinpool $vg/pool $vg/thin --zero n --originname thin-origin 2>&1 | tee out
+not grep "not zeroed" out
+check lv_field $vg/pool zero ""
vgremove -ff $vg
7 years, 9 months
master - tests: adapt for new cache-pool zeroing
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0c3a09f1d7423c...
Commit: 0c3a09f1d7423c077ae513baecd2260928500ade
Parent: eaf7d06a82aef60cd4f0dec2f858998f215c4417
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jul 23 21:18:30 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 27 16:20:57 2016 +0200
tests: adapt for new cache-pool zeroing
---
test/shell/lvconvert-cache-raid.sh | 2 +-
test/shell/lvconvert-cache.sh | 4 ++--
test/shell/lvconvert-repair-cache.sh | 2 +-
test/shell/pvmove-cache-segtypes.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/shell/lvconvert-cache-raid.sh b/test/shell/lvconvert-cache-raid.sh
index 551c00f..ebb9f79 100644
--- a/test/shell/lvconvert-cache-raid.sh
+++ b/test/shell/lvconvert-cache-raid.sh
@@ -27,7 +27,7 @@ aux prepare_vg 5 80
# lvcreate RAID1 origin, lvcreate cache-pool, and lvconvert to cache
lvcreate --type raid1 -m 1 --nosync -l 2 -n $lv1 $vg
lvcreate --type cache-pool -l 1 -n ${lv1}_cachepool $vg
-lvconvert --cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
+lvconvert --cache -Zy --cachepool $vg/${lv1}_cachepool $vg/$lv1
check lv_exists $vg/${lv1}_corig_rimage_0 # ensure images are properly renamed
dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
lvremove -f $vg
diff --git a/test/shell/lvconvert-cache.sh b/test/shell/lvconvert-cache.sh
index 3bffb32..76116ea 100644
--- a/test/shell/lvconvert-cache.sh
+++ b/test/shell/lvconvert-cache.sh
@@ -73,7 +73,7 @@ lvremove -ff $vg
lvcreate -L 2 -n $lv1 $vg
lvcreate --type cache-pool -l 1 -n ${lv1}_cachepool $vg
-lvconvert --cache --cachepool $vg/${lv1}_cachepool --cachemode writeback $vg/$lv1
+lvconvert --cache --cachepool $vg/${lv1}_cachepool --cachemode writeback -Zy $vg/$lv1
check lv_field $vg/$lv1 cache_mode "writeback"
dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
@@ -81,7 +81,7 @@ dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
#lvconvert --cachepool $vg/${lv1}_cachepool --poolmetadatasize 20 "$dev3"
-fail lvconvert --type cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
+fail lvconvert --type cache --cachepool $vg/${lv1}_cachepool -Zy $vg/$lv1
# Test --splitcache leaves both cache origin and cache pool
lvconvert --splitcache $vg/$lv1
diff --git a/test/shell/lvconvert-repair-cache.sh b/test/shell/lvconvert-repair-cache.sh
index 568d66b..f907289 100644
--- a/test/shell/lvconvert-repair-cache.sh
+++ b/test/shell/lvconvert-repair-cache.sh
@@ -57,7 +57,7 @@ aux enable_dev "$dev1"
##################
lvcreate --type cache-pool -L10 $vg/cpool "$dev1"
-lvconvert -H --cachemode writethrough --cachepool $vg/cpool $lv1
+lvconvert -H --cachemode writethrough --cachepool $vg/cpool -Zy $lv1
aux disable_dev "$dev2"
diff --git a/test/shell/pvmove-cache-segtypes.sh b/test/shell/pvmove-cache-segtypes.sh
index 679997f..bd624bc 100644
--- a/test/shell/pvmove-cache-segtypes.sh
+++ b/test/shell/pvmove-cache-segtypes.sh
@@ -153,7 +153,7 @@ lvconvert --yes --type cache-pool $vg/cachepool --poolmetadata $vg/meta
# RAID for thin pool data LV
lvcreate --type raid1 -m 1 -L 8 -n thinpool $vg "$dev3" "$dev4"
# Convert thin pool data to a cached LV
-lvconvert --type cache $vg/thinpool --cachepool $vg/cachepool
+lvconvert --type cache -Zy $vg/thinpool --cachepool $vg/cachepool
# Create simple thin pool meta
lvcreate -L 2M -n meta $vg "$dev1"
# Use thin pool data LV to build a thin pool
7 years, 9 months
master - lvconvert: support --zero for full cache pool conversion.
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eaf7d06a82aef6...
Commit: eaf7d06a82aef60cd4f0dec2f858998f215c4417
Parent: 3c377f8334491421207ae91094e9d7b3be0a300f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 27 16:14:47 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 27 16:20:57 2016 +0200
lvconvert: support --zero for full cache pool conversion.
Add matching support for -Z option also we doing full conversion
to cache-pool.
Extending coversion message to show which pool type is created
and whether the metadata will be wiped or remain unmodified.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 39 ++++++++++++++++++++++++++++-----------
2 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5c09a1f..25d3b83 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.162 -
=================================
+ Support lvconvert -Zn also when doing full cache pool conversion.
Suppress not zeroing warn when converting to thin LV for non-zeroing tpool.
Fix automatic updates of PV extension headers to newest version.
Improve lvconvert --trackchanges validation to require --splitmirrors 1.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index f3586b2..62c21bd 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2851,6 +2851,7 @@ static int _lvconvert_pool(struct cmd_context *cmd,
struct id lockd_data_id;
struct id lockd_meta_id;
char metadata_name[NAME_LEN], data_name[NAME_LEN];
+ int zero_metadata = 1;
int activate_pool;
if (lp->pool_data_name) {
@@ -3091,12 +3092,26 @@ static int _lvconvert_pool(struct cmd_context *cmd,
return 0;
}
} else {
- log_warn("WARNING: Converting logical volume %s%s%s to pool's data%s.",
+ /* Only cache pool conversion may suppress metadata zeroing
+ * TODO: Maybe similar support could be useful for thin-pool, but --zero
+ * is already overloade and we would also need to possibly match transaction Id. */
+ if (segtype_is_cache_pool(lp->segtype) && metadata_lv)
+ /* Check is user requested zeroing logic via [-Z y|n] (default is yes) */
+ zero_metadata = arg_int_value(cmd, zero_ARG, 1);
+
+ log_warn("WARNING: Converting logical volume %s%s%s to %s pool's data%s %s metadata wiping.",
display_lvname(pool_lv),
metadata_lv ? " and " : "",
metadata_lv ? display_lvname(metadata_lv) : "",
- metadata_lv ? " and metadata volumes" : " volume");
- log_warn("THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)");
+ segtype_is_cache_pool(lp->segtype) ? "cache" : "thin",
+ metadata_lv ? " and metadata volumes" : " volume",
+ zero_metadata ? "with" : "WITHOUT");
+
+ if (zero_metadata)
+ log_warn("THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)");
+ else /* ATM supported only for cache pools */
+ log_warn("WARNING: Using mismatched cache pool metadata "
+ "MAY DESTROY YOUR DATA!");
if (!lp->yes &&
yes_no_prompt("Do you really want to convert %s%s%s? [y/n]: ",
@@ -3168,15 +3183,17 @@ static int _lvconvert_pool(struct cmd_context *cmd,
goto mda_write;
}
- metadata_lv->status |= LV_TEMPORARY;
- if (!activate_lv_local(cmd, metadata_lv)) {
- log_error("Aborting. Failed to activate metadata lv.");
- return 0;
- }
+ if (zero_metadata) {
+ metadata_lv->status |= LV_TEMPORARY;
+ if (!activate_lv_local(cmd, metadata_lv)) {
+ log_error("Aborting. Failed to activate metadata lv.");
+ return 0;
+ }
- if (!wipe_lv(metadata_lv, (struct wipe_params) { .do_zero = 1 })) {
- log_error("Aborting. Failed to wipe metadata lv.");
- return 0;
+ if (!wipe_lv(metadata_lv, (struct wipe_params) { .do_zero = 1 })) {
+ log_error("Aborting. Failed to wipe metadata lv.");
+ return 0;
+ }
}
}
7 years, 9 months