dev-dct-process-latest - vgreduce: use normal process_each_pv
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6351dabe95a7c0f4837567953466c4910c858fa9 Commit: 6351dabe95a7c0f4837567953466c4910c858fa9 Parent: 7c88ae037e5e1e860cd58e873a90dc3e3cd0bbe1 Author: David Teigland <[email protected]> AuthorDate: Tue Apr 22 15:50:44 2014 -0500 Committer: David Teigland <[email protected]> CommitterDate: Mon Sep 22 10:32:23 2014 -0500
vgreduce: use normal process_each_pv
In the non-repair case.
--- tools/toollib.c | 42 +++++++++----------- tools/toollib.h | 2 +- tools/vgreduce.c | 115 ++++++++++++++++++++++++++--------------------------- 3 files changed, 76 insertions(+), 83 deletions(-)
tools/toollib.c +19 -23
@@ -1269,7 +1269,7 @@ static int get_arg_vgnames(struct cmd_context *cmd,*/ static int get_all_vgnames (struct cmd_context *cmd,struct dm_list *all_vgnames, -int include_orphan) +const char *one_vgname,int include_orphan) {int ret_max =ECMD_PROCESSED ;struct name_id_list *nl;
@@ -1277,6 +1277,20 @@ static int get_all_vgnames(struct cmd_context *cmd, struct dm_list *all_vgnames,struct dm_str_list *sl;const char *vgid; +if (one_vgname) { + nl =dm_pool_alloc (cmd->mem,sizeof (struct name_id_list )); +if (!nl) { +log_error ("name_id_list allocation failed" ); +return ECMD_FAILED ; + } + + nl->name =dm_pool_strdup (cmd->mem, one_vgname); + nl->uuid =NULL ; + +dm_list_add (all_vgnames, &nl->list); +return ret_max; + } +log_verbose ("Finding all volume groups" );if (!lvmetad_vg_list_to_lvmcache (cmd))
@@ -1418,7 +1432,7 @@ int process_each_vg(struct cmd_context *cmd,if ((dm_list_empty (&arg_vgnames) && enable_all_vgs) || !dm_list_empty (&arg_tags)) { - ret =get_all_vgnames (cmd, &all_vgnames,0 ); + ret =get_all_vgnames (cmd, &all_vgnames,NULL ,0 );if (ret !=ECMD_PROCESSED )return ret; }
@@ -1756,7 +1770,7 @@ int process_each_lv(struct cmd_context *cmd,if ((dm_list_empty (&arg_vgnames) && enable_all_vgs) || !dm_list_empty (&arg_tags)) { - ret =get_all_vgnames (cmd, &all_vgnames,0 ); + ret =get_all_vgnames (cmd, &all_vgnames,NULL ,0 );if (ret !=ECMD_PROCESSED )return ret; }
@@ -2038,7 +2052,7 @@ static int process_pvs_in_vgs(struct cmd_context *cmd, uint32_t flags,int process_each_pv (struct cmd_context *cmd,int argc,char **argv, -struct volume_group *vg, +const char *vg_name,uint32_t flags,void *handle,process_single_pv_fn_t process_single_pv)
@@ -2047,7 +2061,6 @@ int process_each_pv(struct cmd_context *cmd,struct dm_list arg_pvnames;/* str_list */ struct dm_list all_vgnames;/* name_id_list */ struct dm_list all_devs;/* device_list */ -struct dm_str_list *sl;int process_all_pvs;int process_all_devs;int ret_max =ECMD_PROCESSED ;
@@ -2074,23 +2087,6 @@ int process_each_pv(struct cmd_context *cmd,arg_count (cmd, all_ARG);/* -* Caller has already selected, locked, and read one vg in which to -* process pvs (all pvs, or named pvs, or pvs with matching tags). -*/ -if (vg) { - ret =process_pvs_in_vg (cmd, vg,NULL , - &arg_pvnames, &arg_tags, process_all_pvs, - handle, process_single_pv); - - dm_list_iterate_items(sl, &arg_pvnames) { -log_error ("Physical Volume \"%s\" not found in Volume Group \"%s\"" , - sl->str, vg->name); - ret =ECMD_FAILED ; - } -return ret; - } - -/* * If the caller wants to process all devs (not only pvs), then all pvs * from all vgs are processed first, removing each from all_devs. Then * any devs remaining in all_devs are processed.
@@ -2101,7 +2097,7 @@ int process_each_pv(struct cmd_context *cmd,return ret; } - ret =get_all_vgnames (cmd, &all_vgnames,1 ); + ret =get_all_vgnames (cmd, &all_vgnames, vg_name,1 );if (ret !=ECMD_PROCESSED )return ret;
tools/toollib.h +1 -1
@@ -57,7 +57,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv, process_single_vg_fn_t process_single_vg);int process_each_pv (struct cmd_context *cmd,int argc,char **argv, -struct volume_group *vg,uint32_t lock_type, +const char *vg_name,uint32_t lock_type,void *handle,process_single_pv_fn_t process_single_pv); int process_each_label(struct cmd_context *cmd, int argc, char **argv,
tools/vgreduce.c +56 -59
156 lines not on this page · raw message