diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2016-07-27 13:36:25 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-07-27 16:20:57 +0200 |
commit | 5636bfd83d54f119d313603f4f9070bf0dfba2fe (patch) | |
tree | 8bfb62579b5d3e2b2652636c9c346a49c7ee9e51 | |
parent | f66ae6e80f37e83d6e71f93127b60978801dc445 (diff) | |
download | lvm2-5636bfd83d54f119d313603f4f9070bf0dfba2fe.tar.gz |
lvconvert: suppress zeroing warning when converting to thin
When volume was lvconvert-ed to a thin-volume with external origin,
then in case thin-pool was in non-zeroing mode
it's been printing WARNING about not zeroing thin volume - but
this is wanted and expected - so nothing to warn about.
So in this particular use case WARNING needs to be suppressed.
Adding parameter support for lvcreate_params.
So now lvconvert creates 'normal thin LV' in read-only mode
(so any read will 'return 0' for a moment)
then deactivate regular thin LV and reacreate in 'final R/RW' mode
thin LV with external origin and activate again.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | lib/metadata/lv_manip.c | 2 | ||||
-rw-r--r-- | lib/metadata/metadata-exported.h | 1 | ||||
-rw-r--r-- | tools/lvconvert.c | 5 |
4 files changed, 7 insertions, 2 deletions
@@ -1,5 +1,6 @@ Version 2.02.162 - ================================= + 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. Add note about lastlog built-in command to lvm man page. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index c6b8eb536..2a55be7e7 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -7592,7 +7592,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, goto deactivate_and_revert_new_lv; } - if (_should_wipe_lv(lp, lv, 1)) { + if (_should_wipe_lv(lp, lv, !lp->suppress_zero_warn)) { if (!wipe_lv(lv, (struct wipe_params) { .do_zero = lp->zero, diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 37d4bf837..ff879bbe3 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -922,6 +922,7 @@ struct lvcreate_params { #define THIN_CHUNK_SIZE_CALC_METHOD_GENERIC 0x01 #define THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE 0x02 int thin_chunk_size_calc_policy; + unsigned suppress_zero_warn : 1; unsigned needs_lockd_init : 1; const char *vg_name; /* only-used when VG is not yet opened (in /tools) */ diff --git a/tools/lvconvert.c b/tools/lvconvert.c index c0838d18c..be7425f1e 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -2679,6 +2679,7 @@ static int _lvconvert_thin(struct cmd_context *cmd, .lv_name = lp->origin_name, .major = -1, .minor = -1, + .suppress_zero_warn = 1, /* Suppress warning for this thin */ .permission = LVM_READ, .pool_name = pool_lv->name, .pvh = &vg->pvs, @@ -2735,7 +2736,9 @@ static int _lvconvert_thin(struct cmd_context *cmd, if (!archive(vg)) return_0; - /* New thin LV needs to be created (all messages sent to pool) */ + /* New thin LV needs to be created (all messages sent to pool) + * In this case thin volume is created READ-ONLY and + * also warn about not zeroing is suppressed. */ if (!(torigin_lv = lv_create_single(vg, &lvc))) return_0; |