1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

thinpool: support lvconvert without zeroing

Since lvm does support external users of thin-pool when thin devices
are managed outside it can be useful to support conversion to
thin pool from data and metadata LV without zeroing.
TransactionID will be 0 in lvm2 metadata.

  lvconvert -Zn --thinpool vg/data --poolmetadata vg/meta
This commit is contained in:
Zdenek Kabelac 2021-03-17 19:09:58 +01:00
parent 1c3774c7a8
commit 8e7690b798

View File

@ -3086,8 +3086,8 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
/* Allow to have only thinpool active and restore it's active state. */ /* Allow to have only thinpool active and restore it's active state. */
activate_pool = to_thinpool && lv_is_active(lv); activate_pool = to_thinpool && lv_is_active(lv);
/* Wipe metadata_lv by default, but allow skipping this for cache pools. */ /* Wipe metadata_lv by default, but allow skipping on user's request. */
zero_metadata = (to_cachepool) ? arg_int_value(cmd, zero_ARG, 1) : 1; zero_metadata = arg_int_value(cmd, zero_ARG, 1);
/* An existing LV needs to have its lock freed once it becomes a data LV. */ /* An existing LV needs to have its lock freed once it becomes a data LV. */
if (vg_is_shared(vg) && lv->lock_args) { if (vg_is_shared(vg) && lv->lock_args) {
@ -3250,8 +3250,8 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
if (zero_metadata) if (zero_metadata)
log_warn("THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)"); log_warn("THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)");
else if (to_cachepool) else
log_warn("WARNING: Using mismatched cache pool metadata MAY DESTROY YOUR DATA!"); log_warn("WARNING: Using mismatched pool metadata MAY DESTROY YOUR DATA!");
if (!arg_count(cmd, yes_ARG) && if (!arg_count(cmd, yes_ARG) &&
yes_no_prompt("Do you really want to convert %s? [y/n]: ", yes_no_prompt("Do you really want to convert %s? [y/n]: ",