summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-08-04 11:40:27 -0500
committerDavid Teigland <teigland@redhat.com>2016-08-04 11:40:27 -0500
commita367a09ce24de8262f4f36ebc2ec25044534aca2 (patch)
tree9dee4203fc341dbbb98fb2ec73176c174c9399a2
parent4a15abe865c7087de5505388e9757623da282311 (diff)
downloadlvm2-dev-dct-lvconvert-type-check.tar.gz
lvconvert: sanity check for operation routingdev-dct-lvconvert-type-check
Determining the operation is based on comparing the existing LV type and the new LV type. Check that the new LV type is set correctly when reading params, otherwise the wrong operation is performed.
-rw-r--r--tools/lvconvert.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 8ea293de9..eef561312 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -4409,6 +4409,9 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
if (lp->snapshot)
lp->zero = (lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? 0 : arg_int_value(cmd, zero_ARG, 1);
+ if (arg_is_set(cmd, type_ARG) && strcmp(lp->type_str, arg_str_value(cmd, type_ARG, NULL)))
+ log_error(INTERNAL_ERROR "Cannot determine correct operation with type %s expected %s.", lp->type_str, arg_str_value(cmd, type_ARG, NULL));
+
/*
* Each LV type that can be converted.
* (The existing type of the LV, not a requested type.)