mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Check for locked LVs/pvmoves.
This commit is contained in:
parent
361e5e3fac
commit
46a29c0212
@ -76,6 +76,7 @@ static int lvchange_availability(struct cmd_context *cmd,
|
||||
struct logical_volume *lv)
|
||||
{
|
||||
int activate = 0;
|
||||
struct physical_volume *pv;
|
||||
|
||||
if (strcmp(arg_str_value(cmd, available_ARG, "n"), "n"))
|
||||
activate = 1;
|
||||
@ -85,6 +86,11 @@ static int lvchange_availability(struct cmd_context *cmd,
|
||||
log_verbose("Activating logical volume \"%s\"", lv->name);
|
||||
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_ACTIVATE))
|
||||
return 0;
|
||||
if ((lv->status & LOCKED) && (pv = get_pvmove_pv_from_lv(lv))) {
|
||||
log_verbose("Spawning background pvmove process for %s",
|
||||
dev_name(pv->dev));
|
||||
pvmove_poll(cmd, dev_name(pv->dev), 1);
|
||||
}
|
||||
} else {
|
||||
log_verbose("Deactivating logical volume \"%s\"", lv->name);
|
||||
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_DEACTIVATE))
|
||||
@ -289,6 +295,13 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (lv->status & PVMOVE) {
|
||||
log_error("Unable to change pvmove LV %s", lv->name);
|
||||
if (arg_count(cmd, available_ARG))
|
||||
log_error("Use 'pvmove --abort' to abandon a pvmove");
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
/* access permission change */
|
||||
if (arg_count(cmd, permission_ARG)) {
|
||||
if (!archive(lv->vg))
|
||||
|
@ -25,18 +25,31 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
|
||||
{
|
||||
struct list *lvh;
|
||||
struct logical_volume *lv;
|
||||
struct physical_volume *pv;
|
||||
int count = 0;
|
||||
|
||||
list_iterate(lvh, &vg->lvs) {
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
|
||||
/* Only request activatation of snapshot origin devices */
|
||||
/* Only request activation of snapshot origin devices */
|
||||
if (lv_is_cow(lv))
|
||||
continue;
|
||||
|
||||
/* Can't deactive a pvmove LV */
|
||||
if ((lock == LCK_LV_DEACTIVATE) && (lv->status & PVMOVE))
|
||||
continue;
|
||||
|
||||
if (!lock_vol(cmd, lv->lvid.s, lock | LCK_NONBLOCK))
|
||||
continue;
|
||||
|
||||
if ((lv->status & PVMOVE) &&
|
||||
(pv = get_pvmove_pv_from_lv_mirr(lv))) {
|
||||
log_verbose("Spawning background process for %s %s",
|
||||
lv->name, dev_name(pv->dev));
|
||||
pvmove_poll(cmd, dev_name(pv->dev), 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user