public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: mbroz@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW tools/lvcreate.c tools/lvresize.c
Date: Wed, 04 Nov 2009 14:47:00 -0000	[thread overview]
Message-ID: <20091104144729.29830.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-11-04 14:47:28

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c lvresize.c 

Log message:
	Fix lvcreate processing of %PVS argument.
	
	- fix missing unlocking of VG
	lvcreate -l 100%PVS -n lv1 vg_test
	Please specify physical volume(s) with %PVS
	Internal error: Volume Group vg_test was not unlocked
	
	- if no PVS specified, use all available
	
	Fix segfault if %PVS in lvresize without PVs list.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1313&r2=1.1314
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.209&r2=1.210
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.115&r2=1.116

--- LVM2/WHATS_NEW	2009/11/03 15:50:42	1.1313
+++ LVM2/WHATS_NEW	2009/11/04 14:47:27	1.1314
@@ -1,5 +1,6 @@
 Version 2.02.55 -
 ===================================
+  Fix lvcreate and lvresize processing of %PVS argument.
   Tidy some uses of arg_count and introduce arg_is_set.
   Export outnl and indent functions for modules.
   Flush stdout after yes/no prompt.
--- LVM2/tools/lvcreate.c	2009/11/03 15:50:44	1.209
+++ LVM2/tools/lvcreate.c	2009/11/04 14:47:28	1.210
@@ -160,13 +160,12 @@
 			lp->extents = lp->extents * vg->free_count / 100;
 			break;
 		case PERCENT_PVS:
-			if (!lcp->pv_count) {
-				log_error("Please specify physical volume(s) "
-					  "with %%PVS");
-				return 0;
+			if (!lcp->pv_count)
+				lp->extents = lp->extents * vg->extent_count / 100;
+			else {
+				pv_extent_count = pv_list_extents_free(lp->pvh);
+				lp->extents = lp->extents * pv_extent_count / 100;
 			}
-			pv_extent_count = pv_list_extents_free(lp->pvh);
-			lp->extents = lp->extents * pv_extent_count / 100;
 			break;
 		case PERCENT_LV:
 			log_error("Please express size as %%VG, %%PVS, or "
@@ -584,15 +583,15 @@
 	}
 
 	if (!_update_extents_params(vg, &lp, &lcp)) {
-		stack;
-		return ECMD_FAILED;
+		r = ECMD_FAILED;
+		goto_out;
 	}
 
 	if (!lv_create_single(vg, &lp)) {
 		stack;
 		r = ECMD_FAILED;
 	}
-
+out:
 	unlock_and_release_vg(cmd, vg, lp.vg_name);
 	return r;
 }
--- LVM2/tools/lvresize.c	2009/11/03 15:50:44	1.115
+++ LVM2/tools/lvresize.c	2009/11/04 14:47:28	1.116
@@ -367,8 +367,11 @@
 			lp->extents = lp->extents * lv->le_count / 100;
 			break;
 		case PERCENT_PVS:
-			pv_extent_count = pv_list_extents_free(pvh);
-			lp->extents = lp->extents * pv_extent_count / 100;
+			if (lp->argc) {
+				pv_extent_count = pv_list_extents_free(pvh);
+				lp->extents = lp->extents * pv_extent_count / 100;
+			} else
+				lp->extents = lp->extents * vg->extent_count / 100;
 			break;
 		case PERCENT_NONE:
 			break;


                 reply	other threads:[~2009-11-04 14:47 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=20091104144729.29830.qmail@sourceware.org \
    --to=mbroz@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).