All of lore.kernel.org
 help / color / mirror / Atom feed
From: wysochanski@sourceware.org <wysochanski@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 lib/metadata/lv_manip.c lib/metadata/meta ...
Date: 21 Aug 2007 16:40:34 -0000	[thread overview]
Message-ID: <20070821164034.3724.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski at sourceware.org	2007-08-21 16:40:33

Modified files:
	lib/metadata   : lv_manip.c metadata-exported.h 
	tools          : vgremove.c 

Log message:
	Prepare to move guts of vgremove into lvm library.
	Fixup force_t.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.124&r2=1.125
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgremove.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43

--- LVM2/lib/metadata/lv_manip.c	2007/08/20 20:55:26	1.124
+++ LVM2/lib/metadata/lv_manip.c	2007/08/21 16:40:33	1.125
@@ -1850,7 +1850,7 @@
 			return 0;
 		}
 
-		if (info.exists && (force == DONT_FORCE)) {
+		if (info.exists && (force == PROMPT)) {
 			if (yes_no_prompt("Do you really want to remove active "
 					  "logical volume \"%s\"? [y/n]: ",
 					  lv->name) == 'n') {
--- LVM2/lib/metadata/metadata-exported.h	2007/08/20 20:55:26	1.10
+++ LVM2/lib/metadata/metadata-exported.h	2007/08/21 16:40:33	1.11
@@ -107,9 +107,9 @@
  * Whether or not to force an operation.
  */
 typedef enum {
-	DONT_FORCE = 0,
-	FORCE_NO_CONFIRM = 1, /* skip yes/no confirmation of operation */
-	FORCE_OVERRIDE = 2 /* skip confirmation and bypass a second condition */
+	PROMPT = 0, /* Issue yes/no prompt to confirm operation */
+	DONT_PROMPT = 1, /* Skip yes/no prompt */
+	DONT_PROMPT_OVERRIDE = 2 /* Skip prompt + override a second condition */
 } force_t;
 
 struct cmd_context;
--- LVM2/tools/vgremove.c	2007/08/20 20:55:30	1.42
+++ LVM2/tools/vgremove.c	2007/08/21 16:40:33	1.43
@@ -15,37 +15,37 @@
 
 #include "tools.h"
 
-static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
-			   struct volume_group *vg, int consistent,
-			   void *handle __attribute((unused)))
+static int vg_remove_single(struct cmd_context *cmd, const char *vg_name,
+			    struct volume_group *vg, int consistent,
+			    force_t force)
 {
 	struct physical_volume *pv;
 	struct pv_list *pvl;
-	int ret = ECMD_PROCESSED;
+	int ret = 1;
 
 	if (!vg || !consistent || (vg_status(vg) & PARTIAL_VG)) {
 		log_error("Volume group \"%s\" not found or inconsistent.",
 			  vg_name);
 		log_error("Consider vgreduce --removemissing if metadata "
 			  "is inconsistent.");
-		return ECMD_FAILED;
+		return 0;
 	}
 
 	if (!vg_check_status(vg, EXPORTED_VG))
-		return ECMD_FAILED;
+		return 0;
 
 	if (vg->lv_count) {
 		log_error("Volume group \"%s\" still contains %d "
 			  "logical volume(s)", vg_name, vg->lv_count);
-		return ECMD_FAILED;
+		return 0;
 	}
 
 	if (!archive(vg))
-		return ECMD_FAILED;
+		return 0;
 
 	if (!vg_remove(vg)) {
 		log_error("vg_remove %s failed", vg_name);
-		return ECMD_FAILED;
+		return 0;
 	}
 
 	/* init physical volumes */
@@ -58,7 +58,7 @@
 
 		if (!dev_get_size(pv_dev(pv), &pv->size)) {
 			log_error("%s: Couldn't get size.", dev_name(pv_dev(pv)));
-			ret = ECMD_FAILED;
+			ret = 0;
 			continue;
 		}
 
@@ -67,19 +67,29 @@
 			log_error("Failed to remove physical volume \"%s\""
 				  " from volume group \"%s\"",
 				  dev_name(pv_dev(pv)), vg_name);
-			ret = ECMD_FAILED;
+			ret = 0;
 		}
 	}
 
 	backup_remove(cmd, vg_name);
 
-	if (ret == ECMD_PROCESSED)
+	if (ret)
 		log_print("Volume group \"%s\" successfully removed", vg_name);
 	else
 		log_error("Volume group \"%s\" not properly removed", vg_name);
 
 	return ret;
 }
+static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
+			   struct volume_group *vg, int consistent,
+			   void *handle __attribute((unused)))
+{
+	if (!vg_remove_single(cmd, vg_name, vg, consistent,
+			      arg_count(cmd, force_ARG)))
+		return ECMD_FAILED;
+
+	return ECMD_PROCESSED;
+}
 
 int vgremove(struct cmd_context *cmd, int argc, char **argv)
 {



             reply	other threads:[~2007-08-21 16:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21 16:40 wysochanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-09-24 21:30 LVM2 lib/metadata/lv_manip.c lib/metadata/meta wysochanski
2007-10-11 19:20 wysochanski
2007-12-20 22:37 agk
2008-01-17 13:13 agk
2008-01-17 13:54 agk
2008-08-05 12:05 zkabelac
2009-07-26  2:33 wysochanski
2011-04-06 21:32 jbrassow
2011-04-07 12:09 ` Zdenek Kabelac
2011-04-07 15:20   ` Jonathan Brassow
2011-04-07 20:35     ` Zdenek Kabelac
2011-04-07 21:36       ` Jonathan Brassow

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=20070821164034.3724.qmail@sourceware.org \
    --to=wysochanski@sourceware.org \
    --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.