mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvconvert: use cmd_context variable
Do not modify flags field from 'strcut command_name' and instead control this via cmd_context get_vgname_from_options. Flag GET_VGNAME_FROM_OPTIONS is currently used only by lvconvert.
This commit is contained in:
parent
1bb03cff66
commit
ecabdf68cf
@ -216,6 +216,7 @@ struct cmd_context {
|
|||||||
unsigned device_ids_check_hostname:1;
|
unsigned device_ids_check_hostname:1;
|
||||||
unsigned device_ids_refresh_trigger:1;
|
unsigned device_ids_refresh_trigger:1;
|
||||||
unsigned device_ids_invalid:1;
|
unsigned device_ids_invalid:1;
|
||||||
|
unsigned get_vgname_from_options:1; /* used by lvconvert */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Devices and filtering.
|
* Devices and filtering.
|
||||||
|
@ -5449,7 +5449,7 @@ static int _lvconvert_merge_mirror_images_single(struct cmd_context *cmd,
|
|||||||
int lvconvert_merge_mirror_images_cmd(struct cmd_context *cmd, int argc, char **argv)
|
int lvconvert_merge_mirror_images_cmd(struct cmd_context *cmd, int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* arg can be a VG name, which is the standard option usage */
|
/* arg can be a VG name, which is the standard option usage */
|
||||||
cmd->cname->flags &= ~GET_VGNAME_FROM_OPTIONS;
|
cmd->get_vgname_from_options = 0;
|
||||||
|
|
||||||
return process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE,
|
return process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE,
|
||||||
NULL, &_lvconvert_visible_check, &_lvconvert_merge_mirror_images_single);
|
NULL, &_lvconvert_visible_check, &_lvconvert_merge_mirror_images_single);
|
||||||
@ -5489,7 +5489,7 @@ int lvconvert_merge_cmd(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
|
|
||||||
handle->custom_handle = &lr;
|
handle->custom_handle = &lr;
|
||||||
|
|
||||||
cmd->cname->flags &= ~GET_VGNAME_FROM_OPTIONS;
|
cmd->get_vgname_from_options = 0;
|
||||||
|
|
||||||
ret = process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE,
|
ret = process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE,
|
||||||
handle, NULL, &_lvconvert_merge_generic_single);
|
handle, NULL, &_lvconvert_merge_generic_single);
|
||||||
@ -6399,7 +6399,7 @@ int lvconvert_to_writecache_cmd(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
|
|
||||||
handle->custom_handle = &lr;
|
handle->custom_handle = &lr;
|
||||||
|
|
||||||
cmd->cname->flags &= ~GET_VGNAME_FROM_OPTIONS;
|
cmd->get_vgname_from_options = 0;
|
||||||
|
|
||||||
ret = process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE, handle, NULL,
|
ret = process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE, handle, NULL,
|
||||||
&lvconvert_writecache_attach_single);
|
&lvconvert_writecache_attach_single);
|
||||||
@ -6422,7 +6422,7 @@ int lvconvert_to_cache_with_cachevol_cmd(struct cmd_context *cmd, int argc, char
|
|||||||
|
|
||||||
handle->custom_handle = &lr;
|
handle->custom_handle = &lr;
|
||||||
|
|
||||||
cmd->cname->flags &= ~GET_VGNAME_FROM_OPTIONS;
|
cmd->get_vgname_from_options = 0;
|
||||||
|
|
||||||
ret = process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE, handle, NULL,
|
ret = process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE, handle, NULL,
|
||||||
&lvconvert_cachevol_attach_single);
|
&lvconvert_cachevol_attach_single);
|
||||||
@ -6528,7 +6528,7 @@ int lvconvert_integrity_cmd(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
/* Want to be able to remove integrity from partial LV */
|
/* Want to be able to remove integrity from partial LV */
|
||||||
cmd->handles_missing_pvs = 1;
|
cmd->handles_missing_pvs = 1;
|
||||||
|
|
||||||
cmd->cname->flags &= ~GET_VGNAME_FROM_OPTIONS;
|
cmd->get_vgname_from_options = 0;
|
||||||
|
|
||||||
ret = process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE, handle, NULL,
|
ret = process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE, handle, NULL,
|
||||||
&_lvconvert_integrity_single);
|
&_lvconvert_integrity_single);
|
||||||
|
@ -3161,6 +3161,8 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
if (!(cmd->cname = find_command_name(cmd->name)))
|
if (!(cmd->cname = find_command_name(cmd->name)))
|
||||||
return ENO_SUCH_CMD;
|
return ENO_SUCH_CMD;
|
||||||
|
|
||||||
|
cmd->get_vgname_from_options = (cmd->cname->flags & GET_VGNAME_FROM_OPTIONS) ? 1 : 0;
|
||||||
|
|
||||||
if (!_process_command_line(cmd, &argc, &argv)) {
|
if (!_process_command_line(cmd, &argc, &argv)) {
|
||||||
log_error("Error during parsing of command line.");
|
log_error("Error during parsing of command line.");
|
||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
|
@ -4014,7 +4014,7 @@ int process_each_lv(struct cmd_context *cmd,
|
|||||||
/*
|
/*
|
||||||
* Find any LVs, VGs or tags explicitly provided on the command line.
|
* Find any LVs, VGs or tags explicitly provided on the command line.
|
||||||
*/
|
*/
|
||||||
if (cmd->cname->flags & GET_VGNAME_FROM_OPTIONS)
|
if (cmd->get_vgname_from_options)
|
||||||
ret = _get_arg_lvnames_using_options(cmd, argc, argv, &arg_vgnames, &arg_lvnames, &arg_tags);
|
ret = _get_arg_lvnames_using_options(cmd, argc, argv, &arg_vgnames, &arg_lvnames, &arg_tags);
|
||||||
else
|
else
|
||||||
ret = _get_arg_lvnames(cmd, argc, argv, one_vgname, one_lvname, &arg_vgnames, &arg_lvnames, &arg_tags);
|
ret = _get_arg_lvnames(cmd, argc, argv, one_vgname, one_lvname, &arg_vgnames, &arg_lvnames, &arg_tags);
|
||||||
|
Loading…
Reference in New Issue
Block a user