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

lvconvert: update for thin a cache

Major update of lvconvert code to handle cache and thin.
related targets.

Code tries to unify handling of cache and thin pools.
Better supports lvm2 syntax:

lvconvert --type cache --cachepool vg/pool vg/cache
lvconvert --type thin --thinpool vg/pool vg/extorg
lvconvert --type cache-pool vg/pool
lvconvert --type thin-pool vg/pool

as well as:

lvconvert --cache --cachepool vg/pool vg/cache
lvconvert --thin --thinpool vg/pool vg/extorg
lvconvert --cachepool vg/pool
lvconvert --thinpool vg/pool

While catching much more command line errors.
(Yet couple paths still needs more tests)

Detects as much cmdline errors prior opening VG.

Uses single lvconvert_name_params to convert LV names.

Detects as much incompatibilies in VG prior prompting.

Uses single prompt to confirm whole conversion.

TODO: still the code needs fixes...
This commit is contained in:
Zdenek Kabelac 2014-07-11 12:15:23 +02:00
parent fe3ea94e58
commit 970989655f
3 changed files with 560 additions and 497 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.108 - Version 2.02.108 -
================================= =================================
Enhance lvconvert thin, thinpool, cache and cachepool command line support.
Display 'C' only for cache and cache-pool target types in lvs. Display 'C' only for cache and cache-pool target types in lvs.
Prompt for confirmation before change LV into a snapshot exception store. Prompt for confirmation before change LV into a snapshot exception store.
Return proper error codes for some failing lvconvert funtions. Return proper error codes for some failing lvconvert funtions.

File diff suppressed because it is too large Load Diff

View File

@ -1661,18 +1661,9 @@ int get_pool_params(struct cmd_context *cmd,
{ {
int cache_pool = 0; int cache_pool = 0;
if (!strcmp("cache-pool", arg_str_value(cmd, type_ARG, "none"))) if (!strcmp("cache-pool", arg_str_value(cmd, type_ARG, "")))
cache_pool = 1; cache_pool = 1;
if (!cache_pool && !arg_count(cmd, thinpool_ARG)) {
/* Check for arguments that should only go with pools */
if (arg_count(cmd, poolmetadata_ARG)) {
log_error("'--poolmetadata' argument is only valid when"
" converting to pool LVs.");
return_0;
}
}
*passed_args = 0; *passed_args = 0;
if (!cache_pool && arg_count(cmd, zero_ARG)) { if (!cache_pool && arg_count(cmd, zero_ARG)) {
*passed_args |= PASS_ARG_ZERO; *passed_args |= PASS_ARG_ZERO;
@ -1706,14 +1697,11 @@ int get_pool_params(struct cmd_context *cmd,
return_0; return_0;
if (arg_count(cmd, poolmetadatasize_ARG)) { if (arg_count(cmd, poolmetadatasize_ARG)) {
if (arg_sign_value(cmd, poolmetadatasize_ARG, SIGN_NONE) == SIGN_MINUS) {
log_error("Negative pool metadata size is invalid.");
return 0;
}
*passed_args |= PASS_ARG_POOL_METADATA_SIZE; *passed_args |= PASS_ARG_POOL_METADATA_SIZE;
}
*pool_metadata_size = arg_uint64_value(cmd, poolmetadatasize_ARG, *pool_metadata_size = arg_uint64_value(cmd, poolmetadatasize_ARG,
UINT64_C(0)); UINT64_C(0));
} else if (arg_count(cmd, poolmetadata_ARG))
*passed_args |= PASS_ARG_POOL_METADATA_SIZE; /* fixed size */
return 1; return 1;
} }