static int _convert_cow_snapshot(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
- if (arg_is_set(cmd, splitsnapshot_ARG))
+ if (lp->splitsnapshot)
return _convert_cow_snapshot_splitsnapshot(cmd, lv, lp);
/* FIXME: add --merge-snapshot to make this distinct from --merge-mirror. */
- if (arg_is_set(cmd, merge_ARG))
+ if (lp->merge)
return _convert_cow_snapshot_merge(cmd, lv, lp);
log_error("Operation not permitted on COW snapshot LV %s.", display_lvname(lv));
struct lvconvert_params *lp)
{
/* FIXME: add --merge-snapshot to make this distinct from --merge-mirror. */
- if (arg_is_set(cmd, merge_ARG))
+ if (lp->merge)
return _convert_thin_volume_merge(cmd, lv, lp);
log_error("Operation not permitted on thin LV %s.", display_lvname(lv));
static int _convert_thin_pool(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
- if (arg_is_set(cmd, splitcache_ARG))
+ if (lp->splitcache)
return _convert_thin_pool_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, split_ARG))
+ if (lp->split)
return _convert_thin_pool_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, uncache_ARG))
+ if (lp->uncache)
return _convert_thin_pool_uncache(cmd, lv, lp);
if (lp->cache)
return _convert_thin_pool_cache(cmd, lv, lp);
- if (arg_is_set(cmd, repair_ARG))
+ if (lp->repair)
return _convert_thin_pool_repair(cmd, lv, lp);
/* FIXME: swapping the thin pool metadata LV needs a specific option like --swapmetadata */
static int _convert_cache_volume(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
- if (arg_is_set(cmd, splitcache_ARG))
+ if (lp->splitcache)
return _convert_cache_volume_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, split_ARG))
+ if (lp->split)
return _convert_cache_volume_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, uncache_ARG))
+ if (lp->uncache)
return _convert_cache_volume_uncache(cmd, lv, lp);
if (arg_is_set(cmd, splitmirrors_ARG))
return _convert_cache_volume_splitmirrors(cmd, lv, lp);
- /* Using --thinpool is ambiguous and not preferred. */
-
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_THIN_POOL) || arg_is_set(cmd, thinpool_ARG))
+ if (segtype_is_thin_pool(lp->segtype) ||
+ arg_is_set(cmd, thinpool_ARG))
return _convert_cache_volume_thin_pool(cmd, lv, lp);
/* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */
static int _convert_cache_pool(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp)
{
- if (arg_is_set(cmd, splitcache_ARG))
+ if (lp->splitcache)
return _convert_cache_pool_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, split_ARG))
+ if (lp->split)
return _convert_cache_pool_splitcache(cmd, lv, lp);
/* FIXME: swapping the cache pool metadata LV needs a specific option like --swapmetadata */
if (arg_is_set(cmd, mirrorlog_ARG) || arg_is_set(cmd, corelog_ARG))
return _convert_mirror_log(cmd, lv, lp);
- if (arg_is_set(cmd, repair_ARG))
+ if (lp->repair)
return _convert_mirror_repair(cmd, lv, lp);
if (_linear_type_requested(lp->type_str))
if (arg_is_set(cmd, mirrors_ARG))
return _convert_raid_number(cmd, lv, lp);
- if (arg_is_set(cmd, repair_ARG))
+ if (lp->repair)
return _convert_raid_repair(cmd, lv, lp);
if (arg_is_set(cmd, replace_ARG))
if (arg_is_set(cmd, splitmirrors_ARG))
return _convert_raid_splitmirrors(cmd, lv, lp);
- if (arg_is_set(cmd, merge_ARG))
+ if (lp->merge)
return _convert_raid_merge(cmd, lv, lp);
if (!strcmp(lp->type_str, SEG_TYPE_NAME_SNAPSHOT) || arg_is_set(cmd, snapshot_ARG))
if (lp->cache)
return _convert_raid_cache(cmd, lv, lp);
- /* Using --thinpool is ambiguous and not preferred. */
-
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_THIN_POOL) || arg_is_set(cmd, thinpool_ARG))
+ if (segtype_is_thin_pool(lp->segtype) ||
+ arg_is_set(cmd, thinpool_ARG))
return _convert_raid_thin_pool(cmd, lv, lp);
- /* Using --cachepool is ambiguous and not preferred. */
-
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_CACHE_POOL) || arg_is_set(cmd, cachepool_ARG))
+ if (segtype_is_cache_pool(lp->segtype) ||
+ arg_is_set(cmd, cachepool_ARG))
return _convert_raid_cache_pool(cmd, lv, lp);
/* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */
const char *mirrors_type = find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL);
/* FIXME: add --merge-mirror to make this distinct from --merge-snapshot. */
- if (arg_is_set(cmd, merge_ARG))
+ if (lp->merge)
return _convert_striped_merge(cmd, lv, lp);
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_SNAPSHOT) || arg_is_set(cmd, snapshot_ARG))
+ if (lp->snapshot || segtype_is_snapshot(lp->segtype))
return _convert_striped_snapshot(cmd, lv, lp);
if (lp->thin)
if (lp->cache)
return _convert_striped_cache(cmd, lv, lp);
- /* Using --thinpool is ambiguous and not preferred. */
-
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_THIN_POOL) || arg_is_set(cmd, thinpool_ARG))
+ if (segtype_is_thin_pool(lp->segtype) ||
+ arg_is_set(cmd, thinpool_ARG))
return _convert_striped_thin_pool(cmd, lv, lp);
- /* Using --cachepool is ambiguous and not preferred. */
-
- if (!strcmp(lp->type_str, SEG_TYPE_NAME_CACHE_POOL) || arg_is_set(cmd, cachepool_ARG))
+ if (segtype_is_cache_pool(lp->segtype) ||
+ arg_is_set(cmd, cachepool_ARG))
return _convert_striped_cache_pool(cmd, lv, lp);
if (!strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR))