summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2017-02-08 10:52:47 -0600
committerDavid Teigland <teigland@redhat.com>2017-02-08 10:56:07 -0600
commit0d929d5a3d21dc80c69db29b57ea5ea09bdac3c5 (patch)
tree123ea750aeb93e1e733f1911d72b446036fbc116
parentc8945374d58651b33184f17dc26cb08fa8929b68 (diff)
downloadlvm2-0d929d5a3d21dc80c69db29b57ea5ea09bdac3c5.tar.gz
commands: remove debugging output
Remove the command id from the error messages.
-rw-r--r--tools/command.c4
-rw-r--r--tools/command.h2
-rw-r--r--tools/lvchange.c20
-rw-r--r--tools/lvconvert.c27
-rw-r--r--tools/lvmcmdline.c15
-rw-r--r--tools/toollib.c12
6 files changed, 31 insertions, 49 deletions
diff --git a/tools/command.c b/tools/command.c
index beebd8b9e..1dbe06ef9 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -1316,7 +1316,9 @@ int define_commands(void)
return 0;
}
- cmd = &commands[cmd_count++];
+ cmd = &commands[cmd_count];
+ cmd->command_index = cmd_count;
+ cmd_count++;
cmd->name = strdup(name);
cmd->pos_count = 1;
add_required_line(cmd, line_argc, line_argv);
diff --git a/tools/command.h b/tools/command.h
index 298488540..b3fae030c 100644
--- a/tools/command.h
+++ b/tools/command.h
@@ -170,7 +170,7 @@ struct cmd_rule {
/* a register of the lvm commands */
struct command {
const char *name;
- const char *desc; /* specific command description from command-lines.h */
+ const char *desc; /* specific command description from command-lines.in */
const char *command_id; /* ID string in command-lines.in */
int command_enum; /* <command_id>_CMD */
int command_index; /* position in commands[] */
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 2aaeb0827..1c00b76f1 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1016,9 +1016,7 @@ static int _lvchange_properties_check(struct cmd_context *cmd,
{
if (!lv_is_visible(lv)) {
if (lv_is_named_arg)
- log_error("Operation not permitted (%s %d) on hidden LV %s.",
- cmd->command->command_id, cmd->command->command_enum,
- display_lvname(lv));
+ log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
return 0;
}
@@ -1129,9 +1127,7 @@ static int _lvchange_activate_check(struct cmd_context *cmd,
{
if (!lv_is_visible(lv)) {
if (lv_is_named_arg)
- log_error("Operation not permitted (%s %d) on hidden LV %s.",
- cmd->command->command_id, cmd->command->command_enum,
- display_lvname(lv));
+ log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
return 0;
}
@@ -1185,9 +1181,7 @@ static int _lvchange_refresh_check(struct cmd_context *cmd,
{
if (!lv_is_visible(lv)) {
if (lv_is_named_arg)
- log_error("Operation not permitted (%s %d) on hidden LV %s.",
- cmd->command->command_id, cmd->command->command_enum,
- display_lvname(lv));
+ log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
return 0;
}
@@ -1367,9 +1361,7 @@ static int _lvchange_persistent_check(struct cmd_context *cmd,
{
if (!lv_is_visible(lv)) {
if (lv_is_named_arg)
- log_error("Operation not permitted (%s %d) on hidden LV %s.",
- cmd->command->command_id, cmd->command->command_enum,
- display_lvname(lv));
+ log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
return 0;
}
@@ -1385,8 +1377,8 @@ int lvchange_persistent_cmd(struct cmd_context *cmd, int argc, char **argv)
int lvchange(struct cmd_context *cmd, int argc, char **argv)
{
- log_error(INTERNAL_ERROR "Missing function for command definition %s.",
- cmd->command->command_id);
+ log_error(INTERNAL_ERROR "Missing function for command definition %d:%s.",
+ cmd->command->command_index, cmd->command->command_id);
return ECMD_FAILED;
}
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 0a0702a05..502d614e7 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3781,9 +3781,9 @@ int lvconvert_to_pool_noarg_cmd(struct cmd_context *cmd, int argc, char **argv)
return 0;
};
- log_debug("Changing command line id %s %d to standard form %s %d",
- cmd->command->command_id, cmd->command->command_enum,
- new_command->command_id, new_command->command_enum);
+ log_debug("Changing command %d:%s to standard form %d:%s",
+ cmd->command->command_index, cmd->command->command_id,
+ new_command->command_index, new_command->command_id);
/* Make the LV the first position arg. */
@@ -4060,9 +4060,9 @@ int lvconvert_swap_pool_metadata_noarg_cmd(struct cmd_context *cmd, int argc, ch
new_command = get_command(lvconvert_swap_pool_metadata_CMD);
- log_debug("Changing command line id %s %d to standard form %s %d",
- cmd->command->command_id, cmd->command->command_enum,
- new_command->command_id, new_command->command_enum);
+ log_debug("Changing command %d:%s to standard form %d:%s",
+ cmd->command->command_index, cmd->command->command_id,
+ new_command->command_index, new_command->command_id);
/* Make the LV the first position arg. */
@@ -4226,8 +4226,7 @@ static int _lvconvert_raid_types_check(struct cmd_context *cmd, struct logical_v
case thinpool_LVT:
case cachepool_LVT:
case snapshot_LVT:
- log_error("Operation not permitted (%s %d) on LV %s type %s.",
- cmd->command->command_id, cmd->command->command_enum,
+ log_error("Operation not permitted on LV %s type %s.",
display_lvname(lv), lvtype ? lvtype->name : "unknown");
return 0;
}
@@ -4235,9 +4234,7 @@ static int _lvconvert_raid_types_check(struct cmd_context *cmd, struct logical_v
return 1;
fail_hidden:
- log_error("Operation not permitted (%s %d) on hidden LV %s.",
- cmd->command->command_id, cmd->command->command_enum,
- display_lvname(lv));
+ log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
return 0;
}
@@ -4296,9 +4293,7 @@ static int _lvconvert_visible_check(struct cmd_context *cmd, struct logical_volu
int lv_is_named_arg)
{
if (!lv_is_visible(lv)) {
- log_error("Operation not permitted (%s %d) on hidden LV %s.",
- cmd->command->command_id, cmd->command->command_enum,
- display_lvname(lv));
+ log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
return 0;
}
@@ -4516,8 +4511,8 @@ int lvconvert_merge_cmd(struct cmd_context *cmd, int argc, char **argv)
int lvconvert(struct cmd_context *cmd, int argc, char **argv)
{
- log_error(INTERNAL_ERROR "Missing function for command definition %s.",
- cmd->command->command_id);
+ log_error(INTERNAL_ERROR "Missing function for command definition %d:%s.",
+ cmd->command->command_index, cmd->command->command_id);
return ECMD_FAILED;
}
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index fabfee34e..58d1a443c 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1559,8 +1559,7 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
if (best_unused_count) {
for (i = 0; i < best_unused_count; i++) {
- log_error("Invalid option for command (%s %d): %s.",
- commands[best_i].command_id, best_i,
+ log_error("Invalid option for command: %s.",
arg_long_option_name(best_unused_options[i]));
}
return NULL;
@@ -1590,8 +1589,7 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
break;
if (count >= (commands[best_i].rp_count + commands[best_i].op_count)) {
- log_error("Invalid positional argument for command (%s %d): %s.",
- commands[best_i].command_id, best_i, argv[count]);
+ log_error("Invalid positional argument for command: %s.", argv[count]);
/* FIXME: to warn/ignore, clear so it can't be used when processing. */
/*
@@ -1635,22 +1633,21 @@ out:
if (opts_match_count && (rule->rule == RULE_INVALID)) {
memset(buf, 0, sizeof(buf));
opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
- log_error("Invalid options for command (%s %d): %s",
- commands[best_i].command_id, best_i, buf);
+ log_error("Invalid options for command: %s", buf);
return NULL;
}
if (opts_unmatch_count && (rule->rule == RULE_REQUIRE)) {
memset(buf, 0, sizeof(buf));
opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
- log_error("Required options for command (%s %d): %s",
- commands[best_i].command_id, best_i, buf);
+ log_error("Required options for command: %s", buf);
return NULL;
}
}
}
- log_debug("command line id: %s %d", commands[best_i].command_id, best_i);
+ log_debug("Using command index %d id %s enum %d.",
+ best_i, commands[best_i].command_id, commands[best_i].command_enum);
return &commands[best_i];
}
diff --git a/tools/toollib.c b/tools/toollib.c
index 9dccb4e25..817faed0a 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -2688,8 +2688,8 @@ static int _check_lv_types(struct cmd_context *cmd, struct logical_volume *lv, i
return 1;
if (!val_bit_is_set(cmd->command->required_pos_args[pos-1].def.val_bits, lv_VAL)) {
- log_error(INTERNAL_ERROR "Command (%s %d) arg position %d does not permit an LV (%llx)",
- cmd->command->command_id, cmd->command->command_enum,
+ log_error(INTERNAL_ERROR "Command %d:%s arg position %d does not permit an LV (%llx)",
+ cmd->command->command_index, cmd->command->command_id,
pos, (unsigned long long)cmd->command->required_pos_args[pos-1].def.val_bits);
return 0;
}
@@ -3105,9 +3105,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
if (!_check_lv_types(cmd, lvl->lv, lv_arg_pos)) {
/* FIXME: include this result in report log? */
if (lv_is_named_arg) {
- log_error("Operation not permitted (%s %d) on LV %s.",
- cmd->command->command_id, cmd->command->command_enum,
- display_lvname(lvl->lv));
+ log_error("Operation not permitted on LV %s.", display_lvname(lvl->lv));
ret_max = ECMD_FAILED;
}
continue;
@@ -3116,9 +3114,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
if (!_check_lv_rules(cmd, lvl->lv)) {
/* FIXME: include this result in report log? */
if (lv_is_named_arg) {
- log_error("Operation not permitted (%s %d) on LV %s.",
- cmd->command->command_id, cmd->command->command_enum,
- display_lvname(lvl->lv));
+ log_error("Operation not permitted on LV %s.", display_lvname(lvl->lv));
ret_max = ECMD_FAILED;
}
continue;