master - tools: add common lv_change_activate
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a81a2406f18c6ad0802a02892214f56b1bb99c13 Commit: a81a2406f18c6ad0802a02892214f56b1bb99c13 Parent: 698137ec38a3582954543685bffb1e937ab61c34 Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu Apr 11 13:51:08 2013 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Fri Apr 12 11:30:07 2013 +0200
tools: add common lv_change_activate
Move common code for changing activation state from vgchange and lvchange to one function.
Fix the order of checks - so we always implicitelly activate snapshots and thin volumes in exclusive mode, and we do not allow local deactivation for them.
--- WHATS_NEW | 1 + tools/lvchange.c | 42 +++++------------------------------------- tools/toollib.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ tools/toollib.h | 2 ++ tools/vgchange.c | 33 +++------------------------------ 5 files changed, 56 insertions(+), 67 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.99 - =================================== + Add lv_change_activate() for common activation code in vg/lvchange. Revert change that allowed identical table reload for RAID. New lvchange arg, '--syncaction' allows scrubbing of RAID LVs. Improve RAID kernel status retrieval to include sync_action/mismatch_cnt.
tools/lvchange.c +5 -37
49 lines not on this page · raw message
tools/toollib.c +45 -0
51 lines not on this page · raw message
tools/toollib.h +2 -0
@@ -101,6 +101,8 @@ void vgcreate_params_set_defaults(struct vgcreate_params *vp_def,int vgcreate_params_set_from_args (struct cmd_context *cmd,struct vgcreate_params *vp_new,struct vgcreate_params *vp_def); +int lv_change_activate (struct cmd_context *cmd,struct logical_volume *lv, +activation_change_t activate);int lv_refresh (struct cmd_context *cmd,struct logical_volume *lv);int vg_refresh_visible (struct cmd_context *cmd,struct volume_group *vg); void lv_spawn_background_polling(struct cmd_context *cmd,
tools/vgchange.c +3 -30
@@ -131,44 +131,17 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg,continue ; } -if (activate ==CHANGE_AAY && !lv_passes_auto_activation_filter (cmd, lv)) +if ((activate ==CHANGE_AAY ) && + !lv_passes_auto_activation_filter (cmd, lv))continue ; expected_count++; -if (activate ==CHANGE_AN ) { -if (!deactivate_lv (cmd, lv)) { - stack; -continue ; - } - }else if (activate ==CHANGE_ALN ) { -if (!deactivate_lv_local (cmd, lv)) { - stack; -continue ; - } - }else if ((activate ==CHANGE_AE ) || -lv_is_origin (lv) || -lv_is_thin_type (lv)) { -/* FIXME: duplicated test code with lvchange */ -if (!activate_lv_excl (cmd, lv)) { - stack; -continue ; - } - }else if (activate ==CHANGE_AAY || activate ==CHANGE_ALY ) { -if (!activate_lv_local (cmd, lv)) { - stack; -continue ; - } - }else if (!activate_lv (cmd, lv)) { +if (!lv_change_activate (cmd, lv, activate)) { stack;continue ; } -if (background_polling () && - activate !=CHANGE_AN && activate !=CHANGE_ALN && - (lv->status & (PVMOVE |CONVERTING |MERGING ))) -lv_spawn_background_polling (cmd, lv); - count++; }