master - lvconvert: Pass region_size to lv_raid_convert.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fdc3fcbfceb628...
Commit: fdc3fcbfceb6282312e79200286be29ae08a5765
Parent: a234cebbed19657058cdba87a5e2c23d50ff05fe
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 2 23:51:20 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 2 23:51:20 2016 +0100
lvconvert: Pass region_size to lv_raid_convert.
---
lib/metadata/metadata-exported.h | 1 +
lib/metadata/raid_manip.c | 8 ++++++--
tools/lvconvert.c | 3 ++-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index a8cbfa2..531fa03 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1201,6 +1201,7 @@ int lv_raid_convert(struct logical_volume *lv,
int yes, int force,
const unsigned stripes,
const unsigned new_stripe_size,
+ const uint32_t new_region_size,
struct dm_list *allocate_pvs);
int lv_raid_replace(struct logical_volume *lv, struct dm_list *remove_pvs,
struct dm_list *allocate_pvs);
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 0364f2f..9da05e5 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2231,6 +2231,7 @@ static struct lv_segment *_convert_striped_to_raid0(struct logical_volume *lv,
unsigned new_image_count, \
const unsigned new_stripes, \
uint32_t new_stripe_size, \
+ const uint32_t new_region_size, \
struct dm_list *allocate_pvs
typedef int (*takeover_fn_t)(TAKEOVER_FN_ARGS);
@@ -2737,6 +2738,7 @@ int lv_raid_convert(struct logical_volume *lv,
int yes, int force,
const unsigned new_stripes,
const unsigned new_stripe_size,
+ const uint32_t new_region_size,
struct dm_list *allocate_pvs)
{
struct lv_segment *seg = first_seg(lv);
@@ -2765,7 +2767,8 @@ int lv_raid_convert(struct logical_volume *lv,
/* Exit without doing activation checks if the combination isn't possible */
if (_takeover_not_possible(takeover_fn))
- return takeover_fn(lv, new_segtype, yes, force, new_image_count, new_stripes, stripe_size, allocate_pvs);
+ return takeover_fn(lv, new_segtype, yes, force, new_image_count, new_stripes, stripe_size,
+ new_region_size, allocate_pvs);
log_verbose("Converting %s from %s to %s.",
display_lvname(lv), lvseg_name(first_seg(lv)),
@@ -2795,7 +2798,8 @@ int lv_raid_convert(struct logical_volume *lv,
return 0;
}
- return takeover_fn(lv, new_segtype, yes, force, new_image_count, new_stripes, stripe_size, allocate_pvs);
+ return takeover_fn(lv, new_segtype, yes, force, new_image_count, new_stripes, stripe_size,
+ new_region_size, allocate_pvs);
}
static int _remove_partial_multi_segment_image(struct logical_volume *lv,
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index c01eec9..d5eaee4 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1900,7 +1900,8 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
log_error("RAID module does not support RAID0.");
return 0;
}
- if (!lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, lp->stripes, lp->stripe_size, lp->pvh))
+ if (!lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, lp->stripes, lp->stripe_size,
+ lp->region_size, lp->pvh))
return_0;
log_print_unless_silent("Logical volume %s successfully converted.",
display_lvname(lv));
7 years, 4 months
master - lvconvert: Preserve mirror region size with --repair.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a234cebbed1965...
Commit: a234cebbed19657058cdba87a5e2c23d50ff05fe
Parent: 415c5fd5d8e58b34fd016ba1e45dc43c6ed10e18
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 2 19:50:04 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 2 19:50:04 2016 +0100
lvconvert: Preserve mirror region size with --repair.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index aa839bd..3a64bbd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.163 -
=================================
+ Preserve existing mirror region size when using --repair.
Forbid stripe parameters with lvconvert --repair.
Unify stripe size validation into get_stripe_params to catch missing cases.
Further lvconvert validation logic refactoring.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 8444b35..c01eec9 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1365,7 +1365,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
uint32_t new_log_count)
{
uint32_t region_size;
- struct lv_segment *seg;
+ struct lv_segment *seg = first_seg(lv);
struct logical_volume *layer_lv;
uint32_t old_mimage_count = lv_mirror_count(lv);
uint32_t old_log_count = _get_log_count(lv);
@@ -1378,14 +1378,12 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
region_size = adjusted_mirror_region_size(lv->vg->extent_size,
lv->le_count,
- lp->region_size, 0,
+ lp->region_size ? : seg->region_size, 0,
vg_is_clustered(lv->vg));
if (!operable_pvs)
operable_pvs = lp->pvh;
- seg = first_seg(lv);
-
/*
* Up-convert from linear to mirror
*/
@@ -1605,6 +1603,10 @@ static int _lvconvert_mirrors_repair(struct cmd_context *cmd,
failed_mimages = _failed_mirrors_count(lv);
failed_logs = _failed_logs_count(lv);
+ /* Retain existing region size in case we need it later */
+ if (!lp->region_size)
+ lp->region_size = first_seg(lv)->region_size;
+
if (!mirror_remove_missing(cmd, lv, 0))
return_0;
7 years, 4 months
master - lvconvert: Divide into 12 categories.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=415c5fd5d8e58b...
Commit: 415c5fd5d8e58b34fd016ba1e45dc43c6ed10e18
Parent: 6361bc4734f2227f049cb6ef0335f30468c2775d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 2 16:40:33 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 2 16:44:21 2016 +0100
lvconvert: Divide into 12 categories.
---
tools/lvconvert.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 6c57191..8444b35 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -38,12 +38,10 @@
*/
struct lvconvert_params {
- /* Exactly one of these options is chosen */
+ /* Exactly one of these 12 command categories is determined */
int merge; /* Either merge_snapshot or merge_mirror is also set */
int cache;
- int corelog;
- int mirrorlog;
- int mirrors_supplied; /* When type_str is not set, this may be set with keep_mimages for --splitmirrors */
+ int keep_mimages; /* --splitmirrors */
int repair;
int replace;
int snapshot;
@@ -52,6 +50,12 @@ struct lvconvert_params {
int splitsnapshot;
int thin;
int uncache;
+ int other_conversion; /* Everything else */
+
+ int corelog; /* Equivalent to --mirrorlog core */
+ int mirrorlog; /* Only one of corelog and mirrorlog may be set */
+
+ int mirrors_supplied; /* When type_str is not set, this may be set with keep_mimages for --splitmirrors */
const char *type_str; /* When this is set, mirrors_supplied may optionally also be set */
/* Holds what you asked for based on --type or other arguments, else "" */
@@ -80,7 +84,6 @@ struct lvconvert_params {
uint32_t mirrors;
sign_t mirrors_sign;
- uint32_t keep_mimages; /* --splitmirrors */
uint32_t stripes;
uint32_t stripe_size;
uint32_t read_ahead;
@@ -629,7 +632,8 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
lp->cache + lp->thin + lp->keep_mimages + lp->snapshot + lp->replace + lp->repair > 1) {
log_error(INTERNAL_ERROR "Unexpected combination of incompatible options selected.");
return 0;
- }
+ } else
+ lp->other_conversion = 1;
/*
* Final checking of each case:
7 years, 4 months
master - lvconvert: Treat --repair as an independent case.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6361bc4734f222...
Commit: 6361bc4734f2227f049cb6ef0335f30468c2775d
Parent: 804a397643a38b9c82d22eacaca2138f2af57bec
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 2 16:21:34 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 2 16:22:12 2016 +0100
lvconvert: Treat --repair as an independent case.
---
tools/lvconvert.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 80760c6..6c57191 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -626,7 +626,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
/* We should have caught all these cases already. */
if (lp->merge + lp->splitsnapshot + lp->splitcache + lp->split + lp->uncache +
- lp->cache + lp->thin + lp->keep_mimages + lp->snapshot + lp->replace > 1) {
+ lp->cache + lp->thin + lp->keep_mimages + lp->snapshot + lp->replace + lp->repair > 1) {
log_error(INTERNAL_ERROR "Unexpected combination of incompatible options selected.");
return 0;
}
@@ -643,7 +643,8 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
* lp->keep_mimages
* lp->snapshot
* lp->replace
- * --type mirror|raid lp->repair lp->mirrorlog lp->corelog
+ * lp->repair
+ * --type mirror|raid lp->mirrorlog lp->corelog
* --type raid0|striped
*/
if (lp->merge) { /* Snapshot or mirror merge */
@@ -722,8 +723,10 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
tmp_str)))
return_0;
}
- } else if (_mirror_or_raid_type_requested(cmd, lp->type_str) ||
- lp->repair || lp->mirrorlog || lp->corelog) { /* Mirrors (and some RAID functions) */
+ } else if (lp->repair)
+ ;
+ else if (_mirror_or_raid_type_requested(cmd, lp->type_str) ||
+ lp->mirrorlog || lp->corelog) { /* Mirrors (and some RAID functions) */
if (arg_is_set(cmd, chunksize_ARG)) {
log_error("--chunksize is only available with snapshots or pools.");
return 0;
7 years, 4 months
master - lvconvert: Forbid stripe parameters with --repair.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=804a397643a38b...
Commit: 804a397643a38b9c82d22eacaca2138f2af57bec
Parent: d0d03f315bd988bab50e45c4907ab626a780e600
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 2 15:57:45 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 2 15:59:12 2016 +0100
lvconvert: Forbid stripe parameters with --repair.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 1 -
2 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2e81ab0..aa839bd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.163 -
=================================
+ Forbid stripe parameters with lvconvert --repair.
Unify stripe size validation into get_stripe_params to catch missing cases.
Further lvconvert validation logic refactoring.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index dd0102f..80760c6 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -449,7 +449,6 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
if (arg_outside_list_is_set(cmd, "cannot be used with --repair",
repair_ARG,
alloc_ARG, usepolicies_ARG,
- stripes_long_ARG, stripesize_ARG,
force_ARG, noudevsync_ARG, test_ARG,
-1))
return_0;
7 years, 4 months
master - vg_validate: correct min_recovery_rate check message
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d0d03f315bd988...
Commit: d0d03f315bd988bab50e45c4907ab626a780e600
Parent: 5765a2845600b827eab782e02250060eb4520c81
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Tue Aug 2 15:27:13 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Tue Aug 2 15:27:13 2016 +0200
vg_validate: correct min_recovery_rate check message
---
lib/metadata/merge.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index be491e3..05cef17 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -121,7 +121,7 @@ static void _check_raid_region_recovery(struct lv_segment *seg, int *error_count
/* 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);
+ raid_seg_error_val("min recovery larger than max recovery", seg->min_recovery_rate);
}
/* Check raid1 segment properties in @seg */
7 years, 4 months
master - Revert "thin: when converting a thin pool data or metadata LV from"
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c490be9134a3c5...
Commit: c490be9134a3c571636ab67d99ffeeac27d9b56f
Parent: d0df1ff995f3270232ec5179057482c558119a92
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Aug 1 15:17:44 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Aug 1 15:17:44 2016 +0100
Revert "thin: when converting a thin pool data or metadata LV from"
This reverts commit 237f84e0383c7e3003050be7c072ee0a092fd426.
This case failed:
lvcreate --type raid1 -m1 -l2 vg99
lvcreate -aey -l2 -s vg99/lvol0
lvconvert -m2 vg99/lvol0
---
lib/metadata/raid_manip.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 6ac7450..0364f2f 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -862,7 +862,7 @@ to be left for these sub-lvs.
dm_list_iterate_items(lvl, &data_lvs)
lv_set_hidden(lvl->lv);
- if (!lv_update_and_reload(lv))
+ if (!lv_update_and_reload_origin(lv))
return_0;
/*
7 years, 4 months