]> sourceware.org Git - lvm2.git/commitdiff
lvconvert: thin errorwhenfull and recalculation
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 16 Feb 2021 23:10:32 +0000 (00:10 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 17 Feb 2021 10:21:35 +0000 (11:21 +0100)
When converting an existing LV to thin-pool,
user may now pass also '--errorwhenfull' option
like with 'lvcreate'.

Also recalculate chunksize when performace profile is
used with conversion (again matching lvcreate).

Adds missing flagging for uncropped metadata sizes.

tools/command-lines.in
tools/lvconvert.c

index c5c93abd3b276cf20d3034edd645d5e4cff03e10..7c7551405f7136bd44e610afd933f47af55268b6 100644 (file)
@@ -318,6 +318,8 @@ OO_LVCONVERT_POOL: --poolmetadata LV, --poolmetadatasize SizeMB,
 --poolmetadataspare Bool, --readahead Readahead, --chunksize SizeKB,
 --zero Bool, --metadataprofile String
 
+OO_LVCONVERT_THIN: --discards Discards --errorwhenfull Bool
+
 OO_LVCONVERT_CACHE: --cachemetadataformat CacheMetadataFormat,
 --cachemode CacheMode, --cachepolicy String,
 --cachesettings String, --zero Bool
@@ -514,7 +516,7 @@ RULE: all and lv_is_visible
 
 lvconvert --type thin-pool LV_linear_striped_raid_cache
 OO: --stripes_long Number, --stripesize SizeKB,
---discards Discards, OO_LVCONVERT_POOL, OO_LVCONVERT
+OO_LVCONVERT_THIN, OO_LVCONVERT_POOL, OO_LVCONVERT
 OP: PV ...
 ID: lvconvert_to_thinpool
 DESC: Convert LV to type thin-pool.
@@ -546,7 +548,7 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
 
 lvconvert --thinpool LV_linear_striped_raid_cache_thinpool
 OO: --type thin-pool, --stripes_long Number, --stripesize SizeKB,
---discards Discards, OO_LVCONVERT_POOL, OO_LVCONVERT
+OO_LVCONVERT_THIN, OO_LVCONVERT_POOL, OO_LVCONVERT
 OP: PV ...
 ID: lvconvert_to_thinpool_or_swap_metadata
 DESC: Convert LV to type thin-pool (variant, use --type thin-pool).
index 77afaf48786488bfce87af6fb756fff40ea1c8b5..8df30ff02505275b1a1d3041a9bbcf277f66693b 100644 (file)
@@ -3054,6 +3054,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
        thin_crop_metadata_t crop_metadata;
        thin_discards_t discards;
        thin_zero_t zero_new_blocks;
+       int error_when_full;
        int r = 0;
 
        /* for handling lvmlockd cases */
@@ -3428,6 +3429,18 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
                seg->chunk_size = chunk_size;
                seg->discards = discards;
                seg->zero_new_blocks = zero_new_blocks;
+               if (crop_metadata == THIN_CROP_METADATA_NO)
+                       pool_lv->status |= LV_CROP_METADATA;
+               if (!recalculate_pool_chunk_size_with_dev_hints(pool_lv, chunk_calc))
+                       goto_bad;
+
+               /* Error when full */
+               if (arg_is_set(cmd, errorwhenfull_ARG))
+                       error_when_full = arg_uint_value(cmd, errorwhenfull_ARG, 0);
+               else
+                       error_when_full = find_config_tree_bool(cmd, activation_error_when_full_CFG, vg->profile);
+               if (error_when_full)
+                       pool_lv->status |= LV_ERROR_WHEN_FULL;
        }
 
        /*
This page took 0.040944 seconds and 5 git commands to generate.