1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2016-07-27 13:36:25 +02:00
parent f66ae6e80f
commit 5636bfd83d
4 changed files with 7 additions and 2 deletions

View File

@ -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.

View File

@ -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,

View File

@ -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) */

View File

@ -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;