mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-28 02:50:41 +03:00
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.
This commit is contained in:
parent
3c377f8334
commit
eaf7d06a82
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user