mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-26 22:50:36 +03:00
lvcreate: use cmd defs to deny unspported lockd cases
In a shared VG, lvconvert must be used to create thin pools and cache pools, not the lvcreate variants of those commands. Deny these cases early in lvcreate using the new command defs. Denying these cases deeper in the code was missing some cleanup of the partially completed command.
This commit is contained in:
parent
d93a2bb741
commit
8e8755319c
@ -2385,6 +2385,10 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
|
||||
return 1;
|
||||
|
||||
} else if (seg_is_cache(lp) || seg_is_cache_pool(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;
|
||||
|
||||
@ -2440,6 +2444,9 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
|
||||
/*
|
||||
* Creating a thin pool and a thin lv in it. We could
|
||||
* probably make this work.
|
||||
*
|
||||
* This should not happen because the command defs are
|
||||
* checked and excluded for shared VGs early in lvcreate.
|
||||
*/
|
||||
log_error("Create thin pool and thin LV separately with lock type %s",
|
||||
vg->lock_type);
|
||||
|
@ -1634,8 +1634,18 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
|
||||
lp->snapshot ? " as snapshot of " : "",
|
||||
lp->snapshot ? lp->origin_name : "", lp->segtype->name);
|
||||
|
||||
if (is_lockd_type(vg->lock_type))
|
||||
if (is_lockd_type(vg->lock_type)) {
|
||||
if (cmd->command->command_enum == lvcreate_thin_vol_and_thinpool_CMD ||
|
||||
cmd->command->command_enum == lvcreate_cachepool_CMD ||
|
||||
cmd->command->command_enum == lvcreate_cache_vol_with_new_origin_CMD ||
|
||||
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;
|
||||
}
|
||||
|
||||
lp->needs_lockd_init = 1;
|
||||
}
|
||||
|
||||
if (!lv_create_single(vg, lp))
|
||||
goto_out;
|
||||
|
Loading…
x
Reference in New Issue
Block a user