mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
vgchange: deactivate LVs in foreign VG
Apply the same logic as lvchange, which allows deactivating LVs in a foreign VG.
This commit is contained in:
parent
926b38c0d7
commit
cccc2b2980
@ -196,6 +196,18 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
|
||||
const struct lv_list *lvl;
|
||||
int do_activate = is_change_activating(activate);
|
||||
|
||||
/*
|
||||
* We can get here in the odd case where an LV is already active in
|
||||
* a foreign VG, which allows the VG to be accessed by vgchange -a
|
||||
* so the LV can be deactivated.
|
||||
*/
|
||||
if (vg->system_id && cmd->system_id &&
|
||||
strcmp(vg->system_id, cmd->system_id) &&
|
||||
is_change_activating(activate)) {
|
||||
log_error("Cannot activate LVs in a foreign VG.");
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Safe, since we never write out new metadata here. Required for
|
||||
* partial activation to work.
|
||||
@ -795,6 +807,9 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
|
||||
if (!update || !update_partial_unsafe)
|
||||
cmd->handles_missing_pvs = 1;
|
||||
|
||||
if (arg_is_set(cmd, activate_ARG))
|
||||
cmd->include_active_foreign_vgs = 1;
|
||||
|
||||
return process_each_vg(cmd, argc, argv, update ? READ_FOR_UPDATE : 0,
|
||||
NULL, &vgchange_single);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user