summaryrefslogtreecommitdiff
path: root/tools/lvcreate.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r--tools/lvcreate.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 4a1534cc2..1ab5de6f6 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -792,6 +792,8 @@ static int _lvcreate_params(struct cmd_context *cmd,
mirror_default_cfg = (arg_uint_value(cmd, stripes_ARG, 1) > 1)
? global_raid10_segtype_default_CFG : global_mirror_segtype_default_CFG;
segtype_str = find_config_tree_str(cmd, mirror_default_cfg, NULL);
+ } else if (arg_is_set(cmd, integrity_ARG)) {
+ segtype_str = SEG_TYPE_NAME_INTEGRITY;
} else
segtype_str = SEG_TYPE_NAME_STRIPED;
@@ -826,6 +828,8 @@ static int _lvcreate_params(struct cmd_context *cmd,
readahead_ARG,\
setactivationskip_ARG,\
test_ARG,\
+ integrity_ARG,\
+ integritysettings_ARG,\
type_ARG
#define CACHE_POOL_ARGS \
@@ -1225,6 +1229,11 @@ static int _lvcreate_params(struct cmd_context *cmd,
}
}
+ if (seg_is_integrity(lp) || seg_is_raid(lp)) {
+ if (!get_integrity_options(cmd, &lp->integrity_arg, &lp->integrity_meta_name, &lp->integrity_settings))
+ return 0;
+ }
+
lcp->pv_count = argc;
lcp->pvs = argv;
@@ -1582,6 +1591,13 @@ static int _check_zero_parameters(struct cmd_context *cmd, struct lvcreate_param
if (seg_is_thin(lp))
return 1;
+ if (seg_is_integrity(lp)) {
+ if (lp->zero && !is_change_activating(lp->activate)) {
+ log_error("Zeroing integrity is not compatible with inactive creation (-an).");
+ return 0;
+ }
+ }
+
/* If there is some problem, buffer will not be empty */
if (dm_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s",
lp->origin_name ? "origin " : "",
@@ -1709,6 +1725,16 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
lp->pool_name ? : "with generated name", lp->vg_name, lp->segtype->name);
}
+ if (seg_is_integrity(lp) && lp->integrity_arg &&
+ !strcmp(lp->integrity_arg, "internal")) {
+ log_warn("WARNING: integrity cannot be removed from LV with internal metadata.");
+ if (!arg_count(cmd, yes_ARG) &&
+ (yes_no_prompt("Create LV with internal integrity metadata?") == 'n')) {
+ log_error("LV not created.");
+ goto_out;
+ }
+ }
+
if (vg->lock_type && !strcmp(vg->lock_type, "sanlock")) {
if (!handle_sanlock_lv(cmd, vg)) {
log_error("No space for sanlock lock, extend the internal lvmlock LV.");
@@ -1782,5 +1808,6 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
_destroy_lvcreate_params(&lp);
destroy_processing_handle(cmd, handle);
+
return ret;
}