public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: wysochanski@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 test/t-pvcreate-operation.sh tools/pvcreate.c
Date: Fri, 25 Jul 2008 14:37:00 -0000	[thread overview]
Message-ID: <20080725143701.27268.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-07-25 14:36:56

Modified files:
	test           : t-pvcreate-operation.sh 
	tools          : pvcreate.c 

Log message:
	Refactor pvcreate - --force parameter.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pvcreate-operation.sh.diff?cvsroot=lvm2&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71

--- LVM2/test/t-pvcreate-operation.sh	2008/07/25 00:30:57	1.4
+++ LVM2/test/t-pvcreate-operation.sh	2008/07/25 14:36:52	1.5
@@ -45,7 +45,7 @@
 done
 
 test_expect_success \
-  'pvcreate (lvm2) fails when PV with metadatacopies=0 belongs to VG' \
+  'pvcreate (lvm2) fails without -ff when PV with metadatacopies=0 belongs to VG' \
   'pvcreate --metadatacopies 0 $d1 &&
    pvcreate --metadatacopies 1 $d2 &&
    vgcreate $vg1 $d1 $d2 &&
--- LVM2/tools/pvcreate.c	2008/07/25 14:12:29	1.70
+++ LVM2/tools/pvcreate.c	2008/07/25 14:36:55	1.71
@@ -28,6 +28,7 @@
 	uint32_t extent_count;
 	uint32_t extent_size;
 	const char *restorefile; /* 0 if no --restorefile option */
+	force_t force;
 };
 
 const char _really_init[] =
@@ -64,7 +65,7 @@
 
 	/* Allow partial & exported VGs to be destroyed. */
 	/* We must have -ff to overwrite a non orphan */
-	if (pv && !is_orphan(pv) && arg_count(cmd, force_ARG) != 2) {
+	if (pv && !is_orphan(pv) && pp->force != DONT_PROMPT_OVERRIDE) {
 		log_error("Can't initialize physical volume \"%s\" of "
 			  "volume group \"%s\" without -ff", name, pv_vg_name(pv));
 		return 0;
@@ -129,7 +130,7 @@
 	if (sigint_caught())
 		return 0;
 
-	if (pv && !is_orphan(pv) && arg_count(cmd, force_ARG)) {
+	if (pv && !is_orphan(pv) && pp->force) {
 		log_warn("WARNING: Forcing physical volume creation on "
 			  "%s%s%s%s", name,
 			  !is_orphan(pv) ? " of volume group \"" : "",
@@ -291,6 +292,8 @@
 		return 0;
 	}
 
+	pp->force = arg_count(cmd, force_ARG);
+
 	if (arg_int_value(cmd, labelsector_ARG, 0) >= LABEL_SCAN_SECTORS) {
 		log_error("labelsector must be less than %lu",
 			  LABEL_SCAN_SECTORS);


             reply	other threads:[~2008-07-25 14:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-25 14:37 wysochanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-07-25 14:59 wysochanski
2008-07-25  0:30 wysochanski

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