diff options
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r-- | tools/lvcreate.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c index ebe6c9f46..31110b2c3 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -785,6 +785,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; @@ -1218,6 +1220,11 @@ static int _lvcreate_params(struct cmd_context *cmd, } } + if (seg_is_integrity(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; @@ -1702,6 +1709,24 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name, lp->pool_name ? : "with generated name", lp->vg_name, lp->segtype->name); } + /* + * Create an LV to hold integrity metadata when: + * + * . The user wants external (not internal) metadata. External + * is indicated by: no option set (external is default), or + * --integrity y|external. + * + * . The user did not specify an existing metadata LV with + * --integritymetadata, saved as lp->integrity_meta_name. + */ + if (seg_is_integrity(lp) && !lp->integrity_meta_name && + (!lp->integrity_arg || + !strcmp(lp->integrity_arg, "external") || + !strcmp(lp->integrity_arg, "y"))) { + if (!lv_create_integrity_metadata(cmd, vg, lp)) + 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."); @@ -1775,5 +1800,21 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv) _destroy_lvcreate_params(&lp); destroy_processing_handle(cmd, handle); + + /* + * FIXME: make this interruptible. If the user cancels the zeroing, + * they can either use the LV without it being zeroed, or can finish + * zeroing it themselves, e.g. with dd. + * + * FIXME: if the user asked for the lv to be created in inactive + * (-an) then deactivate the LV after zeroing. + */ + if (lp.post_zero_bytes) { + if (!lp.zero) + log_warn("WARNING: not zeroing LV, integrity read errors may occur."); + else + zero_lv_name(cmd, lp.vg_name, lp.lv_name, lp.post_zero_bytes); + } + return ret; } |