From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31248 invoked by alias); 28 Feb 2011 17:08:10 -0000 Received: (qmail 31231 invoked by uid 9796); 28 Feb 2011 17:08:09 -0000 Date: Mon, 28 Feb 2011 17:08:00 -0000 Message-ID: <20110228170809.31229.qmail@sourceware.org> From: prajnoha@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/tools pvresize.c Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00080.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2011-02-28 17:08:09 Modified files: tools : pvresize.c Log message: Add a hint for manual revert if there's an error in pv_write, vg_write, vg_commit for pvresize. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvresize.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43 --- LVM2/tools/pvresize.c 2011/02/28 13:19:03 1.42 +++ LVM2/tools/pvresize.c 2011/02/28 17:08:09 1.43 @@ -35,6 +35,7 @@ const char *pv_name = pv_dev_name(pv); const char *vg_name = pv_vg_name(pv); struct volume_group *old_vg = vg; + int vg_needs_pv_write = 0; if (is_orphan_vg(vg_name)) { if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) { @@ -100,7 +101,8 @@ /* Write PV label only if this an orphan PV or it has 2nd mda. */ if ((is_orphan_vg(vg_name) || - fid_get_mda_indexed(vg->fid, (const char *) &pv->id, ID_LEN, 1)) && + (vg_needs_pv_write = (fid_get_mda_indexed(vg->fid, + (const char *) &pv->id, ID_LEN, 1) != NULL))) && !pv_write(cmd, pv, 1)) { log_error("Failed to store physical volume \"%s\"", pv_name); @@ -120,6 +122,9 @@ r = 1; out: + if (!r && vg_needs_pv_write) + log_error("Use pvcreate and vgcfgrestore " + "to repair from archived metadata."); unlock_vg(cmd, vg_name); if (!old_vg) free_vg(vg);