1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmlockd: enable lvcreate of new LV plus existing cache pool

In this command, lvcreate creates a new LV and then combines
it with an existing cache pool, producing a cache LV.  This
command was previously not allowed in in a shared VG.
This commit is contained in:
David Teigland 2018-05-30 15:24:24 -05:00
parent 27495a3555
commit c516321325
3 changed files with 13 additions and 12 deletions

View File

@ -2454,14 +2454,6 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
lv->lock_args = NULL;
return 1;
} else if (seg_is_cache(lp)) {
/*
* This should not happen because the command defs are
* checked and excluded for shared VGs early in lvcreate.
*/
log_error("Use lvconvert for cache with lock type %s", vg->lock_type);
return 0;
} else if (!seg_is_thin_volume(lp) && lp->snapshot) {
struct logical_volume *origin_lv;

View File

@ -7801,10 +7801,20 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
lv->status |= LV_TEMPORARY;
if (seg_is_cache(lp)) {
if (is_lockd_type(lv->vg->lock_type)) {
if (is_change_activating(lp->activate)) {
if (!lv_active_change(cmd, lv, CHANGE_AEY, 0)) {
log_error("Aborting. Failed to activate LV %s.",
display_lvname(lv));
goto revert_new_lv;
}
}
}
/* FIXME Support remote exclusive activation? */
/* Not yet 'cache' LV, it is stripe volume for wiping */
if (is_change_activating(lp->activate) &&
!activate_lv_excl_local(cmd, lv)) {
else if (is_change_activating(lp->activate) && !activate_lv_excl_local(cmd, lv)) {
log_error("Aborting. Failed to activate LV %s locally exclusively.",
display_lvname(lv));
goto revert_new_lv;

View File

@ -1638,8 +1638,7 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
lp->snapshot ? lp->origin_name : "", lp->segtype->name);
if (is_lockd_type(vg->lock_type)) {
if (cmd->command->command_enum == lvcreate_cache_vol_with_new_origin_CMD ||
cmd->command->command_enum == lvcreate_thin_vol_with_thinpool_or_sparse_snapshot_CMD ||
if (cmd->command->command_enum == lvcreate_thin_vol_with_thinpool_or_sparse_snapshot_CMD ||
cmd->command->command_enum == lvcreate_cache_vol_with_new_origin_or_convert_to_cache_vol_with_cachepool_CMD) {
log_error("Use lvconvert to create thin pools and cache pools in a shared VG.");
goto out;