[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [patch 2/3] Update vgsplit to only restrict split with active LVs involved in split.



Existing code will reject a vgsplit if any LVs in the source VG are active.
This patch updates vgsplit to only check LVs involved in the split.

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

diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 78d008c..9935508 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -100,6 +100,11 @@ static int _move_one_lv(struct volume_group *vg_from,
 	struct logical_volume *lv;
 
 	lv = list_item(lvh, struct lv_list)->lv;
+	if (lv_is_active(lv)) {
+		log_error("Logical volume \"%s\" must be inactive", lv->name);
+		return 0;
+	}
+
 	list_del(lvh);
 	list_add(&vg_to->lvs, lvh);
 	
@@ -285,7 +290,6 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
 	char *vg_name_from, *vg_name_to;
 	struct volume_group *vg_to, *vg_from;
 	int opt;
-	int active;
 	int existing_vg;
 	int consistent;
 	const char *lv_name;
@@ -324,14 +328,6 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
 				       CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
 		 return ECMD_FAILED;
 
-	if ((active = lvs_in_vg_activated(vg_from))) {
-		/* FIXME Remove this restriction */
-		log_error("Logical volumes in \"%s\" must be inactive",
-			  vg_name_from);
-		unlock_vg(cmd, vg_name_from);
-		return ECMD_FAILED;
-	}
-
 	log_verbose("Checking for new volume group \"%s\"", vg_name_to);
 	if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE | LCK_NONBLOCK)) {
 		log_error("Can't get lock for %s", vg_name_to);
-- 
1.5.3.4

-- 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]