Skip to contentSkip to conversation

master - lvcreate: new validation code

PATCH Zdenek Kabelac 1 participant 1 message Oct 24, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d13239b0547e09def4b58b0f49bd0252f459d431
Commit:        d13239b0547e09def4b58b0f49bd0252f459d431
Parent:        51a29e60564d5379b38ee4688bca5eb9b844c410
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Oct 24 15:26:41 2014 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Oct 24 16:39:32 2014 +0200

lvcreate: new validation code

Refactor lvcreate code.

Prefer to use arg_outside_list_is_set() so we get automatic 'white-list' validation of supported options with different segment types.

Drop used lp->cache, lp->cache and use seg_is_cache(), seg_is_thin()

Draw clear border where is the last moment we could change create segment type.

When segment type is given with --type - do not allow it to be changed later.

Put together tests related to individual segment types.

Finish cache conversion at proper part of lv_manip code after the vg_metadata are written - so we could correcly clean-up created stripe LV for cache volume.

---
 WHATS_NEW                        |    1 +
 lib/metadata/lv_manip.c          |  364 +++++++-------
 lib/metadata/metadata-exported.h |    3 +-
 liblvm/lvm_lv.c                  |    1 -
 tools/lvcreate.c                 | 1061 ++++++++++++++++++++++----------------
 5 files changed, 799 insertions(+), 631 deletions(-)
WHATS_NEW +1 -0
index fa88ddc..320bca3 100644
@@ -1,5 +1,6 @@
 Version 2.02.112 - 
 =====================================
+  Refactor lvcreate towards more complete validation of all supported options.
   Support lvcreate --type linear.
   Improve _should_wipe_lv() to warn with message.
   Inform about temporarily created volumes only in verbose mode.
lib/metadata/lv_manip.c +181 -183

494 lines not on this page · raw message

lib/metadata/metadata-exported.h +1 -2
index 3d656b7..1100849 100644
@@ -798,9 +798,7 @@ static inline int is_change_activating(activation_change_t change)
 /* FIXME: refactor and reduce the size of this struct! */
 struct lvcreate_params {
 	/* flags */
-	int cache;
 	int snapshot; /* snap */
-	int thin; /* thin */
 	int create_pool; /* pools */
 	int zero; /* all */
 	int wipe_signatures; /* all */
@@ -809,6 +807,7 @@ struct lvcreate_params {
 	int log_count; /* mirror */
 	int nosync; /* mirror */
 	int pool_metadata_spare; /* pools */
+	int type;   /* type arg is given */
 	int temporary; /* temporary LV */
 #define ACTIVATION_SKIP_SET		0x01 /* request to set LV activation skip flag state */
 #define ACTIVATION_SKIP_SET_ENABLED	0x02 /* set the LV activation skip flag state to 'enabled' */
liblvm/lvm_lv.c +0 -1
index 76a3164..f7f1596 100644
@@ -611,7 +611,6 @@ static int _lv_set_thin_params(struct lvcreate_params *lp,
 {
 	_lv_set_default_params(lp, vg, lvname, extents);
 
-	lp->thin = 1;
 	lp->pool_name = pool_name;
 	lp->segtype = get_segtype_from_string(vg->cmd, "thin");
 
tools/lvcreate.c +616 -445

1,344 lines not on this page · raw message