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/metadata/mirror.c tools/l ...
Date: Thu, 26 Jun 2008 23:05:00 -0000	[thread overview]
Message-ID: <20080626230512.18479.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-06-26 23:05:11

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : mirror.c 
	tools          : lvconvert.c 

Log message:
	Update validation of safe mirror log type conversions in lvconvert. (brassow)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.918&r2=1.919
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66

--- LVM2/WHATS_NEW	2008/06/26 21:38:57	1.918
+++ LVM2/WHATS_NEW	2008/06/26 23:05:10	1.919
@@ -1,5 +1,6 @@
 Version 2.02.39 -
 ================================
+  Update validation of safe mirror log type conversions in lvconvert.
   Fix lvconvert to disallow snapshot and mirror combinations.
   Fix reporting of LV fields alongside unallocated PV segments.
   Add --unquoted and --rows to reporting tools.
--- LVM2/lib/metadata/mirror.c	2008/06/13 12:15:55	1.72
+++ LVM2/lib/metadata/mirror.c	2008/06/26 23:05:11	1.73
@@ -1140,6 +1140,8 @@
 		      struct list *removable_pvs)
 {
 	float sync_percent;
+	struct lvinfo info;
+	struct volume_group *vg = lv->vg;
 
 	/* Unimplemented features */
 	if (list_size(&lv->segments) != 1) {
@@ -1148,10 +1150,21 @@
 	}
 
 	/* Had disk log, switch to core. */
-	if (!lv_mirror_percent(cmd, lv, 0, &sync_percent, NULL)) {
-		log_error("Unable to determine mirror sync status.");
+	if (lv_info(cmd, lv, &info, 0, 0) && info.exists) {
+		if (!lv_mirror_percent(cmd, lv, 0, &sync_percent, NULL)) {
+			log_error("Unable to determine mirror sync status.");
+			return 0;
+		}
+	} else if (vg_is_clustered(vg)) {
+		log_error("Unable to convert the log of inactive "
+			  "cluster mirror %s", lv->name);
+		return 0;
+	} else if (yes_no_prompt("Full resync required to convert "
+				 "inactive mirror %s to core log. "
+				 "Proceed? [y/n]: "))
+		sync_percent = 0;
+	else
 		return 0;
-	}
 
 	if (sync_percent >= 100.0)
 		init_mirror_in_sync(1);
@@ -1269,12 +1282,9 @@
 	return add_seg_to_segs_using_this_lv(log_lv, seg);
 }
 
-int add_mirror_log(struct cmd_context *cmd,
-		   struct logical_volume *lv,
-		   uint32_t log_count,
-		   uint32_t region_size,
-		   struct list *allocatable_pvs,
-		   alloc_policy_t alloc)
+int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
+		   uint32_t log_count, uint32_t region_size,
+		   struct list *allocatable_pvs, alloc_policy_t alloc)
 {
 	struct alloc_handle *ah;
 	const struct segment_type *segtype;
@@ -1282,17 +1292,31 @@
 	float sync_percent;
 	int in_sync;
 	struct logical_volume *log_lv;
+	struct lvinfo info;
 
 	/* Unimplemented features */
 	if (log_count > 1) {
 		log_error("log_count > 1 is not supported");
 		return 0;
 	}
+
 	if (list_size(&lv->segments) != 1) {
 		log_error("Multiple-segment mirror is not supported");
 		return 0;
 	}
 
+	/*
+	 * We are unable to convert the log of inactive cluster mirrors
+	 * due to the inability to detect whether the mirror is active
+	 * on remote nodes (even though it is inactive on this node)
+	 */
+	if (vg_is_clustered(lv->vg) &&
+	    !(lv_info(cmd, lv, &info, 0, 0) && info.exists)) {
+		log_error("Unable to convert the log of inactive "
+			  "cluster mirror %s", lv->name);
+		return 0;
+	}
+
 	if (!(parallel_areas = build_parallel_areas_from_lv(cmd, lv)))
 		return_0;
 
--- LVM2/tools/lvconvert.c	2008/06/26 21:38:58	1.65
+++ LVM2/tools/lvconvert.c	2008/06/26 23:05:11	1.66
@@ -508,6 +508,9 @@
 	}
 
 	if (lp->mirrors == existing_mirrors) {
+		/*
+		 * Convert Mirror log type
+		 */
 		original_lv = _original_lv(lv);
 		if (!first_seg(original_lv)->log_lv && !corelog) {
 			if (!add_mirror_log(cmd, original_lv, 1,


             reply	other threads:[~2008-06-26 23:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 23:05 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-08-06 15:38 jbrassow
2010-08-02 21:07 jbrassow
2010-08-02 19:03 jbrassow
2007-03-26 16:10 mbroz
2006-09-19 19:13 agk
2004-05-24 20:51 agk

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=20080626230512.18479.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).