diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index af756d2ce..de447fffa 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -1040,6 +1040,7 @@ struct lvcreate_params { uint64_t pool_metadata_size; /* pools */ uint32_t pool_data_extents; /* pools */ uint64_t pool_data_size; /* pools */ + int pool_data_vdo; /* pools */ uint32_t virtual_extents; /* snapshots, thins */ struct dm_list *pvh; /* all */ diff --git a/tools/args.h b/tools/args.h index 96c7210db..27759714f 100644 --- a/tools/args.h +++ b/tools/args.h @@ -608,6 +608,9 @@ arg(polloperation_ARG, '\0', "polloperation", polloperation_VAL, 0, 0, /* Not used. */ arg(pooldatasize_ARG, '\0', "pooldatasize", sizemb_VAL, 0, 0, NULL) +arg(pooldatavdo_ARG, '\0', "pooldatavdo", bool_VAL, 0, 0, + "Use VDO type volume for pool data volume.\n") + arg(poolmetadata_ARG, '\0', "poolmetadata", lv_VAL, 0, 0, "The name of a an LV to use for storing pool metadata.\n") diff --git a/tools/lvconvert.c b/tools/lvconvert.c index eaf85c20b..9a7b80ae9 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -3062,6 +3062,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd, thin_discards_t discards; thin_zero_t zero_new_blocks; int error_when_full; + int data_vdo; int is_active; int ret = 1; @@ -3185,7 +3186,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd, } if (!get_pool_params(cmd, pool_segtype, - &meta_size, &pool_metadata_spare, + &data_vdo, &meta_size, &pool_metadata_spare, &chunk_size, &discards, &zero_new_blocks)) goto_bad; diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 990764d7d..add2d6971 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -926,6 +926,7 @@ static int _lvcreate_params(struct cmd_context *cmd, #define THIN_POOL_ARGS \ discards_ARG,\ + pooldatavdo_ARG,\ thinpool_ARG #define VDO_POOL_ARGS \ @@ -1225,7 +1226,7 @@ static int _lvcreate_params(struct cmd_context *cmd, !_read_size_params(cmd, lp, lcp) || !get_stripe_params(cmd, lp->segtype, &lp->stripes, &lp->stripe_size, &lp->stripes_supplied, &lp->stripe_size_supplied) || (lp->create_pool && - !get_pool_params(cmd, lp->segtype, + !get_pool_params(cmd, lp->segtype, &lp->pool_data_vdo, &lp->pool_metadata_size, &lp->pool_metadata_spare, &lp->chunk_size, &lp->discards, &lp->zero_new_blocks)) || !_read_cache_params(cmd, lp) || diff --git a/tools/toollib.c b/tools/toollib.c index 9b4a6cd4b..1493f17e7 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -953,13 +953,27 @@ int get_activation_monitoring_mode(struct cmd_context *cmd, */ int get_pool_params(struct cmd_context *cmd, const struct segment_type *segtype, + int *pool_data_vdo, uint64_t *pool_metadata_size, int *pool_metadata_spare, uint32_t *chunk_size, thin_discards_t *discards, thin_zero_t *zero_new_blocks) { - if (segtype_is_thin_pool(segtype) || segtype_is_thin(segtype)) { + if ((*pool_data_vdo = arg_int_value(cmd, pooldatavdo_ARG, 0))) { + if (!(segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_VDO))) + return_0; + + if (activation() && segtype->ops->target_present) { + if (!segtype->ops->target_present(cmd, NULL, NULL)) { + log_error("%s: Required device-mapper target(s) not detected in your kernel.", + segtype->name); + return_0; + } + } + } + + if (segtype_is_thin_pool(segtype) || segtype_is_thin(segtype) || *pool_data_vdo) { if (arg_is_set(cmd, zero_ARG)) { *zero_new_blocks = arg_int_value(cmd, zero_ARG, 0) ? THIN_ZERO_YES : THIN_ZERO_NO; log_very_verbose("%s pool zeroing.", @@ -1011,7 +1025,6 @@ int get_pool_params(struct cmd_context *cmd, } else *pool_metadata_size = 0; - /* TODO: default in lvm.conf and metadata profile ? */ *pool_metadata_spare = arg_int_value(cmd, poolmetadataspare_ARG, DEFAULT_POOL_METADATA_SPARE); diff --git a/tools/toollib.h b/tools/toollib.h index 2b38e4e4f..c1c7c35f1 100644 --- a/tools/toollib.h +++ b/tools/toollib.h @@ -200,6 +200,7 @@ int get_activation_monitoring_mode(struct cmd_context *cmd, int get_pool_params(struct cmd_context *cmd, const struct segment_type *segtype, + int *pool_data_vdo, uint64_t *pool_metadata_size, int *pool_metadata_spare, uint32_t *chunk_size,