1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

thin: lvchange support for errorwhenfull

Support lvchange --errorwhenfull y|n for thin pools.
This commit is contained in:
Zdenek Kabelac 2015-01-15 15:20:08 +01:00
parent 07eb1c7dc8
commit 64d8ed502d
3 changed files with 40 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.115 -
=====================================
Support lvchange --errorwhenfull for thin pools.
Improve the processing and reporting of duplicate PVs.
Report lv_health_status and health attribute also for thin pool.
Add lv_error_when_full reporting field.

View File

@ -111,6 +111,7 @@ xx(lvchange,
"\t[-d|--debug]\n"
"\t[--deltag Tag]\n"
"\t[--detachprofile]\n"
"\t[--errorwhenfull {y|n}]\n"
"\t[-f|--force]\n"
"\t[-h|--help]\n"
"\t[--discards {ignore|nopassdown|passdown}]\n"
@ -144,7 +145,8 @@ xx(lvchange,
activationmode_ARG, addtag_ARG, alloc_ARG, autobackup_ARG, activate_ARG,
available_ARG,
cachepolicy_ARG, cachesettings_ARG, contiguous_ARG, deltag_ARG, discards_ARG, detachprofile_ARG, force_ARG,
cachepolicy_ARG, cachesettings_ARG, contiguous_ARG, deltag_ARG, discards_ARG,
detachprofile_ARG, errorwhenfull_ARG, force_ARG,
ignorelockingfailure_ARG, ignoremonitoring_ARG, ignoreactivationskip_ARG,
ignoreskippedcluster_ARG, major_ARG, metadataprofile_ARG, minor_ARG,
monitor_ARG, minrecoveryrate_ARG, maxrecoveryrate_ARG, noudevsync_ARG,

View File

@ -487,6 +487,28 @@ static int lvchange_alloc(struct cmd_context *cmd, struct logical_volume *lv)
return 1;
}
static int lvchange_errorwhenfull(struct cmd_context *cmd,
struct logical_volume *lv)
{
unsigned ewf = arg_int_value(cmd, errorwhenfull_ARG, 0);
if (ewf == lv_is_error_when_full(lv)) {
log_error("Error when full is already %sset for %s.",
(ewf) ? "" : "un", display_lvname(lv));
return 0;
}
if (ewf)
lv->status |= LV_ERROR_WHEN_FULL;
else
lv->status &= ~LV_ERROR_WHEN_FULL;
if (!lv_update_and_reload(lv))
return_0;
return 1;
}
static int lvchange_readahead(struct cmd_context *cmd,
struct logical_volume *lv)
{
@ -910,6 +932,11 @@ static int _lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
}
}
if (arg_is_set(cmd, errorwhenfull_ARG) && !lv_is_thin_pool(lv)) {
log_error("Option --errorwhenfull is only supported with thin pools.");
return ECMD_FAILED;
}
/*
* FIXME: DEFAULT_BACKGROUND_POLLING should be "unspecified".
* If --poll is explicitly provided use it; otherwise polling
@ -939,6 +966,14 @@ static int _lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
docmds++;
}
/* error when full change */
if (arg_count(cmd, errorwhenfull_ARG)) {
if (!archive(lv->vg))
return_ECMD_FAILED;
doit += lvchange_errorwhenfull(cmd, lv);
docmds++;
}
/* read ahead sector change */
if (arg_count(cmd, readahead_ARG)) {
if (!archive(lv->vg))
@ -1076,6 +1111,7 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
int update_partial_unsafe =
arg_count(cmd, alloc_ARG) ||
arg_count(cmd, discards_ARG) ||
arg_count(cmd, errorwhenfull_ARG) ||
arg_count(cmd, minrecoveryrate_ARG) ||
arg_count(cmd, maxrecoveryrate_ARG) ||
arg_count(cmd, resync_ARG) ||