LVM2 ./WHATS_NEW lib/commands/toolcontext.c li ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2010-11-11 17:29:06
Modified files:
. : WHATS_NEW lib/commands : toolcontext.c toolcontext.h lib/metadata : lv_manip.c metadata-exported.h liblvm : lvm_lv.c tools : args.h lvchange.c lvcreate.c lvm.c
lvm2cmdline.h lvmcmdline.c pvchange.c tools.h vgchange.c vgcreate.c
Log message:
Support repetition of --addtag and --deltag arguments.
Add infrastructure for specific cmdline arguments to be repeated in groups. Split the_args cmdline arguments and values into arg_props and arg_values.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1795&r2=1.1796
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.107&r2=1.108
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.h.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.237&r2=1.238
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.169&r2=1.170
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_lv.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/args.h.diff?cvsroot=lvm2&r1=1.80&r2=1.81
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.126&r2=1.127
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.224&r2=1.225
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvm.c.diff?cvsroot=lvm2&r1=1.114&r2=1.115
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvm2cmdline.h.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.129&r2=1.130
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvchange.c.diff?cvsroot=lvm2&r1=1.84&r2=1.85
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.116&r2=1.117
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.80&r2=1.81
WHATS_NEW +5 -2
@@ -1,7 +1,10 @@ Version 2.02.77 - =================================== - Fix fsadm need of using '-f' for downsize of unmounted filesystem. - Fix fsadm regression in detection of mounted filesystem for older systems (2.0.75). + Support repetition of --addtag and --deltag arguments. + Add infrastructure for specific cmdline arguments to be repeated in groups. + Split the_args cmdline arguments and values into arg_props and arg_values. +FIXME??? Fix fsadm need of using '-f' for downsize of unmounted filesystem. + Fix fsadm to detect mounted filesystems on older systems. (2.0.75) Extend cling allocation policy to recognise PV tags (cling_by_tags). Add allocation/cling_tag_list to lvm.conf. Regenerate configure with 'autoreconf' for --enable-ocf. (2.02.76)
lib/commands/toolcontext.c +1 -0
@@ -1136,6 +1136,7 @@ cmd->handles_missing_pvs =0 ; cmd->handles_unknown_segments =0 ; cmd->hosttags =0 ; +dm_list_init (&cmd->arg_value_groups);dm_list_init (&cmd->formats);dm_list_init (&cmd->segtypes);dm_list_init (&cmd->tags);
lib/commands/toolcontext.h +3 -0
@@ -49,6 +49,7 @@struct config_tree ;struct archive_params ;struct backup_params ; +struct arg_values ;/* FIXME Split into tool & library contexts */ /* command-instance-related variables needed by library */
@@ -68,6 +69,8 @@const char *cmd_line;struct command *command;char **argv; +struct arg_values *arg_values; +struct dm_list arg_value_groups; unsigned is_long_lived:1; /* Optimises persistent_filter handling */ unsigned handles_missing_pvs:1; unsigned handles_unknown_segments:1;
lib/metadata/lv_manip.c +3 -6
@@ -3248,7 +3248,7 @@if (!archive (vg))return 0 ; -if (lp->tag) { +if (!dm_list_empty (&lp->tags)) {if (!(vg->fid->fmt->features &FMT_TAGS )) {log_error ("Volume group %s does not support tags" , vg->name);
@@ -3283,11 +3283,8 @@ lv->minor); } -if (lp->tag && !str_list_add (cmd->mem, &lv->tags, lp->tag)) { -log_error ("Failed to add tag %s to %s/%s" , - lp->tag, lv->vg->name, lv->name); -return 0 ; - } +if (!dm_list_empty (&lp->tags)) +dm_list_splice (&lv->tags, &lp->tags);if (!lv_extend (lv, lp->segtype, lp->stripes, lp->stripe_size,1 , lp->extents,NULL ,0u ,0u , lp->pvh, lp->alloc))
lib/metadata/metadata-exported.h +1 -1
@@ -516,7 +516,7 @@uint32_t read_ahead;/* all */ alloc_policy_t alloc;/* all */ -const char *tag;/* all */ +struct dm_list tags;/* all */ }; int lv_create_single(struct volume_group *vg,
liblvm/lvm_lv.c +1 -1
@@ -113,7 +113,7 @@ lp->permission =LVM_READ |LVM_WRITE ; lp->read_ahead =DM_READ_AHEAD_NONE ; lp->alloc =ALLOC_INHERIT ; - lp->tag =NULL ; +dm_list_init (&lp->tags); }/* Set default for linear segment specific LV parameters */
tools/args.h +5 -5
@@ -40,8 +40,8 @@ arg(removemissing_ARG, '\0', "removemissing", NULL, 0) arg(restoremissing_ARG, '\0', "restoremissing", NULL, 0) arg(abort_ARG, '\0', "abort", NULL, 0) -arg(addtag_ARG, '\0', "addtag", tag_arg, 0) -arg(deltag_ARG, '\0', "deltag", tag_arg, 0) +arg(addtag_ARG, '\0', "addtag", tag_arg, ARG_GROUPABLE) +arg(deltag_ARG, '\0', "deltag", tag_arg, ARG_GROUPABLE) arg(refresh_ARG, '\0', "refresh", NULL, 0) arg(mknodes_ARG, '\0', "mknodes", NULL, 0)arg (minor_ARG,'\0' ,"minor" , minor_arg,0 )
@@ -90,11 +90,11 @@ arg(colon_ARG, 'c', "colon", NULL, 0) arg(columns_ARG, 'C', "columns", NULL, 0) arg(contiguous_ARG, 'C', "contiguous", yes_no_arg, 0) -arg(debug_ARG, 'd', "debug", NULL, ARG_REPEATABLE) +arg(debug_ARG, 'd', "debug", NULL, ARG_COUNTABLE) arg(exported_ARG, 'e', "exported", NULL, 0) arg(physicalextent_ARG, 'E', "physicalextent", NULL, 0) arg(file_ARG, 'f', "file", string_arg, 0) -arg(force_ARG, 'f', "force", NULL, ARG_REPEATABLE) +arg(force_ARG, 'f', "force", NULL, ARG_COUNTABLE) arg(full_ARG, 'f', "full", NULL, 0) arg(help_ARG, 'h', "help", NULL, 0)arg (help2_ARG,'?' ,"" ,NULL ,0 )
@@ -137,7 +137,7 @@ arg(uuid_ARG, 'u', "uuid", NULL, 0) arg(uuidstr_ARG, 'u', "uuid", string_arg, 0) arg(uuidlist_ARG, 'U', "uuidlist", NULL, 0) -arg(verbose_ARG, 'v', "verbose", NULL, ARG_REPEATABLE) +arg(verbose_ARG, 'v', "verbose", NULL, ARG_COUNTABLE) arg(volumegroup_ARG, 'V', "volumegroup", NULL, 0) arg(allocatable_ARG, 'x', "allocatable", yes_no_arg, 0)arg (resizeable_ARG,'x' ,"resizeable" , yes_no_arg,0 )
tools/lvchange.c +12 -6
@@ -495,14 +495,20 @@ int arg) {const char *tag; +struct arg_value_group_list *current_group; -if (!(tag =arg_str_value (cmd, arg,NULL ))) { -log_error ("Failed to get tag" ); -return 0 ; - } + dm_list_iterate_items(current_group, &cmd->arg_value_groups) { +if (!grouped_arg_is_set (current_group->arg_values, arg)) +continue ; -if (!lv_change_tag (lv, tag, arg == addtag_ARG)) - return_0; +if (!(tag =grouped_arg_str_value (current_group->arg_values, arg,NULL ))) { +log_error ("Failed to get tag" ); +return 0 ; + } + +if (!lv_change_tag (lv, tag, arg == addtag_ARG)) + return_0; + }log_very_verbose ("Updating logical volume \"%s\" on disk(s)" , lv->name);
tools/lvcreate.c +17 -1
@@ -327,9 +327,12 @@ {int contiguous;unsigned pagesize; +struct arg_value_group_list *current_group; +const char *tag;memset (lp,0 ,sizeof (*lp));memset (lcp,0 ,sizeof (*lcp)); +dm_list_init (&lp->tags);/* * Check selected options are compatible and determine segtype
@@ -507,7 +510,20 @@return 0 ; } - lp->tag =arg_str_value (cmd, addtag_ARG,NULL ); + dm_list_iterate_items(current_group, &cmd->arg_value_groups) { +if (!grouped_arg_is_set (current_group->arg_values, addtag_ARG)) +continue ; + +if (!(tag =grouped_arg_str_value (current_group->arg_values, addtag_ARG,NULL ))) { +log_error ("Failed to get tag" ); +return 0 ; + } + +if (!str_list_add (cmd->mem, &lp->tags, tag)) { +log_error ("Unable to allocate memory for tag %s" , tag); +return 0 ; + } + } lcp->pv_count = argc; lcp->pvs = argv;
tools/lvm.c +2 -2
@@ -95,7 +95,7 @@while (match_no < com->num_args) {char s[3 ];char c; -if (!(c = (_cmdline->the_args + +if (!(c = (_cmdline->arg_props + com->valid_args[match_no++])->short_arg))continue ;
@@ -111,7 +111,7 @@while (match_no - com->num_args < com->num_args) {const char *l; - l = (_cmdline->the_args + + l = (_cmdline->arg_props + com->valid_args[match_no++ - com->num_args])->long_arg;if (*(l +2 ) && !strncmp (text, l, len))return strdup (l);
tools/lvm2cmdline.h +1 -1
@@ -19,7 +19,7 @@struct cmd_context ;struct cmdline_context { -struct arg *the_args; +struct arg_props *arg_props;struct command *commands;int num_commands;int commands_size;
tools/lvmcmdline.c +180 -154
687 lines not on this page · raw message
tools/pvchange.c +20 -13
@@ -36,6 +36,8 @@int r =0 ;int mda_ignore =0 ; +struct arg_value_group_list *current_group; +if (arg_count (cmd, addtag_ARG)) tagarg = addtag_ARG;else if (arg_count (cmd, deltag_ARG))
@@ -47,10 +49,6 @@if (arg_count (cmd, metadataignore_ARG)) mda_ignore = !strcmp (arg_str_value (cmd, metadataignore_ARG,"n" ),"y" ); -else if (tagarg && !(tag =arg_str_value (cmd, tagarg,NULL ))) { -log_error ("Failed to get tag" ); -return 0 ; - }/* If in a VG, must change using volume group. */ if (!is_orphan (pv)) {
@@ -108,16 +106,25 @@ } }else if (tagarg) {/* tag or deltag */ -if ((tagarg == addtag_ARG)) { -if (!str_list_add (cmd->mem, &pv->tags, tag)) { -log_error ("Failed to add tag %s to physical " -"volume %s" , tag, pv_name); + + dm_list_iterate_items(current_group, &cmd->arg_value_groups) { +if (!grouped_arg_is_set (current_group->arg_values, tagarg)) +continue ; + +if (!(tag =grouped_arg_str_value (current_group->arg_values, tagarg,NULL ))) { +log_error ("Failed to get tag" ); goto out; } - }else { -if (!str_list_del (&pv->tags, tag)) { + +if ((tagarg == addtag_ARG)) { +if (!str_list_add (cmd->mem, &pv->tags, tag)) { +log_error ("Failed to add tag %s to physical " +"volume %s" , tag, pv_name); + goto out; + } + }else if (!str_list_del (&pv->tags, tag)) {log_error ("Failed to remove tag %s from " -"physical volume" "%s" , tag, pv_name); +"physical volume" "%s" , tag, pv_name); goto out; } }
@@ -202,8 +209,8 @@struct dm_list *vgnames;struct str_list *sll; -if (arg_count (cmd, allocatable_ARG) +arg_count (cmd, addtag_ARG) + -arg_count (cmd, deltag_ARG) +arg_count (cmd, uuid_ARG) + +if (arg_count (cmd, allocatable_ARG) +arg_is_set (cmd, addtag_ARG) + +arg_is_set (cmd, deltag_ARG) +arg_count (cmd, uuid_ARG) +arg_count (cmd, metadataignore_ARG) !=1 ) {log_error ("Please give exactly one option of -x, -uuid, " "--addtag or --deltag" );
tools/tools.h +40 -28
93 lines not on this page · raw message
tools/vgchange.c +13 -6
@@ -364,14 +364,21 @@ int arg) {const char *tag; +struct arg_value_group_list *current_group; -if (!(tag =arg_str_value (cmd, arg,NULL ))) { -log_error ("Failed to get tag" ); -return 0 ; - } + dm_list_iterate_items(current_group, &cmd->arg_value_groups) { +if (!grouped_arg_is_set (current_group->arg_values, arg)) +continue ; + +if (!(tag =grouped_arg_str_value (current_group->arg_values, arg,NULL ))) { +log_error ("Failed to get tag" ); +return 0 ; + } -if (!vg_change_tag (vg, tag, arg == addtag_ARG)) - return_0; +if (!vg_change_tag (vg, tag, arg == addtag_ARG)) + return_0; + + }return 1 ; }
tools/vgcreate.c +15 -11
@@ -24,6 +24,7 @@const char *clustered_message ="" ;char *vg_name;struct pvcreate_params pp; +struct arg_value_group_list *current_group;if (!argc) { log_error("Please provide volume group name and "
@@ -85,21 +86,24 @@ "(0 means unlimited)", vg->max_pv);if (arg_count (cmd, addtag_ARG)) { -if (!(tag =arg_str_value (cmd, addtag_ARG,NULL ))) { -log_error ("Failed to get tag" ); - goto bad; - } + dm_list_iterate_items(current_group, &cmd->arg_value_groups) { +if (!grouped_arg_is_set (current_group->arg_values, addtag_ARG)) +continue ; + +if (!(tag =grouped_arg_str_value (current_group->arg_values, addtag_ARG,NULL ))) { +log_error ("Failed to get tag" ); + goto bad; + } -if (!vg_change_tag (vg, tag,1 )) - goto_bad; +if (!vg_change_tag (vg, tag,1 )) + goto_bad; + } } -if (vg_is_clustered (vg)) { +if (vg_is_clustered (vg)) clustered_message ="Clustered " ; - }else { -if (locking_is_clustered ()) - clustered_message ="Non-clustered " ; - } +else if (locking_is_clustered ()) + clustered_message ="Non-clustered " ;if (!archive (vg)) goto_bad;
Dne 11.11.2010 18:29, agk at sourceware.org napsal(a):
Quoted 23 lines
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2010-11-11 17:29:06Modified files:
. : WHATS_NEW lib/commands : toolcontext.c toolcontext.h lib/metadata : lv_manip.c metadata-exported.h liblvm : lvm_lv.c tools : args.h lvchange.c lvcreate.c lvm.c
lvm2cmdline.hlvmcmdline.cpvchange.ctools.hvgchange.cvgcreate.cLog message:
Support repetition of --addtag and --deltag arguments.
Add infrastructure for specific cmdline arguments to be repeated in groups. Splitthe_argscmdline arguments and values intoarg_propsandarg_values./LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.80&r2=1.81
WHATS_NEW line 8
Quoted 10 lines
WHATS_NEW +5
-2@@ -1,7 +1,10 @@ Version 2.02.77 - =================================== - Fix fsadm need of using '-f' for downsize of unmounted filesystem. - Fix fsadm regression in detection of mounted filesystem for older systems (2.0.75). + Support repetition of --addtag and --deltag arguments. + Add infrastructure for specific cmdline arguments to be repeated in groups. + Split the_args cmdline arguments and values into arg_props and arg_values. +FIXME??? Fix fsadm need of using '-f' for downsize of unmounted filesystem. + Fix fsadm to detect mounted filesystems on older systems. (2.0.75) Extend cling allocation policy to recognise PV tags (cling_by_tags).
Probably not the best word order - maybe this way it would be better:
Fsadm no longer needs to be given option '-f' to resize unmounted unchecked filesystem ?
Zdenek