|
|
0d8a0a |
lib/commands/toolcontext.h | 1 +
|
|
|
0d8a0a |
tools/command-lines.in | 2 +-
|
|
|
0d8a0a |
tools/lvmcmdline.c | 14 ++++++++++++++
|
|
|
0d8a0a |
3 files changed, 16 insertions(+), 1 deletion(-)
|
|
|
0d8a0a |
|
|
|
0d8a0a |
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
|
|
|
0d8a0a |
index bc05736..da5d582 100644
|
|
|
0d8a0a |
--- a/lib/commands/toolcontext.h
|
|
|
0d8a0a |
+++ b/lib/commands/toolcontext.h
|
|
|
0d8a0a |
@@ -95,6 +95,7 @@ struct cmd_context {
|
|
|
0d8a0a |
char **argv;
|
|
|
0d8a0a |
struct arg_values *opt_arg_values;
|
|
|
0d8a0a |
struct dm_list arg_value_groups;
|
|
|
0d8a0a |
+ int opt_count; /* total number of options (beginning with - or --) */
|
|
|
0d8a0a |
|
|
|
0d8a0a |
/*
|
|
|
0d8a0a |
* Position args remaining after command name
|
|
|
0d8a0a |
diff --git a/tools/command-lines.in b/tools/command-lines.in
|
|
|
0d8a0a |
index 9d407d0..b7aefa3 100644
|
|
|
0d8a0a |
--- a/tools/command-lines.in
|
|
|
0d8a0a |
+++ b/tools/command-lines.in
|
|
|
0d8a0a |
@@ -700,7 +700,7 @@ RULE: all and lv_is_converting
|
|
|
0d8a0a |
# for compat since this was how it used to be done.
|
|
|
0d8a0a |
lvconvert LV_mirror_raid
|
|
|
0d8a0a |
OO: OO_LVCONVERT
|
|
|
0d8a0a |
-ID: lvconvert_start_poll
|
|
|
0d8a0a |
+ID: lvconvert_plain
|
|
|
0d8a0a |
DESC: Poll LV to continue conversion (also see --startpoll)
|
|
|
0d8a0a |
DESC: or waits till conversion/mirror syncing is finished
|
|
|
0d8a0a |
FLAGS: SECONDARY_SYNTAX
|
|
|
0d8a0a |
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
|
|
|
0d8a0a |
index 0600b1c..c62a66e 100644
|
|
|
0d8a0a |
--- a/tools/lvmcmdline.c
|
|
|
0d8a0a |
+++ b/tools/lvmcmdline.c
|
|
|
0d8a0a |
@@ -119,6 +119,7 @@ static const struct command_function _command_functions[CMD_COUNT] = {
|
|
|
0d8a0a |
|
|
|
0d8a0a |
/* lvconvert utility to trigger polling on an LV. */
|
|
|
0d8a0a |
{ lvconvert_start_poll_CMD, lvconvert_start_poll_cmd },
|
|
|
0d8a0a |
+ { lvconvert_plain_CMD, lvconvert_start_poll_cmd },
|
|
|
0d8a0a |
|
|
|
0d8a0a |
/* lvconvert utilities for creating/maintaining thin and cache objects. */
|
|
|
0d8a0a |
{ lvconvert_to_thinpool_CMD, lvconvert_to_pool_cmd },
|
|
|
0d8a0a |
@@ -1579,6 +1580,17 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
|
|
|
0d8a0a |
if (arg_is_set(cmd, help_ARG) || arg_is_set(cmd, help2_ARG) || arg_is_set(cmd, longhelp_ARG) || arg_is_set(cmd, version_ARG))
|
|
|
0d8a0a |
return &commands[i];
|
|
|
0d8a0a |
|
|
|
0d8a0a |
+ /*
|
|
|
0d8a0a |
+ * The 'lvconvert LV' cmd def matches any lvconvert cmd which throws off
|
|
|
0d8a0a |
+ * nearest-command partial-match suggestions. Make it a special case so
|
|
|
0d8a0a |
+ * that it won't be used as a close match. If the command has any option
|
|
|
0d8a0a |
+ * set (other than -v), don't attempt to match it to 'lvconvert LV'.
|
|
|
0d8a0a |
+ */
|
|
|
0d8a0a |
+ if (commands[i].command_enum == lvconvert_plain_CMD) {
|
|
|
0d8a0a |
+ if (cmd->opt_count - cmd->opt_arg_values[verbose_ARG].count)
|
|
|
0d8a0a |
+ continue;
|
|
|
0d8a0a |
+ }
|
|
|
0d8a0a |
+
|
|
|
0d8a0a |
match_required = 0; /* required parameters that match */
|
|
|
0d8a0a |
match_ro = 0; /* required opt_args that match */
|
|
|
0d8a0a |
match_rp = 0; /* required pos_args that match */
|
|
|
0d8a0a |
@@ -2097,6 +2109,8 @@ static int _process_command_line(struct cmd_context *cmd, int *argc, char ***arg
|
|
|
0d8a0a |
if (goval == '?')
|
|
|
0d8a0a |
return 0;
|
|
|
0d8a0a |
|
|
|
0d8a0a |
+ cmd->opt_count++;
|
|
|
0d8a0a |
+
|
|
|
0d8a0a |
/*
|
|
|
0d8a0a |
* translate the option value used by getopt into the enum
|
|
|
0d8a0a |
* value (e.g. foo_ARG) from the args array.
|