public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/report/report.c tools/vgs ...
Date: Mon, 29 Jan 2007 23:01:00 -0000	[thread overview]
Message-ID: <20070129230119.32034.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2007-01-29 23:01:18

Modified files:
	.              : WHATS_NEW 
	lib/report     : report.c 
	tools          : vgsplit.c 

Log message:
	Fix vgsplit to handle mirrors.
	Reorder fields in reporting field definitions.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.564&r2=1.565
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22

--- LVM2/WHATS_NEW	2007/01/27 02:09:05	1.564
+++ LVM2/WHATS_NEW	2007/01/29 23:01:17	1.565
@@ -1,5 +1,7 @@
 Version 2.02.21 -
 ===================================
+  Fix vgsplit to handle mirrors.
+  Reorder fields in reporting field definitions.
   Fix vgs to treat args as VGs even when PV fields are displayed.
   Fix md signature check to handle both endiannesses.
 
--- LVM2/lib/report/report.c	2007/01/24 16:51:24	1.54
+++ LVM2/lib/report/report.c	2007/01/29 23:01:18	1.55
@@ -868,11 +868,11 @@
 
 #define STR DM_REPORT_FIELD_TYPE_STRING
 #define NUM DM_REPORT_FIELD_TYPE_NUMBER
-#define FIELD(type, strct, sorttype, head, field, width, func, id, desc) {type, id, (off_t)((void *)&_dummy._ ## strct.field - (void *)&_dummy._ ## strct), head, width, sorttype, &_ ## func ## _disp, desc},
+#define FIELD(type, strct, sorttype, head, field, width, func, id, desc) {type, sorttype, (off_t)((void *)&_dummy._ ## strct.field - (void *)&_dummy._ ## strct), width, id, head, &_ ## func ## _disp, desc},
 
 static struct dm_report_field_type _fields[] = {
 #include "columns.h"
-{0, "", 0, "", 0, 0, NULL, NULL},
+{0, 0, 0, 0, "", "", NULL, NULL},
 };
 
 #undef STR
--- LVM2/tools/vgsplit.c	2007/01/09 21:12:41	1.21
+++ LVM2/tools/vgsplit.c	2007/01/29 23:01:18	1.22
@@ -72,6 +72,9 @@
 		if ((lv->status & SNAPSHOT))
 			continue;
 
+		if ((lv->status & MIRRORED))
+			continue;
+
 		/* Ensure all the PVs used by this LV remain in the same */
 		/* VG as each other */
 		vg_with = NULL;
@@ -161,6 +164,48 @@
 	return 1;
 }
 
+static int _move_mirrors(struct volume_group *vg_from,
+			 struct volume_group *vg_to)
+{
+	struct list *lvh, *lvht;
+	struct logical_volume *lv;
+	struct lv_segment *seg;
+	int i, seg_in, log_in;
+
+	list_iterate_safe(lvh, lvht, &vg_from->lvs) {
+		lv = list_item(lvh, struct lv_list)->lv;
+
+		if (!(lv->status & MIRRORED))
+			continue;
+
+		seg = first_seg(lv); 
+
+		seg_in = 0;
+		for (i = 0; i < seg->area_count; i++)
+			if (_lv_is_in_vg(vg_to, seg_lv(seg, i)))
+			    seg_in++;
+
+		log_in = (!seg->log_lv || _lv_is_in_vg(vg_to, seg->log_lv));
+		
+		if ((seg_in && seg_in < seg->area_count) || 
+		    (seg_in && seg->log_lv && !log_in) || 
+		    (!seg_in && seg->log_lv && log_in)) {
+			log_error("Mirror %s split", lv->name);
+			return 0;
+		}
+
+		if (seg_in == seg->area_count && log_in) {
+			list_del(lvh);
+			list_add(&vg_to->lvs, lvh);
+
+			vg_from->lv_count--;
+			vg_to->lv_count++;
+		}
+	}
+
+	return 1;
+}
+
 int vgsplit(struct cmd_context *cmd, int argc, char **argv)
 {
 	char *vg_name_from, *vg_name_to;
@@ -275,6 +320,10 @@
 	if (!(_move_snapshots(vg_from, vg_to)))
 		goto error;
 
+	/* Move required mirrors across */
+	if (!(_move_mirrors(vg_from, vg_to)))
+		goto error;
+
 	/* FIXME Split mdas properly somehow too! */
 	/* Currently we cheat by sharing the format instance and relying on 
 	 * vg_write to ignore mdas outside the VG!  Done this way, with text 


                 reply	other threads:[~2007-01-29 23:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070129230119.32034.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).