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

Fixes to lvcreate vgname processing.

This commit is contained in:
Alasdair Kergon 2004-10-15 15:53:18 +00:00
parent 45ae32da38
commit cb8920e642
2 changed files with 19 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.00.26 - Version 2.00.26 -
===================================== =====================================
Fixes to lvcreate vgname parsing.
Fix dm_name string size calculation. Fix dm_name string size calculation.
Improve clvmd error reporting during startup. Improve clvmd error reporting during startup.
Make clvmd cope with large gaps in node numbers IDs. Make clvmd cope with large gaps in node numbers IDs.

View File

@ -53,6 +53,7 @@ static int _read_name_params(struct lvcreate_params *lp,
{ {
int argc = *pargc; int argc = *pargc;
char **argv = *pargv, *ptr; char **argv = *pargv, *ptr;
char *vg_name;
if (arg_count(cmd, name_ARG)) if (arg_count(cmd, name_ARG))
lp->lv_name = arg_value(cmd, name_ARG); lp->lv_name = arg_value(cmd, name_ARG);
@ -88,7 +89,20 @@ static int _read_name_params(struct lvcreate_params *lp,
} }
} else { } else {
if (strrchr(argv[0], '/')) { vg_name = argv[0];
/* Strip dev_dir (optional) */
if (*vg_name == '/') {
while (*vg_name == '/')
vg_name++;
vg_name--;
}
if (!strncmp(vg_name, cmd->dev_dir,
strlen(cmd->dev_dir))) {
vg_name += strlen(cmd->dev_dir);
while (*vg_name == '/')
vg_name++;
}
if (strrchr(vg_name, '/')) {
log_error("Volume group name expected " log_error("Volume group name expected "
"(no slash)"); "(no slash)");
return 0; return 0;
@ -103,16 +117,16 @@ static int _read_name_params(struct lvcreate_params *lp,
extract_vgname(cmd, lp->lv_name))) extract_vgname(cmd, lp->lv_name)))
return 0; return 0;
if (strcmp(lp->vg_name, argv[0])) { if (strcmp(lp->vg_name, vg_name)) {
log_error("Inconsistent volume group " log_error("Inconsistent volume group "
"names " "names "
"given: \"%s\" and \"%s\"", "given: \"%s\" and \"%s\"",
lp->vg_name, argv[0]); lp->vg_name, vg_name);
return 0; return 0;
} }
} }
lp->vg_name = argv[0]; lp->vg_name = vg_name;
(*pargv)++, (*pargc)--; (*pargv)++, (*pargc)--;
} }
} }