1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Detect invalid LV names in arg lists.

This commit is contained in:
Alasdair Kergon 2004-05-05 18:31:38 +00:00
parent 21cd8adc80
commit e3adcd79d3
2 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.00.16 - Version 2.00.16 -
============================= =============================
Detect invalid LV names in arg lists.
Reporting uses line-at-a-time output. Reporting uses line-at-a-time output.
lvm2 format sets unlimited_vols format flag. lvm2 format sets unlimited_vols format flag.
Internal-only metadata flag support. Internal-only metadata flag support.

View File

@ -30,6 +30,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
int process_lv = 0; int process_lv = 0;
int tags_supplied = 0; int tags_supplied = 0;
int lvargs_supplied = 0; int lvargs_supplied = 0;
int lvargs_matched = 0;
struct lv_list *lvl; struct lv_list *lvl;
@ -66,9 +67,11 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
process_lv = 1; process_lv = 1;
/* LV name match? */ /* LV name match? */
if (!process_lv && lvargs_supplied && if (lvargs_supplied &&
str_list_match_item(arg_lvnames, lvl->lv->name)) str_list_match_item(arg_lvnames, lvl->lv->name)) {
process_lv = 1; process_lv = 1;
lvargs_matched++;
}
if (!process_lv) if (!process_lv)
continue; continue;
@ -78,6 +81,12 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
ret_max = ret; ret_max = ret;
} }
if (lvargs_supplied && lvargs_matched != list_size(arg_lvnames)) {
log_error("One or more specified logical volume(s) not found.");
if (ret_max < ECMD_FAILED)
ret_max = ECMD_FAILED;
}
return ret_max; return ret_max;
} }
@ -482,6 +491,8 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
if (!validate_name(tagname)) { if (!validate_name(tagname)) {
log_error("Skipping invalid tag %s", log_error("Skipping invalid tag %s",
tagname); tagname);
if (ret_max < EINVALID_CMD_LINE)
ret_max = EINVALID_CMD_LINE;
continue; continue;
} }
if (!str_list_add(cmd->mem, &tags, if (!str_list_add(cmd->mem, &tags,