diff options
author | Dave Wysochanski <dwysocha@redhat.com> | 2008-01-15 22:56:30 +0000 |
---|---|---|
committer | Dave Wysochanski <dwysocha@redhat.com> | 2008-01-15 22:56:30 +0000 |
commit | 8868a4ffc27ecc26827e3ea2bf5ba52e2d5efb30 (patch) | |
tree | ebf95badec09210465990b858da8dfeb7c9d21c9 /tools/vgrename.c | |
parent | d6d46615179aba34e1f77a426e65d5e5d28ccdb4 (diff) | |
download | lvm2-8868a4ffc27ecc26827e3ea2bf5ba52e2d5efb30.tar.gz lvm2-8868a4ffc27ecc26827e3ea2bf5ba52e2d5efb30.tar.xz lvm2-8868a4ffc27ecc26827e3ea2bf5ba52e2d5efb30.zip |
Move more parameter validation into the library.
Update vgrename to call validate_vg_rename_params().
Fix vgcreate and vgsplit default arguments by adding defaults parameter to
fill_vg_create_params().
Add t-vgrename-usage.sh test.
Bugzilla: bz251992
---
tools/toollib.c | 32 ++++++++------------------------
tools/toollib.h | 5 ++---
tools/vgcreate.c | 35 +++++++++++++++++++++--------------
tools/vgrename.c | 35 ++++++-----------------------------
tools/vgsplit.c | 21 ++++++++++++++-------
5 files changed, 51 insertions(+), 77 deletions(-)
Diffstat (limited to 'tools/vgrename.c')
-rw-r--r-- | tools/vgrename.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/tools/vgrename.c b/tools/vgrename.c index 7438bb5e..0d61a19c 100644 --- a/tools/vgrename.c +++ b/tools/vgrename.c @@ -19,7 +19,6 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path, const char *new_vg_path) { char *dev_dir; - unsigned length; struct id id; int consistent = 1; int match = 0; @@ -35,25 +34,9 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path, vg_name_new = skip_dev_dir(cmd, new_vg_path, NULL); dev_dir = cmd->dev_dir; - length = strlen(dev_dir); - /* Check sanity of new name */ - if (strlen(vg_name_new) > NAME_LEN - length - 2) { - log_error("New volume group path exceeds maximum length " - "of %d!", NAME_LEN - length - 2); + if (!validate_vg_rename_params(cmd, vg_name_old, vg_name_new)) return 0; - } - - if (!validate_new_vg_name(cmd, vg_name_new)) { - log_error("New volume group name \"%s\" is invalid", - vg_name_new); - return 0; - } - - if (!strcmp(vg_name_old, vg_name_new)) { - log_error("Old and new volume group names must differ"); - return 0; - } log_verbose("Checking for existing volume group \"%s\"", vg_name_old); |