mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-30 10:50:34 +03:00
lvconvert: use lp->repair
Set variable for repair testing.
This commit is contained in:
parent
ec8a75a321
commit
cdcf4cc794
@ -28,6 +28,7 @@ struct lvconvert_params {
|
||||
int merge;
|
||||
int merge_mirror;
|
||||
int poolmetadataspare;
|
||||
int repair;
|
||||
int thin;
|
||||
int uncache;
|
||||
int yes;
|
||||
@ -194,7 +195,7 @@ static int _lvconvert_name_params(struct lvconvert_params *lp,
|
||||
lp->lv_name = lp->lv_name_full;
|
||||
|
||||
if (!lp->merge_mirror &&
|
||||
!arg_count(cmd, repair_ARG) &&
|
||||
!lp->repair &&
|
||||
!arg_count(cmd, splitmirrors_ARG) &&
|
||||
!strstr(lp->lv_name, "_tdata") &&
|
||||
!strstr(lp->lv_name, "_tmeta") &&
|
||||
@ -383,14 +384,16 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
|
||||
if (!_check_conversion_type(cmd, type_str))
|
||||
return_0;
|
||||
|
||||
if (arg_count(cmd, repair_ARG) &&
|
||||
arg_outside_list_is_set(cmd, "cannot be used with --repair",
|
||||
repair_ARG,
|
||||
alloc_ARG, usepolicies_ARG,
|
||||
stripes_long_ARG, stripesize_ARG,
|
||||
force_ARG, noudevsync_ARG, test_ARG,
|
||||
-1))
|
||||
return_0;
|
||||
if (arg_count(cmd, repair_ARG)) {
|
||||
if (arg_outside_list_is_set(cmd, "cannot be used with --repair",
|
||||
repair_ARG,
|
||||
alloc_ARG, usepolicies_ARG,
|
||||
stripes_long_ARG, stripesize_ARG,
|
||||
force_ARG, noudevsync_ARG, test_ARG,
|
||||
-1))
|
||||
return_0;
|
||||
lp->repair = 1;
|
||||
}
|
||||
|
||||
if (arg_is_set(cmd, mirrorlog_ARG) && arg_is_set(cmd, corelog_ARG)) {
|
||||
log_error("--mirrorlog and --corelog are incompatible.");
|
||||
@ -436,7 +439,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
|
||||
|
||||
if ((_snapshot_type_requested(cmd, type_str) || arg_count(cmd, merge_ARG)) &&
|
||||
(arg_count(cmd, mirrorlog_ARG) || _mirror_or_raid_type_requested(cmd, type_str) ||
|
||||
arg_count(cmd, repair_ARG) || arg_count(cmd, thinpool_ARG))) {
|
||||
lp->repair || arg_count(cmd, thinpool_ARG))) {
|
||||
log_error("--snapshot/--type snapshot or --merge argument "
|
||||
"cannot be mixed with --mirrors/--type mirror/--type raid*, "
|
||||
"--mirrorlog, --repair or --thinpool.");
|
||||
@ -445,7 +448,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
|
||||
|
||||
if ((arg_count(cmd, stripes_long_ARG) || arg_count(cmd, stripesize_ARG)) &&
|
||||
!(_mirror_or_raid_type_requested(cmd, type_str) ||
|
||||
arg_count(cmd, repair_ARG) ||
|
||||
lp->repair ||
|
||||
arg_count(cmd, thinpool_ARG))) {
|
||||
log_error("--stripes or --stripesize argument is only valid "
|
||||
"with --mirrors/--type mirror/--type raid*, --repair and --thinpool");
|
||||
@ -1143,7 +1146,6 @@ static int _lvconvert_mirrors_parse_params(struct cmd_context *cmd,
|
||||
uint32_t *new_mimage_count,
|
||||
uint32_t *new_log_count)
|
||||
{
|
||||
int repair = arg_count(cmd, repair_ARG);
|
||||
*old_mimage_count = lv_mirror_count(lv);
|
||||
*old_log_count = _get_log_count(lv);
|
||||
|
||||
@ -1160,7 +1162,7 @@ static int _lvconvert_mirrors_parse_params(struct cmd_context *cmd,
|
||||
*/
|
||||
if (!arg_count(cmd, mirrors_ARG) && !arg_count(cmd, mirrorlog_ARG) &&
|
||||
!arg_count(cmd, corelog_ARG) && !arg_count(cmd, regionsize_ARG) &&
|
||||
!arg_count(cmd, splitmirrors_ARG) && !repair) {
|
||||
!arg_count(cmd, splitmirrors_ARG) && !lp->repair) {
|
||||
*new_mimage_count = *old_mimage_count;
|
||||
*new_log_count = *old_log_count;
|
||||
|
||||
@ -1605,7 +1607,6 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
|
||||
struct logical_volume *lv,
|
||||
struct lvconvert_params *lp)
|
||||
{
|
||||
int repair = arg_count(cmd, repair_ARG);
|
||||
uint32_t old_mimage_count;
|
||||
uint32_t old_log_count;
|
||||
uint32_t new_mimage_count;
|
||||
@ -1651,10 +1652,10 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
|
||||
|
||||
/* Nothing to do? (Probably finishing collapse.) */
|
||||
if ((old_mimage_count == new_mimage_count) &&
|
||||
(old_log_count == new_log_count) && !repair)
|
||||
(old_log_count == new_log_count) && !lp->repair)
|
||||
return 1;
|
||||
|
||||
if (repair)
|
||||
if (lp->repair)
|
||||
return _lvconvert_mirrors_repair(cmd, lv, lp);
|
||||
|
||||
if (!_lvconvert_mirrors_aux(cmd, lv, lp, NULL,
|
||||
@ -1778,7 +1779,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
|
||||
if (arg_count(cmd, replace_ARG))
|
||||
return lv_raid_replace(lv, lp->replace_pvh, lp->pvh);
|
||||
|
||||
if (arg_count(cmd, repair_ARG)) {
|
||||
if (lp->repair) {
|
||||
if (!lv_is_active_exclusive_locally(lv_lock_holder(lv))) {
|
||||
log_error("%s/%s must be active %sto perform this"
|
||||
" operation.", lv->vg->name, lv->name,
|
||||
@ -3277,7 +3278,7 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
}
|
||||
}
|
||||
|
||||
if (arg_count(cmd, repair_ARG)) {
|
||||
if (lp->repair) {
|
||||
if (lv_is_pool(lv)) {
|
||||
if (lv_is_cache_pool(lv)) {
|
||||
log_error("Repair for cache pool %s not yet implemented.",
|
||||
@ -3350,7 +3351,7 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
return_ECMD_FAILED;
|
||||
|
||||
/* If repairing and using policies, remove missing PVs from VG */
|
||||
if (arg_count(cmd, repair_ARG) && arg_count(cmd, usepolicies_ARG))
|
||||
if (lp->repair && arg_count(cmd, usepolicies_ARG))
|
||||
_remove_missing_empty_pv(lv->vg, failed_pvs);
|
||||
} else if (arg_count(cmd, mirrors_ARG) ||
|
||||
arg_count(cmd, splitmirrors_ARG) ||
|
||||
@ -3365,7 +3366,7 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
return_ECMD_FAILED;
|
||||
|
||||
/* If repairing and using policies, remove missing PVs from VG */
|
||||
if (arg_count(cmd, repair_ARG) && arg_count(cmd, usepolicies_ARG))
|
||||
if (lp->repair && arg_count(cmd, usepolicies_ARG))
|
||||
_remove_missing_empty_pv(lv->vg, failed_pvs);
|
||||
}
|
||||
|
||||
@ -3425,7 +3426,7 @@ static int lvconvert_single(struct cmd_context *cmd, struct lvconvert_params *lp
|
||||
int saved_ignore_suspended_devices = ignore_suspended_devices();
|
||||
uint32_t lockd_state = 0;
|
||||
|
||||
if (arg_count(cmd, repair_ARG)) {
|
||||
if (lp->repair) {
|
||||
init_ignore_suspended_devices(1);
|
||||
cmd->handles_missing_pvs = 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user