public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/tools vgreduce.c
@ 2009-07-01 17:01 wysochanski
0 siblings, 0 replies; 9+ messages in thread
From: wysochanski @ 2009-07-01 17:01 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2009-07-01 17:01:46
Modified files:
tools : vgreduce.c
Log message:
Convert vgreduce to use vg_read_for_update.
Sun May 3 12:50:58 CEST 2009 Petr Rockai <me@mornfall.net>
* Convert vgreduce to use vg_read_for_update.
Rebased 6/26/2009 - Dave W.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.92&r2=1.93
--- LVM2/tools/vgreduce.c 2009/06/15 14:47:40 1.92
+++ LVM2/tools/vgreduce.c 2009/07/01 17:01:46 1.93
@@ -382,7 +382,6 @@
{
struct pv_list *pvl;
struct volume_group *orphan_vg = NULL;
- int consistent = 1;
int r = ECMD_FAILED;
const char *name = pv_dev_name(pv);
@@ -424,11 +423,11 @@
vg->free_count -= pv_pe_count(pv) - pv_pe_alloc_count(pv);
vg->extent_count -= pv_pe_count(pv);
- if(!(orphan_vg = vg_read_internal(cmd, vg->fid->fmt->orphan_vg_name, NULL, &consistent)) ||
- !consistent) {
- log_error("Unable to read existing orphan PVs");
+ orphan_vg = vg_read_for_update(cmd, vg->fid->fmt->orphan_vg_name,
+ NULL, LOCK_NONBLOCKING);
+
+ if (vg_read_error(orphan_vg))
goto bad;
- }
if (!vg_split_mdas(cmd, vg, orphan_vg) || !vg->pv_count) {
log_error("Cannot remove final metadata area on \"%s\" from \"%s\"",
@@ -463,7 +462,6 @@
struct volume_group *vg;
char *vg_name;
int ret = ECMD_FAILED;
- int consistent = 1;
int fixed = 1;
int repairing = arg_count(cmd, removemissing_ARG);
int saved_ignore_suspended_devices = ignore_suspended_devices();
@@ -511,25 +509,22 @@
}
log_verbose("Finding volume group \"%s\"", vg_name);
- if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
- log_error("Can't get lock for %s", vg_name);
- return ECMD_FAILED;
- }
if (repairing)
init_ignore_suspended_devices(1);
- if ((!(vg = vg_read_internal(cmd, vg_name, NULL, &consistent)) || !consistent)
- && !repairing) {
- log_error("Volume group \"%s\" doesn't exist", vg_name);
+ vg = vg_read_for_update(cmd, vg_name, NULL, READ_ALLOW_EXPORTED);
+ if (vg_read_error(vg) == FAILED_ALLOCATION ||
+ vg_read_error(vg) == FAILED_NOTFOUND)
goto out;
- }
- if (vg && !vg_check_status(vg, CLUSTERED))
+ /* FIXME We want to allow read-only VGs to be changed here? */
+ if (vg_read_error(vg) && vg_read_error(vg) != FAILED_READ_ONLY
+ && !arg_count(cmd, removemissing_ARG))
goto out;
if (repairing) {
- if (vg && consistent && !vg_missing_pv_count(vg)) {
+ if (!vg_read_error(vg) && !vg_missing_pv_count(vg)) {
log_error("Volume group \"%s\" is already consistent",
vg_name);
ret = ECMD_PROCESSED;
@@ -537,13 +532,16 @@
}
vg_release(vg);
- consistent = !arg_count(cmd, force_ARG);
- if (!(vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) {
- log_error("Volume group \"%s\" not found", vg_name);
- goto out;
- }
- if (!vg_check_status(vg, CLUSTERED))
+ log_verbose("Trying to open VG %s for recovery...", vg_name);
+
+ vg = vg_read_for_update(cmd, vg_name, NULL,
+ READ_ALLOW_INCONSISTENT
+ | READ_ALLOW_EXPORTED);
+
+ if (vg_read_error(vg) && vg_read_error(vg) != FAILED_READ_ONLY
+ && vg_read_error(vg) != FAILED_INCONSISTENT)
goto out;
+
if (!archive(vg))
goto out;
^ permalink raw reply [flat|nested] 9+ messages in thread
* LVM2/tools vgreduce.c
@ 2012-02-15 12:30 mornfall
0 siblings, 0 replies; 9+ messages in thread
From: mornfall @ 2012-02-15 12:30 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall@sourceware.org 2012-02-15 12:30:46
Modified files:
tools : vgreduce.c
Log message:
Turn a warning to an error in vgreduce --removemissing, since we exit with a
failure status there.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.114&r2=1.115
--- LVM2/tools/vgreduce.c 2012/02/08 11:41:18 1.114
+++ LVM2/tools/vgreduce.c 2012/02/15 12:30:46 1.115
@@ -60,8 +60,8 @@
if (!r) {
cmd->handles_missing_pvs = 1;
- log_warn("WARNING: There are still partial LVs in VG %s.", vg->name);
- log_warn("To remove them unconditionally use: vgreduce --removemissing --force.");
+ log_error("There are still partial LVs in VG %s.", vg->name);
+ log_error("To remove them unconditionally use: vgreduce --removemissing --force.");
log_warn("Proceeding to remove empty missing PVs.");
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* LVM2/tools vgreduce.c
@ 2009-12-17 13:54 mornfall
0 siblings, 0 replies; 9+ messages in thread
From: mornfall @ 2009-12-17 13:54 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall@sourceware.org 2009-12-17 13:54:46
Modified files:
tools : vgreduce.c
Log message:
Also clean up MISSING devices in --removemissing --force in vgreduce.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.98&r2=1.99
--- LVM2/tools/vgreduce.c 2009/09/14 22:47:50 1.98
+++ LVM2/tools/vgreduce.c 2009/12/17 13:54:46 1.99
@@ -224,7 +224,7 @@
*/
dm_list_iterate_safe(pvh, pvht, &vg->pvs) {
pvl = dm_list_item(pvh, struct pv_list);
- if (pvl->pv->dev)
+ if (pvl->pv->dev && !(pvl->pv->status & MISSING_PV))
continue;
if (!_remove_pv(vg, pvl, 0))
return_0;
^ permalink raw reply [flat|nested] 9+ messages in thread
* LVM2/tools vgreduce.c
@ 2009-07-24 11:13 wysochanski
0 siblings, 0 replies; 9+ messages in thread
From: wysochanski @ 2009-07-24 11:13 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2009-07-24 11:13:36
Modified files:
tools : vgreduce.c
Log message:
Remove redundant validate_name in vgreduce.
This check is now done in vg_read_for_update, thanks to mornfall.
Should be no functional change.
Author: Dave Wysochanski <dwysocha@redhat.com>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.96&r2=1.97
--- LVM2/tools/vgreduce.c 2009/07/15 05:50:22 1.96
+++ LVM2/tools/vgreduce.c 2009/07/24 11:13:36 1.97
@@ -502,12 +502,6 @@
argv++;
argc--;
- if (!validate_name(vg_name)) {
- log_error("Volume group name \"%s\" is invalid",
- vg_name);
- return ECMD_FAILED;
- }
-
log_verbose("Finding volume group \"%s\"", vg_name);
if (repairing) {
^ permalink raw reply [flat|nested] 9+ messages in thread
* LVM2/tools vgreduce.c
@ 2008-09-19 3:45 agk
0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2008-09-19 3:45 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2008-09-19 03:45:34
Modified files:
tools : vgreduce.c
Log message:
remove unused var
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.81&r2=1.82
--- LVM2/tools/vgreduce.c 2008/09/18 19:56:50 1.81
+++ LVM2/tools/vgreduce.c 2008/09/19 03:45:34 1.82
@@ -139,7 +139,6 @@
struct logical_volume *lv;
struct physical_volume *pv;
struct lv_segment *seg, *mirrored_seg;
- struct lv_segment_area area;
unsigned s;
uint32_t mimages, remove_log;
int list_unsafe, only_mirror_images_found;
^ permalink raw reply [flat|nested] 9+ messages in thread
* LVM2/tools vgreduce.c
@ 2007-11-19 18:24 agk
0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2007-11-19 18:24 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2007-11-19 18:24:09
Modified files:
tools : vgreduce.c
Log message:
note pvmove breakage
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72
--- LVM2/tools/vgreduce.c 2007/11/15 21:30:52 1.71
+++ LVM2/tools/vgreduce.c 2007/11/19 18:24:08 1.72
@@ -182,7 +182,7 @@
if (seg_type(seg, s) != AREA_PV)
continue;
- /* FIXME Also check for segs on deleted LVs */
+ /* FIXME Also check for segs on deleted LVs (incl pvmove) */
pv = seg_pv(seg, s);
if (!pv || !pv_dev(pv)) {
^ permalink raw reply [flat|nested] 9+ messages in thread
* LVM2/tools vgreduce.c
@ 2006-07-04 19:52 agk
0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2006-07-04 19:52 UTC (permalink / raw)
To: lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2006-07-04 19:52:47
Modified files:
tools : vgreduce.c
Log message:
Differentiate between the two 'log device failed' cases in vgreduce.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50
--- LVM2/tools/vgreduce.c 2006/07/04 18:51:59 1.49
+++ LVM2/tools/vgreduce.c 2006/07/04 19:52:47 1.50
@@ -286,13 +286,18 @@
list_iterate_items(seg, &mirrored_seg->log_lv->segments) {
/* FIXME: The second test shouldn't be required */
if ((seg->segtype ==
- get_segtype_from_string(vg->cmd, "error")) ||
- (!strcmp(seg->segtype->name, "error"))) {
+ get_segtype_from_string(vg->cmd, "error"))) {
log_print("The log device for %s/%s has failed.",
vg->name, mirrored_seg->lv->name);
remove_log = 1;
break;
}
+ if (!strcmp(seg->segtype->name, "error")) {
+ log_print("Log device for %s/%s has failed.",
+ vg->name, mirrored_seg->lv->name);
+ remove_log = 1;
+ break;
+ }
}
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* LVM2/tools vgreduce.c
@ 2006-07-04 18:52 agk
0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2006-07-04 18:52 UTC (permalink / raw)
To: lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2006-07-04 18:51:59
Modified files:
tools : vgreduce.c
Log message:
If VG is already consistent with --removemissing, return success not failure.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49
--- LVM2/tools/vgreduce.c 2006/05/12 19:16:48 1.48
+++ LVM2/tools/vgreduce.c 2006/07/04 18:51:59 1.49
@@ -476,7 +476,7 @@
log_error("Volume group \"%s\" is already consistent",
vg_name);
unlock_vg(cmd, vg_name);
- return ECMD_FAILED;
+ return ECMD_PROCESSED;
}
init_partial(1);
^ permalink raw reply [flat|nested] 9+ messages in thread
* LVM2/tools vgreduce.c
@ 2005-12-21 20:24 agk
0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2005-12-21 20:24 UTC (permalink / raw)
To: lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2005-12-21 20:24:23
Modified files:
tools : vgreduce.c
Log message:
some fixes
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-02-15 12:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-01 17:01 LVM2/tools vgreduce.c wysochanski
-- strict thread matches above, loose matches on Subject: below --
2012-02-15 12:30 mornfall
2009-12-17 13:54 mornfall
2009-07-24 11:13 wysochanski
2008-09-19 3:45 agk
2007-11-19 18:24 agk
2006-07-04 19:52 agk
2006-07-04 18:52 agk
2005-12-21 20:24 agk
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).