1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00

Use lock query instead of activate_lv_excl

- switch lvremove to not force activate volume when removing
 - ditto for force resync

 - fix some wrong return codes in lvchange_resync()
This commit is contained in:
Milan Broz 2009-05-20 09:55:33 +00:00
parent eb91c4eee3
commit a01e55b6ec
3 changed files with 17 additions and 31 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.46 - Version 2.02.46 -
================================ ================================
Use lock query instead of activate_lv_excl.
Enable online resizing of mirrors. Enable online resizing of mirrors.
Use suspend with flush when device size was changed during table preload. Use suspend with flush when device size was changed during table preload.
Introduce CLVMD_CMD_LOCK_QUERY command for clvmd. Introduce CLVMD_CMD_LOCK_QUERY command for clvmd.

View File

@ -2036,29 +2036,14 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
return 0; return 0;
} }
/* if (lv_is_active(lv) && (force == PROMPT) &&
* Check for confirmation prompts in the following cases: yes_no_prompt("Do you really want to remove active "
* 1) Clustered VG, and some remote nodes have the LV active "%slogical volume %s? [y/n]: ",
* 2) Non-clustered VG, but LV active locally vg_is_clustered(vg) ? "clustered " : "",
*/
if (vg_is_clustered(vg) && !activate_lv_excl(cmd, lv) &&
(force == PROMPT)) {
if (yes_no_prompt("Logical volume \"%s\" is active on other "
"cluster nodes. Really remove? [y/n]: ",
lv->name) == 'n') { lv->name) == 'n') {
log_print("Logical volume \"%s\" not removed", log_print("Logical volume %s not removed", lv->name);
lv->name);
return 0; return 0;
} }
} else if (info.exists && (force == PROMPT)) {
if (yes_no_prompt("Do you really want to remove active "
"logical volume \"%s\"? [y/n]: ",
lv->name) == 'n') {
log_print("Logical volume \"%s\" not removed",
lv->name);
return 0;
}
}
} }
if (!archive(vg)) if (!archive(vg))

View File

@ -201,7 +201,7 @@ static int lvchange_resync(struct cmd_context *cmd,
if (info.open_count) { if (info.open_count) {
log_error("Can't resync open logical volume \"%s\"", log_error("Can't resync open logical volume \"%s\"",
lv->name); lv->name);
return ECMD_FAILED; return 0;
} }
if (info.exists) { if (info.exists) {
@ -211,11 +211,11 @@ static int lvchange_resync(struct cmd_context *cmd,
lv->name) == 'n') { lv->name) == 'n') {
log_print("Logical volume \"%s\" not resynced", log_print("Logical volume \"%s\" not resynced",
lv->name); lv->name);
return ECMD_FAILED; return 0;
} }
if (sigint_caught()) if (sigint_caught())
return ECMD_FAILED; return 0;
active = 1; active = 1;
} }
@ -225,17 +225,17 @@ static int lvchange_resync(struct cmd_context *cmd,
monitored = dmeventd_monitor_mode(); monitored = dmeventd_monitor_mode();
init_dmeventd_monitor(0); init_dmeventd_monitor(0);
if (vg_is_clustered(lv->vg) && !activate_lv_excl(cmd, lv)) {
log_error("Can't get exclusive access to clustered volume %s",
lv->name);
return ECMD_FAILED;
}
if (!deactivate_lv(cmd, lv)) { if (!deactivate_lv(cmd, lv)) {
log_error("Unable to deactivate %s for resync", lv->name); log_error("Unable to deactivate %s for resync", lv->name);
return 0; return 0;
} }
if (vg_is_clustered(lv->vg) && lv_is_active(lv)) {
log_error("Can't get exclusive access to clustered volume %s",
lv->name);
return 0;
}
init_dmeventd_monitor(monitored); init_dmeventd_monitor(monitored);
log_lv = first_seg(lv)->log_lv; log_lv = first_seg(lv)->log_lv;