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

writecache: prompt before using an LV to hold cache

This commit is contained in:
David Teigland 2019-01-02 11:44:03 -06:00
parent 89c61f2018
commit 938b6b8253
2 changed files with 8 additions and 2 deletions

View File

@ -48,7 +48,7 @@ cp pattern1 $mount_dir/pattern1
umount $mount_dir
lvchange -an $vg/$lv1
lvconvert --type writecache --cachepool $lv2 $vg/$lv1
lvconvert --yes --type writecache --cachepool $lv2 $vg/$lv1
check lv_field $vg/$lv1 segtype writecache
@ -90,7 +90,7 @@ lvchange -an $vg/$lv2
# test2: create fs on LV after writecache is attached
lvconvert --type writecache --cachepool $lv2 $vg/$lv1
lvconvert --yes --type writecache --cachepool $lv2 $vg/$lv1
check lv_field $vg/$lv1 segtype writecache

View File

@ -5498,6 +5498,12 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
return 0;
}
if (!arg_is_set(cmd, yes_ARG) &&
yes_no_prompt("Erase all existing data on %s? [y/n]: ", display_lvname(lv_fast)) == 'n') {
log_error("Conversion aborted.");
return 0;
}
/* Ensure the two LVs are not active elsewhere. */
if (!lockd_lv(cmd, lv, "ex", 0))
goto_bad;