summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2012-03-30 08:58:02 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2012-03-30 08:58:02 +0000
commit543eaed88c84aba33d3ad7179b5f28ba2bf1ba26 (patch)
tree9c521aa6849c9306e284d51cab75d2445b678ee7 /tools
parent8a81716325b3ab98d01ff4bc4bed0a1ae65d091a (diff)
downloadlvm2-543eaed88c84aba33d3ad7179b5f28ba2bf1ba26.tar.gz
lvm2-543eaed88c84aba33d3ad7179b5f28ba2bf1ba26.tar.xz
lvm2-543eaed88c84aba33d3ad7179b5f28ba2bf1ba26.zip
Detect VG name being part of the LV name in lvconvert --splitmirrors -n.
Before: devel/~ # lvconvert --splitmirrors 1 -n vg/splitted_one vg/mirrored_one Internal error: LV name vg/splitted_one has invalid form. Intermediate VG metadata write failed. After: devel/~ # lvconvert --splitmirrors 1 -n vg/splitted_one vg/mirrored_one Logical volume mirrored_one converted. devel/~ # lvconvert --splitmirrors 1 -n abc/splitted_one vg/mirrored_one Please use a single volume group name ("vg" or "abc") Run `lvconvert --help' for more information.
Diffstat (limited to 'tools')
-rw-r--r--tools/lvconvert.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 654e1158..2071f086 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -173,9 +173,19 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
}
lp->lv_split_name = arg_value(cmd, name_ARG);
- if (lp->lv_split_name &&
- !apply_lvname_restrictions(lp->lv_split_name))
- return_0;
+ if (lp->lv_split_name) {
+ if (strchr(lp->lv_split_name, '/')) {
+ if (!(lp->vg_name = extract_vgname(cmd, lp->lv_split_name)))
+ return_0;
+
+ /* Strip VG from lv_split_name */
+ if ((tmp_str = strrchr(lp->lv_split_name, '/')))
+ lp->lv_split_name = tmp_str + 1;
+ }
+
+ if (!apply_lvname_restrictions(lp->lv_split_name))
+ return_0;
+ }
lp->keep_mimages = 1;
lp->mirrors = arg_uint_value(cmd, splitmirrors_ARG, 0);