[lvm-devel] [PATCH 2/9] Refactor vgsplit to move existing_vg logic in a separate 'if' statement.

Dave Wysochanski dwysocha at redhat.com
Thu Aug 13 21:26:56 UTC 2009


This will aid in future refactorings and allow for us to reorder the source
and destination vg based on alphabetical names.
Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha at redhat.com>
---
 tools/vgsplit.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 35c425a..fd4099f 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -290,6 +290,11 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
 			goto bad2;
 		}
 
+	} else if (vg_read_error(vg_to) == SUCCESS) {
+		existing_vg = 0;
+	}
+
+	if (existing_vg) {
 		if (new_vg_option_specified(cmd)) {
 			log_error("Volume group \"%s\" exists, but new VG "
 				    "option specified", vg_name_to);
@@ -297,9 +302,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
 		}
 		if (!vgs_are_compatible(cmd, vg_from,vg_to))
 			goto_bad;
-	} else if (vg_read_error(vg_to) == SUCCESS) {
-		existing_vg = 0;
-
+	} else {
 		vp_def.vg_name = NULL;
 		vp_def.extent_size = vg_from->extent_size;
 		vp_def.max_pv = vg_from->max_pv;
-- 
1.6.0.6




More information about the lvm-devel mailing list