All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takahiro Yasui <tyasui@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] lvm2: honor yes and force option by lvconvert
Date: Thu, 24 Jun 2010 12:40:42 -0400	[thread overview]
Message-ID: <4C238A8A.50708@redhat.com> (raw)

This patch suppresses a following prompt by lvconvert command
when --yes or --force option is specified. 

Full resync required to convert inactive mirror <lv> to core log. Proceed? [y/n]:

This change is useful when lvconvert command is used in a script
and a test case.


Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
---
 lib/metadata/metadata-exported.h |    2 +-
 lib/metadata/mirror.c            |    5 +++--
 tools/lvconvert.c                |    4 +++-
 3 files changed, 7 insertions(+), 4 deletions(-)

Index: LVM2-2.02.68/lib/metadata/metadata-exported.h
===================================================================
--- LVM2-2.02.68.orig/lib/metadata/metadata-exported.h
+++ LVM2-2.02.68/lib/metadata/metadata-exported.h
@@ -779,7 +779,7 @@ int add_mirror_images(struct cmd_context
 struct logical_volume *detach_mirror_log(struct lv_segment *seg);
 int attach_mirror_log(struct lv_segment *seg, struct logical_volume *lv);
 int remove_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
-		      struct dm_list *removable_pvs);
+		      struct dm_list *removable_pvs, int force);
 int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
 		   uint32_t log_count, uint32_t region_size,
 		   struct dm_list *allocatable_pvs, alloc_policy_t alloc);
Index: LVM2-2.02.68/lib/metadata/mirror.c
===================================================================
--- LVM2-2.02.68.orig/lib/metadata/mirror.c
+++ LVM2-2.02.68/lib/metadata/mirror.c
@@ -1517,7 +1517,8 @@ int add_mirrors_to_segments(struct cmd_c
  */
 int remove_mirror_log(struct cmd_context *cmd,
 		      struct logical_volume *lv,
-		      struct dm_list *removable_pvs)
+		      struct dm_list *removable_pvs,
+		      int force)
 {
 	float sync_percent;
 	percent_range_t percent_range = PERCENT_0;
@@ -1541,7 +1542,7 @@ int remove_mirror_log(struct cmd_context
 		log_error("Unable to convert the log of an inactive "
 			  "cluster mirror, %s", lv->name);
 		return 0;
-	} else if (yes_no_prompt("Full resync required to convert "
+	} else if (force || yes_no_prompt("Full resync required to convert "
 				 "inactive mirror %s to core log. "
 				 "Proceed? [y/n]: ", lv->name) == 'y')
 		sync_percent = 0;
Index: LVM2-2.02.68/tools/lvconvert.c
===================================================================
--- LVM2-2.02.68.orig/tools/lvconvert.c
+++ LVM2-2.02.68/tools/lvconvert.c
@@ -719,7 +719,9 @@ static int _lv_update_log_type(struct cm
 
 	/* Remove an existing log completely */
 	if (!log_count) {
-		if (!remove_mirror_log(cmd, original_lv, operable_pvs))
+		if (!remove_mirror_log(cmd, original_lv, operable_pvs,
+				       arg_count(cmd, yes_ARG) ||
+				       arg_count(cmd, force_ARG)))
 			return_0;
 		return 1;
 	}



                 reply	other threads:[~2010-06-24 16:40 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=4C238A8A.50708@redhat.com \
    --to=tyasui@redhat.com \
    --cc=lvm-devel@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.