master - lvchange: make use of command definitions
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=52c60b7e7bba400b2f8fb40f123ca90224c16d27 Commit: 52c60b7e7bba400b2f8fb40f123ca90224c16d27 Parent: 9c6c55c314199a9ba26fe1b864306b2ca8a8dbcd Author: David Teigland <[email protected]> AuthorDate: Wed Nov 16 16:05:47 2016 -0600 Committer: David Teigland <[email protected]> CommitterDate: Mon Feb 13 08:20:10 2017 -0600
lvchange: make use of command definitions
Reorganize the lvchange code to take advantage of
the command definition, and remove the validation
that is done by the command definintion rules.
--- tools/command-lines.in | 16 +- tools/lvchange.c | 848 +++++++++++++++++++++++------------------------- tools/lvmcmdline.c | 9 + tools/tools.h | 9 + 4 files changed, 430 insertions(+), 452 deletions(-)
tools/command-lines.in +11 -5
@@ -239,8 +239,12 @@ OO_LVCHANGE_META: --addtag Tag, --deltag Tag, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, --writebehind Number, --writemostly WriteMostlyPV, --persistent n +# It's unfortunate that activate needs to be optionally allowed here; +# it should only be used explicitly, but it's been previously allowed +# in combination with unrelated metadata changes. + lvchange OO_LVCHANGE_META VG|LV|Tag|Select ... -OO: OO_LVCHANGE +OO: --activate Active, OO_LVCHANGE ID: lvchange_properties DESC: Change a general LV property. RULE: all not lv_is_pvmove lv_is_mirror_log lv_is_mirror_image
@@ -256,8 +260,11 @@ RULE: --permission not lv_is_external_origin lv_is_raid_metadata lv_is_raid_imag RULE: --alloc --contiguous --metadataprofile --permission --persistent --profile --readahead not lv_is_thick_origin RULE: --alloc --discards --zero --cachemode --cachepolicy --cachesettings not lv_is_partial +# It's unfortunate that acativate needs to be optionally allowed here, +# like above, it was previouly allowed in combination. + lvchange --resync VG|LV_raid_mirror|Tag|Select ... -OO: OO_LVCHANGE +OO: --activate Active, OO_LVCHANGE ID: lvchange_resync DESC: Resyncronize a mirror or raid LV. RULE: all not lv_is_pvmove lv_is_locked
@@ -275,15 +282,14 @@ ID: lvchange_rebuild DESC: Reconstruct data on specific PVs of a raid LV. RULE: all not LV_raid0 -# try removing the META change options from here? lvchange --activate Active VG|LV|Tag|Select ... OO: --activationmode ActivationMode, --partial, --ignoreactivationskip, ---ignorelockingfailure, --sysinit, OO_LVCHANGE_META, OO_LVCHANGE +--ignorelockingfailure, --sysinit, OO_LVCHANGE ID: lvchange_activate DESC: Activate or deactivate an LV. lvchange --refresh VG|LV|Tag|Select ... -OO: --partial, OO_LVCHANGE +OO: --partial, --poll Bool, OO_LVCHANGE ID: lvchange_refresh DESC: Reactivate an LV using the latest metadata.
tools/lvchange.c +401 -447
992 lines not on this page · raw message
tools/lvmcmdline.c +9 -0
@@ -113,6 +113,15 @@ static struct cmdline_context _cmdline;*/ struct command_function command_functions[COMMAND_ID_COUNT ] = { { lvmconfig_general_CMD, lvmconfig }, + { lvchange_properties_CMD, lvchange_properties_cmd }, + { lvchange_resync_CMD, lvchange_resync_cmd }, + { lvchange_syncaction_CMD, lvchange_syncaction_cmd }, + { lvchange_rebuild_CMD, lvchange_rebuild_cmd }, + { lvchange_activate_CMD, lvchange_activate_cmd }, + { lvchange_refresh_CMD, lvchange_refresh_cmd }, + { lvchange_monitor_CMD, lvchange_monitor_poll_cmd }, + { lvchange_poll_CMD, lvchange_monitor_poll_cmd }, + { lvchange_persistent_CMD, lvchange_persistent_cmd }, };#if 0 /* all raid-related type conversions */
tools/tools.h +9 -0
@@ -242,4 +242,13 @@ int vgchange_background_polling(struct cmd_context *cmd, struct volume_group *vgstruct lv_props *get_lv_prop (int lvp_enum);struct lv_types *get_lv_type (int lvt_enum); +int lvchange_properties_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvchange_activate_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvchange_refresh_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvchange_resync_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvchange_syncaction_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvchange_rebuild_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvchange_monitor_poll_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvchange_persistent_cmd (struct cmd_context *cmd,int argc,char **argv); +#endif