mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-10 05:18:36 +03:00
Refuse to open VG with MISSING_PVs for update unless handles_missing_pvs is set.
This commit is contained in:
parent
dc8f5ef279
commit
fa059a59a8
@ -2940,6 +2940,14 @@ static vg_t *_vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
|
||||
}
|
||||
}
|
||||
|
||||
if (!cmd->handles_missing_pvs && vg_missing_pv_count(vg) &&
|
||||
(lock_flags & LCK_WRITE)) {
|
||||
log_error("Cannot change VG %s while PVs are missing!",
|
||||
vg->name);
|
||||
failure |= FAILED_INCONSISTENT; /* FIXME new failure code here? */
|
||||
goto_bad;
|
||||
}
|
||||
|
||||
failure |= _vg_bad_status_bits(vg, status_flags);
|
||||
if (failure)
|
||||
goto_bad;
|
||||
|
@ -9,3 +9,7 @@ disable_dev $dev1
|
||||
not vgreduce --removemissing $vg
|
||||
not lvchange -v -a y $vg/mirror
|
||||
lvchange -v --partial -a y $vg/mirror
|
||||
|
||||
# also check that vgchange works
|
||||
vgchange -a n --partial $vg
|
||||
vgchange -a y --partial $vg
|
||||
|
@ -696,15 +696,21 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
if (arg_count(cmd, ignorelockingfailure_ARG) &&
|
||||
(arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
|
||||
int avail_only =
|
||||
!(arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
|
||||
arg_count(cmd, readahead_ARG) || arg_count(cmd, persistent_ARG) ||
|
||||
arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG) ||
|
||||
arg_count(cmd, refresh_ARG) || arg_count(cmd, alloc_ARG))) {
|
||||
arg_count(cmd, refresh_ARG) || arg_count(cmd, alloc_ARG) ||
|
||||
arg_count(cmd, resync_ARG));
|
||||
|
||||
if (arg_count(cmd, ignorelockingfailure_ARG) && !avail_only) {
|
||||
log_error("Only -a permitted with --ignorelockingfailure");
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
if (avail_only)
|
||||
cmd->handles_missing_pvs = 1;
|
||||
|
||||
if (!argc) {
|
||||
log_error("Please give logical volume path(s)");
|
||||
return EINVALID_CMD_LINE;
|
||||
|
@ -929,8 +929,10 @@ int lvconvert(struct cmd_context * cmd, int argc, char **argv)
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
if (arg_count(cmd, repair_ARG))
|
||||
if (arg_count(cmd, repair_ARG)) {
|
||||
init_ignore_suspended_devices(1);
|
||||
cmd->handles_missing_pvs = 1;
|
||||
}
|
||||
|
||||
log_verbose("Checking for existing volume group \"%s\"", lp.vg_name);
|
||||
|
||||
|
@ -126,6 +126,12 @@ static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
|
||||
int available;
|
||||
int activate = 1;
|
||||
|
||||
/*
|
||||
* Safe, since we never write out new metadata here. Required for
|
||||
* partial activation to work.
|
||||
*/
|
||||
cmd->handles_missing_pvs = 1;
|
||||
|
||||
available = arg_uint_value(cmd, available_ARG, 0);
|
||||
|
||||
if ((available == CHANGE_AN) || (available == CHANGE_ALN))
|
||||
|
@ -510,8 +510,10 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
|
||||
|
||||
log_verbose("Finding volume group \"%s\"", vg_name);
|
||||
|
||||
if (repairing)
|
||||
if (repairing) {
|
||||
init_ignore_suspended_devices(1);
|
||||
cmd->handles_missing_pvs = 1;
|
||||
}
|
||||
|
||||
vg = vg_read_for_update(cmd, vg_name, NULL, READ_ALLOW_EXPORTED);
|
||||
if (vg_read_error(vg) == FAILED_ALLOCATION ||
|
||||
|
Loading…
Reference in New Issue
Block a user