(4/6) new vgreduce --removemissing semantics
PATCH 1/1 (4/6) new vgreduce --removemissing semantics
Again, nothing new here, just a rebase against the freshest of CVS and the rest of the patchset.
(*the fine print*: Icecream not included.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vgreduce-removemissing.diff
Type: text/x-diff
Size: 9932 bytes
Desc: vgreduce-removemissing.diff
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20080729/f2b57824/attachment.bin>
-------------- next part --------------
Signature · 6 lines
Peter Rockai | me()mornfall!net | prockai()redhat!com
http://blog.mornfall.net | http://web.mornfall.net
"In My Egotistical Opinion, most people's C programs should be
indented six feet downward and covered with dirt."
-- Blair P. Houghton on the subject of C program indentationPATCH 1/1 (4/6) new vgreduce --removemissing semantics
Hi,
there is one small addendum to make --removemissing --force actually work with this patch. It circumvents the error return from _consolidate_vg when it is used from _make_vg_consistent (which is in turn used when --force is in effect).
Now looking at the patch again, I am not so convinced this is the correct
solution: it seems that if _make_vg_consistent worked as expected, removing any LVs that reside on missing PVs should have been removed by the time we call _consolidate_vg. I am still sending this patch for reference, but please bear with me, I will come with a better one in a few minutes.
However, I am not sure why this makes the tests pass -- probably an omission in our testsuite (or how it checks that the vgreduce worked correctly)?
Yours,
Petr.
tools/vgreduce.c +8 -3
@@ -131,12 +131,16 @@ static int _remove_lv(struct cmd_contextreturn 1 ; } -static int _consolidate_vg (struct cmd_context *cmd,struct volume_group *vg) +static int _consolidate_vg (struct cmd_context *cmd,struct volume_group *vg, +int force) {struct pv_list *pvl;struct lv_list *lvl;int err =0 ; +if (force) + goto remove; + list_iterate_items(lvl, &vg->lvs) {if (lvl->lv->status &PARTIAL_LV ) { log_warn("WARNING: Partial LV %s needs to be repaired "
@@ -153,6 +157,7 @@ static int _consolidate_vg(struct cmd_colog_warn ("Proceeding to remove empty missing PVs." ); } +remove: list_iterate_items(pvl, &vg->pvs) {if (pvl->pv->dev && !(pvl->pv->status &MISSING_PV ))continue ;
@@ -214,7 +219,7 @@ static int _make_vg_consistent(struct cmreturn 0 ; } -if (!_consolidate_vg (cmd, vg)) +if (!_consolidate_vg (cmd, vg,1 )) return_0;/* FIXME Recovery. For now people must clean up by hand. */
@@ -549,7 +554,7 @@ int vgreduce(struct cmd_context *cmd, inreturn ECMD_FAILED ; } }else { - fixed =_consolidate_vg (cmd, vg); + fixed =_consolidate_vg (cmd, vg,0 ); }if (!vg_write (vg) || !vg_commit (vg)) {
Signature · 6 lines
Peter Rockai | me()mornfall!net | prockai()redhat!com
http://blog.mornfall.net | http://web.mornfall.net
"In My Egotistical Opinion, most people's C programs should be
indented six feet downward and covered with dirt."
-- Blair P. Houghton on the subject of C program indentationPATCH 1/1 (4/6) new vgreduce --removemissing semantics
Hi,
Quoted 1 line · Petr Rockai
but please bear with me, I will come with a better one in a few minutes.
I am attaching a new version of the patch that solves the issue in a hopefully better way, and also adds a comment on what is the problem with the original approach.
Yours,
Petr.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vgreduce-fix.diff
Type: text/x-diff
Size: 2302 bytes
Desc: vgreduce-fix.diff
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20080910/4118a54d/attachment.bin>
-------------- next part --------------
Signature · 6 lines
Peter Rockai | me()mornfall!net | prockai()redhat!com
http://blog.mornfall.net | http://web.mornfall.net
"In My Egotistical Opinion, most people's C programs should be
indented six feet downward and covered with dirt."
-- Blair P. Houghton on the subject of C program indentation