master - cmdline: Add --ignoreskippedcluster.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=baf95bbff70bdd1474b678f37b840025295903ae Commit: baf95bbff70bdd1474b678f37b840025295903ae Parent: 23ce3352d7e6ad122b3b173ffb739848bec6a7bd Author: Alasdair G Kergon <[email protected]> AuthorDate: Tue Oct 1 21:20:10 2013 +0100 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Tue Oct 1 21:20:10 2013 +0100
cmdline: Add --ignoreskippedcluster.
Accept --ignoreskippedcluster with pvs, vgs, lvs, pvdisplay, vgdisplay, lvdisplay, vgchange and lvchange to avoid the 'Skipping clustered VG' errors when requesting information about a clustered VG without using clustered locking and still exit with success.
The messages can still be seen with -v.
--- WHATS_NEW | 3 +- lib/commands/toolcontext.c | 1 + lib/commands/toolcontext.h | 1 + lib/metadata/metadata.c | 10 ++++++- man/lvchange.8.in | 1 + man/lvdisplay.8.in | 2 + man/lvm.8.in | 5 ++++ man/lvs.8.in | 1 + man/pvdisplay.8.in | 1 + man/pvs.8.in | 1 + man/vgchange.8.in | 1 + man/vgdisplay.8.in | 2 + man/vgs.8.in | 1 + tools/args.h | 1 + tools/commands.h | 40 +++++++++++++++++++++++---------- tools/lvmcmdline.c | 2 + tools/pvdisplay.c | 7 ++--- tools/reporter.c | 22 ++++++++++++----- tools/toollib.c | 53 +++++++++++++++++++++++++++++-------------- tools/toollib.h | 2 + 20 files changed, 114 insertions(+), 43 deletions(-)
WHATS_NEW +2 -1
@@ -1,12 +1,13 @@ Version 2.02.103 - ====================================== + Add --ignoreskippedcluster for exit status success when clustered VGs skipped. Fix 3min udev timeout so that it is applied for all LVM volumes. Fix RAID calculation for sufficient allocatable space. Conversion from linear to mirror or RAID1 now honors mirror_segtype_default. Add thin-performance configuration profile. Add lvm.conf allocation/thin_pool_chunk_size_calculation option. Fix contiguous & cling allocation policies for parity RAID. (2.02.100) - Set use_lvmetad=0 on lvmconf --enable-cluster, reset to default on --disable-cluster. + Have lvmconf --enable/disable-cluster reset/set use_lvmetad. Don't install separate command symlink in binary directory for 'lvm devtypes'. Add seg_size_pe field to reports. Support start+length notation with command line PE ranges.
lib/commands/toolcontext.c +1 -0
@@ -1396,6 +1396,7 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived, cmd->handles_missing_pvs =0 ; cmd->handles_unknown_segments =0 ; cmd->independent_metadata_areas =0 ; + cmd->ignore_clustered_vgs =0 ; cmd->hosttags =0 ;dm_list_init (&cmd->arg_value_groups);dm_list_init (&cmd->formats);
lib/commands/toolcontext.h +1 -0
@@ -90,6 +90,7 @@ struct cmd_context { unsigned auto_set_activation_skip:1; unsigned si_unit_consistency:1; unsigned metadata_read_only:1; + unsigned ignore_clustered_vgs:1; unsigned threaded:1; /* Set if running within a thread e.g. clvmd */ unsigned independent_metadata_areas:1; /* Active formats have MDAs outside PVs */
lib/metadata/metadata.c +8 -2
@@ -4005,7 +4005,10 @@ static uint32_t _vg_bad_status_bits(const struct volume_group *vg,if ((status &CLUSTERED ) && (vg_is_clustered (vg)) && !locking_is_clustered ()) { -log_error ("Skipping clustered volume group %s" , vg->name); +if (!vg->cmd->ignore_clustered_vgs) +log_error ("Skipping clustered volume group %s" , vg->name); +else +log_verbose ("Skipping clustered volume group %s" , vg->name);/* Return because other flags are considered undefined. */ return FAILED_CLUSTERED ; }
@@ -4123,7 +4126,10 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha }if (vg_is_clustered (vg) && !locking_is_clustered ()) { -log_error ("Skipping clustered volume group %s" , vg->name); +if (!cmd->ignore_clustered_vgs) +log_error ("Skipping clustered volume group %s" , vg->name); +else +log_verbose ("Skipping clustered volume group %s" , vg->name); failure |=FAILED_CLUSTERED ; goto bad; }
man/lvchange.8.in +1 -0
@@ -27,6 +27,7 @@ lvchange \- change attributes of a logical volume .RB [ \-h | \-? | \-\-help ] .RB [ \-\-ignorelockingfailure ] .RB [ \-\-ignoremonitoring ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-monitor .RI { y | n }] .RB [ \-\-poll
man/lvdisplay.8.in +2 -0
@@ -8,6 +8,7 @@ lvdisplay \- display attributes of a logical volume .RB [ \-d | \-\-debug ] .RB [ \-h | \-? | \-\-help ] .RB [ \-\-ignorelockingfailure ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-maps ] .RB [ \-\-nosuffix ] .RB [ \-P | \-\-partial ]
@@ -26,6 +27,7 @@ lvdisplay \- display attributes of a logical volume .RB [ \-d | \-\-debug ] .RB [ \-h | \-? | \-\-help ] .RB [ \-\-ignorelockingfailure ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-noheadings ] .RB [ \-\-nosuffix ] .RB [ \-o | \-\-options
man/lvm.8.in +5 -0
@@ -216,6 +216,11 @@ This lets you proceed with read-only metadata operations such as One use for this is in a system init script if the lock directory is mounted read-only when the script runs. .TP +.B \-\-ignoreskippedcluster +Use to avoid exiting with an non-zero status code if the command is run +without clustered locking and some clustered Volume Groups have to be +skipped over. +.TP .B \-\-addtag \fITag Add the tag \fITag\fP to a PV, VG or LV. Supply this argument multiple times to add more than one tag at once.
man/lvs.8.in +1 -0
@@ -8,6 +8,7 @@ lvs \- report information about logical volumes .RB [ \-d | \-\-debug ] .RB [ \-h | \-? | \-\-help ] .RB [ \-\-ignorelockingfailure ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-nameprefixes ] .RB [ \-\-noheadings ] .RB [ \-\-nosuffix ]
man/pvdisplay.8.in +1 -0
@@ -7,6 +7,7 @@ pvdisplay \- display attributes of a physical volume .RB [ \-d | \-\-debug ] .RB [ \-h | \-? | \-\-help ] .RB [ \-\-ignorelockingfailure ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-maps ] .RB [ \-\-nosuffix ] .RB [ \-s | \-\-short ]
man/pvs.8.in +1 -0
@@ -8,6 +8,7 @@ pvs \- report information about physical volumes .RB [ \-d | \-\-debug ] .RB [ \-h | \-? | \-\-help ] .RB [ \-\-ignorelockingfailure ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-nameprefixes ] .RB [ \-\-noheadings ] .RB [ \-\-nosuffix ]
man/vgchange.8.in +1 -0
@@ -29,6 +29,7 @@ vgchange \- change attributes of a volume group .RB [ \-h | \-\-help ] .RB [ \-\-ignorelockingfailure ] .RB [ \-\-ignoremonitoring ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-sysinit ] .RB [ \-\-noudevsync ] .RB [ \-l | \-\-logicalvolume
man/vgdisplay.8.in +2 -0
@@ -10,6 +10,7 @@ vgdisplay \- display attributes of volume groups .RB [ \-d | \-\-debug ] .RB [ \-h | \-\-help ] .RB [ \-\-ignorelockingfailure ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-nosuffix ] .RB [ \-P | \-\-partial ] .RB [ \-\-units
@@ -26,6 +27,7 @@ vgdisplay \- display attributes of volume groups .RB [ \-d | \-\-debug ] .RB [ \-h | \-? | \-\-help ] .RB [ \-\-ignorelockingfailure ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-noheadings ] .RB [ \-\-nosuffix ] .RB [ \-o|\-\-options
man/vgs.8.in +1 -0
@@ -8,6 +8,7 @@ vgs \- report information about volume groups .RB [ \-d | \-\-debug ] .RB [ \-h | \-? | \-\-help ] .RB [ \-\-ignorelockingfailure ] +.RB [ \-\-ignoreskippedcluster ] .RB [ \-\-nameprefixes ] .RB [ \-\-noheadings ] .RB [ \-\-nosuffix ]
tools/args.h +1 -0
@@ -100,6 +100,7 @@ arg(raidmaxrecoveryrate_ARG, '\0', "raidmaxrecoveryrate", size_kb_arg, 0) arg(profile_ARG, '\0', "profile", string_arg, 0) arg(detachprofile_ARG, '\0', "detachprofile", NULL, 0) arg(mergedconfig_ARG, '\0', "mergedconfig", NULL, 0) +arg (ignoreskippedcluster_ARG,'\0' ,"ignoreskippedcluster" ,NULL ,0 ) /* Allow some variations */arg (resizable_ARG,'\0' ,"resizable" , yes_no_arg,0 )
tools/commands.h +28 -12
@@ -107,6 +107,7 @@ xx(lvchange,"\t[--discards {ignore|nopassdown|passdown}]\n" "\t[--ignorelockingfailure]\n" "\t[--ignoremonitoring]\n" +"\t[--ignoreskippedcluster]\n" "\t[-k|--setactivationskip {y|n}]\n" "\t[-K|--ignoreactivationskip] \n" "\t[--monitor {y|n}]\n"
@@ -135,6 +136,7 @@ xx(lvchange, addtag_ARG, alloc_ARG, autobackup_ARG, activate_ARG, available_ARG, contiguous_ARG, deltag_ARG, discards_ARG, detachprofile_ARG, force_ARG, ignorelockingfailure_ARG, ignoremonitoring_ARG, ignoreactivationskip_ARG, + ignoreskippedcluster_ARG, major_ARG, minor_ARG, monitor_ARG, minrecoveryrate_ARG, maxrecoveryrate_ARG, noudevsync_ARG, partial_ARG, permission_ARG, persistent_ARG, poll_ARG, profile_ARG, raidminrecoveryrate_ARG, raidmaxrecoveryrate_ARG,
@@ -303,6 +305,7 @@ xx(lvdisplay,"\t[-d|--debug]\n" "\t[-h|--help]\n" "\t[--ignorelockingfailure]\n" +"\t[--ignoreskippedcluster]\n" "\t[-m|--maps]\n" "\t[--nosuffix]\n" "\t[-P|--partial] " "\n"
@@ -317,6 +320,7 @@ xx(lvdisplay,"\t[-d|--debug]\n" "\t[-h|--help]\n" "\t[--ignorelockingfailure]\n" +"\t[--ignoreskippedcluster]\n" "\t[--noheadings]\n" "\t[--nosuffix]\n" "\t[-o|--options [+]Field[,Field]]\n"
@@ -330,8 +334,8 @@ xx(lvdisplay,"\t[--version]" "\n" "\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n" , - aligned_ARG, all_ARG, colon_ARG, columns_ARG, - ignorelockingfailure_ARG, maps_ARG, noheadings_ARG, nosuffix_ARG, + aligned_ARG, all_ARG, colon_ARG, columns_ARG, ignorelockingfailure_ARG, + ignoreskippedcluster_ARG, maps_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, sort_ARG, partial_ARG, segments_ARG, separator_ARG, unbuffered_ARG, units_ARG)
@@ -502,6 +506,7 @@ xx(lvs,"\t[-d|--debug]\n" "\t[-h|--help]\n" "\t[--ignorelockingfailure]\n" +"\t[--ignoreskippedcluster]\n" "\t[--nameprefixes]\n" "\t[--noheadings]\n" "\t[--nosuffix]\n"
@@ -519,7 +524,8 @@ xx(lvs,"\t[--version]" "\n" "\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n" , - aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, + aligned_ARG, all_ARG, ignorelockingfailure_ARG, ignoreskippedcluster_ARG, + nameprefixes_ARG, noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG, unquoted_ARG)
@@ -646,6 +652,7 @@ xx(pvdisplay,"\t[-d|--debug]\n" "\t[-h|--help]\n" "\t[--ignorelockingfailure]\n" +"\t[--ignoreskippedcluster]\n" "\t[-m|--maps]\n" "\t[--nosuffix]\n" "\t[-s|--short]\n"
@@ -660,6 +667,7 @@ xx(pvdisplay,"\t[-d|--debug]\n" "\t[-h|--help]\n" "\t[--ignorelockingfailure]\n" +"\t[--ignoreskippedcluster]\n" "\t[--noheadings]\n" "\t[--nosuffix]\n" "\t[-o|--options [+]Field[,Field]]\n"
@@ -672,8 +680,8 @@ xx(pvdisplay, "\t[PhysicalVolumePath [PhysicalVolumePath...]]\n", aligned_ARG, all_ARG, colon_ARG, columns_ARG, ignorelockingfailure_ARG, - maps_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, separator_ARG, - short_ARG, sort_ARG, unbuffered_ARG, units_ARG) + ignoreskippedcluster_ARG, maps_ARG, noheadings_ARG, nosuffix_ARG, + options_ARG, separator_ARG, short_ARG, sort_ARG, unbuffered_ARG, units_ARG) xx(pvmove, "Move extents from one physical volume to another",
@@ -722,6 +730,7 @@ xx(pvs,"\t[-d|--debug]" "\n" "\t[-h|-?|--help] " "\n" "\t[--ignorelockingfailure]\n" +"\t[--ignoreskippedcluster]\n" "\t[--nameprefixes]\n" "\t[--noheadings]\n" "\t[--nosuffix]\n"
@@ -739,10 +748,10 @@ xx(pvs, "\t[--version]\n" "\t[PhysicalVolume [PhysicalVolume...]]\n", - aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, - noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, - rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, - unbuffered_ARG, units_ARG, unquoted_ARG) + aligned_ARG, all_ARG, ignorelockingfailure_ARG, ignoreskippedcluster_ARG, + nameprefixes_ARG, noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, + partial_ARG, rows_ARG, segments_ARG, separator_ARG, sort_ARG, + trustcache_ARG, unbuffered_ARG, units_ARG, unquoted_ARG) xx(pvscan, "List all physical volumes",
@@ -813,6 +822,7 @@ xx(vgchange,"\t[-h|--help] " "\n" "\t[--ignorelockingfailure]\n" "\t[--ignoremonitoring]\n" +"\t[--ignoreskippedcluster]\n" "\t[-K|--ignoreactivationskip] \n" "\t[--monitor {y|n}]\n" "\t[--[vg]metadatacopies #copies] " "\n"
@@ -838,6 +848,7 @@ xx(vgchange, addtag_ARG, alloc_ARG, allocation_ARG, autobackup_ARG, activate_ARG, available_ARG, clustered_ARG, deltag_ARG, detachprofile_ARG, ignoreactivationskip_ARG, ignorelockingfailure_ARG, ignoremonitoring_ARG, + ignoreskippedcluster_ARG, logicalvolume_ARG, maxphysicalvolumes_ARG, monitor_ARG, noudevsync_ARG, metadatacopies_ARG, vgmetadatacopies_ARG, partial_ARG, profile_ARG, physicalextentsize_ARG, poll_ARG, refresh_ARG, resizeable_ARG,
@@ -910,6 +921,7 @@ xx(vgdisplay,"\t[-d|--debug] " "\n" "\t[-h|--help] " "\n" "\t[--ignorelockingfailure]" "\n" +"\t[--ignoreskippedcluster]\n" "\t[--nosuffix]\n" "\t[-P|--partial] " "\n" "\t[--units hHbBsSkKmMgGtTpPeE]\n"
@@ -921,6 +933,7 @@ xx(vgdisplay,"\t[-d|--debug] " "\n" "\t[-h|--help] " "\n" "\t[--ignorelockingfailure]" "\n" +"\t[--ignoreskippedcluster]\n" "\t[--noheadings]\n" "\t[--nosuffix]\n" "\t[-o|--options [+]Field[,Field]]\n"
@@ -934,8 +947,9 @@ xx(vgdisplay, "\t[VolumeGroupName [VolumeGroupName...]]\n", activevolumegroups_ARG, aligned_ARG, colon_ARG, columns_ARG, - ignorelockingfailure_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, - partial_ARG, short_ARG, separator_ARG, sort_ARG, unbuffered_ARG, units_ARG) + ignorelockingfailure_ARG, ignoreskippedcluster_ARG, noheadings_ARG, + nosuffix_ARG, options_ARG, partial_ARG, short_ARG, separator_ARG, + sort_ARG, unbuffered_ARG, units_ARG) xx(vgexport, "Unregister volume group(s) from the system",
@@ -1075,6 +1089,7 @@ xx(vgs,"\t[-d|--debug]\n" "\t[-h|--help]\n" "\t[--ignorelockingfailure]\n" +"\t[--ignoreskippedcluster]\n" "\t[--nameprefixes]\n" "\t[--noheadings]\n" "\t[--nosuffix]\n"
@@ -1091,7 +1106,8 @@ xx(vgs,"\t[--version]\n" "\t[VolumeGroupName [VolumeGroupName...]]\n" , - aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, + aligned_ARG, all_ARG, ignorelockingfailure_ARG, ignoreskippedcluster_ARG, + nameprefixes_ARG, noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, rows_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG, unquoted_ARG)
tools/lvmcmdline.c +2 -0
@@ -906,6 +906,8 @@ static int _get_settings(struct cmd_context *cmd)else init_ignorelockingfailure (0 ); + cmd->ignore_clustered_vgs =arg_count (cmd, ignoreskippedcluster_ARG) ?1 :0 ; +if (!arg_count (cmd, sysinit_ARG))lvmetad_connect_or_warn ();
tools/pvdisplay.c +3 -4
@@ -30,11 +30,10 @@ static int _pvdisplay_single(struct cmd_context *cmd,if (!is_orphan (pv) && !vg) { vg_name =pv_vg_name (pv); vg =vg_read (cmd, vg_name, (char *)&pv->vgid,0 ); -if (vg_read_error (vg)) { -log_error ("Skipping volume group %s" , vg_name); +if (ignore_vg (vg, vg_name,0 , &ret)) {release_vg (vg); -/* FIXME If CLUSTERED should return ECMD_PROCESSED here */ -return ECMD_FAILED ; + stack; +return ret; }/*
tools/reporter.c +15 -7
@@ -145,10 +145,10 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg, vg_name =pv_vg_name (pv); vg =vg_read (cmd, vg_name, (char *)&pv->vgid,0 ); -if (vg_read_error (vg)) { -log_error ("Skipping volume group %s" , vg_name); +if (ignore_vg (vg, vg_name,0 , &ret)) {release_vg (vg); -return ECMD_FAILED ; + stack; +return ret; }/*
@@ -205,8 +205,12 @@ static int _pvs_in_vg(struct cmd_context *cmd, const char *vg_name,struct volume_group *vg, void *handle) { - if (vg_read_error(vg)) - return_ECMD_FAILED; + int ret = ECMD_PROCESSED; + +if (ignore_vg (vg, vg_name,0 , &ret)) { + stack; +return ret; + }return process_each_pv_in_vg (cmd, vg,NULL , handle, &_pvs_single); }
@@ -215,8 +219,12 @@ static int _pvsegs_in_vg(struct cmd_context *cmd, const char *vg_name,struct volume_group *vg, void *handle) { - if (vg_read_error(vg)) - return_ECMD_FAILED; + int ret = ECMD_PROCESSED; + +if (ignore_vg (vg, vg_name,0 , &ret)) { + stack; +return ret; + }return process_each_pv_in_vg (cmd, vg,NULL , handle, &_pvsegs_single); }
tools/toollib.c +36 -17
100 lines not on this page · raw message
tools/toollib.h +2 -0
@@ -25,6 +25,8 @@ int autobackup_init(const char *backup_dir, int keep_days, int keep_number, int autobackup);int autobackup (struct volume_group *vg); +int ignore_vg (struct volume_group *vg,const char *vg_name,int allow_inconsistent,int *ret); +struct volume_group *recover_vg (struct cmd_context *cmd,const char *vgname,uint32_t lock_type);