mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
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.
This commit is contained in:
parent
23ce3352d7
commit
baf95bbff7
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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()) {
|
||||
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()) {
|
||||
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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 ]
|
||||
|
@ -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 ]
|
||||
|
@ -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 ]
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 ]
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -155,6 +155,29 @@ const char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name,
|
||||
return vg_name;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if VG should be ignored.
|
||||
*/
|
||||
int ignore_vg(struct volume_group *vg, const char *vg_name, int allow_inconsistent, int *ret)
|
||||
{
|
||||
uint32_t read_error = vg_read_error(vg);
|
||||
|
||||
if (!read_error)
|
||||
return 0;
|
||||
|
||||
if ((read_error == FAILED_INCONSISTENT) && allow_inconsistent)
|
||||
return 0;
|
||||
|
||||
if (read_error == FAILED_CLUSTERED && vg->cmd->ignore_clustered_vgs)
|
||||
log_verbose("Skipping volume group %s", vg_name);
|
||||
else {
|
||||
log_error("Skipping volume group %s", vg_name);
|
||||
*ret = ECMD_FAILED;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Metadata iteration functions
|
||||
*/
|
||||
@ -404,12 +427,10 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
|
||||
return_ECMD_FAILED;
|
||||
|
||||
if (!cmd_vg_read(cmd, &cmd_vgs)) {
|
||||
free_cmd_vgs(&cmd_vgs);
|
||||
if (ret_max < ECMD_FAILED) {
|
||||
log_error("Skipping volume group %s", vgname);
|
||||
ret_max = ECMD_FAILED;
|
||||
} else
|
||||
if (ignore_vg(cvl_vg->vg, vgname, 0, &ret_max))
|
||||
stack;
|
||||
|
||||
free_cmd_vgs(&cmd_vgs);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -489,10 +510,10 @@ int process_each_segment_in_pv(struct cmd_context *cmd,
|
||||
vg_name = pv_vg_name(pv);
|
||||
|
||||
vg = vg_read(cmd, vg_name, NULL, 0);
|
||||
if (vg_read_error(vg)) {
|
||||
if (ignore_vg(vg, vg_name, 0, &ret)) {
|
||||
release_vg(vg);
|
||||
log_error("Skipping volume group %s", vg_name);
|
||||
return ECMD_FAILED;
|
||||
stack;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -561,13 +582,13 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
|
||||
{
|
||||
struct dm_list cmd_vgs;
|
||||
struct cmd_vg *cvl_vg;
|
||||
int ret = 0;
|
||||
int ret = ECMD_PROCESSED;
|
||||
|
||||
log_verbose("Finding volume group \"%s\"", vg_name);
|
||||
|
||||
dm_list_init(&cmd_vgs);
|
||||
if (!(cvl_vg = cmd_vg_add(cmd->mem, &cmd_vgs, vg_name, vgid, flags)))
|
||||
return_0;
|
||||
return_ECMD_FAILED;
|
||||
|
||||
for (;;) {
|
||||
if (sigint_caught()) {
|
||||
@ -575,15 +596,14 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
|
||||
stack;
|
||||
break;
|
||||
}
|
||||
if (!cmd_vg_read(cmd, &cmd_vgs))
|
||||
|
||||
if (!cmd_vg_read(cmd, &cmd_vgs)) {
|
||||
/* Allow FAILED_INCONSISTENT through only for vgcfgrestore */
|
||||
if (vg_read_error(cvl_vg->vg) &&
|
||||
(!((flags & READ_ALLOW_INCONSISTENT) &&
|
||||
(vg_read_error(cvl_vg->vg) == FAILED_INCONSISTENT)))) {
|
||||
ret = ECMD_FAILED;
|
||||
if (ignore_vg(cvl_vg->vg, vg_name, flags & READ_ALLOW_INCONSISTENT, &ret)) {
|
||||
stack;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dm_list_empty(tags) &&
|
||||
/* Only process if a tag matches or it's on arg_vgnames */
|
||||
@ -889,8 +909,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
|
||||
goto_out;
|
||||
}
|
||||
vg = vg_read(cmd, sll->str, NULL, flags);
|
||||
if (vg_read_error(vg)) {
|
||||
ret_max = ECMD_FAILED;
|
||||
if (ignore_vg(vg, sll->str, 0, &ret_max)) {
|
||||
release_vg(vg);
|
||||
stack;
|
||||
continue;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user