1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

If pvmove fails activating mirror volume, try restore to previous state.

pvmove now keep suspended devices if temporary mirror creation fails.

We can try to restore previous state if it is first attempt to activate
pvmove (code basically run the same code as --abort automatically).
This commit is contained in:
Milan Broz 2009-05-19 09:51:02 +00:00
parent e1b0dce76e
commit 65edd11bfb
3 changed files with 20 additions and 6 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.46 - Version 2.02.46 -
================================ ================================
Fix pvmove to revert operation if temporary mirror creation fails.
Fix metadata export for VG with missing PVs. Fix metadata export for VG with missing PVs.
Add vgimportclone and install it and the man page by default. Add vgimportclone and install it and the man page by default.
Force max_lv restriction only for newly created LV. Force max_lv restriction only for newly created LV.

View File

@ -370,3 +370,8 @@ vgcreate $vg $devs
lvcreate -l4 -n $lv1 $vg $dev1 lvcreate -l4 -n $lv1 $vg $dev1
pvmove $dev1 pvmove $dev1
#COMM "pvmove fails activating mirror, properly restores state before pvmove"
dmsetup create "$vg-pvmove0" --notable
not pvmove -i 1 $dev2
test $(dmsetup info --noheadings -c -o suspended "$vg-$lv1") = "Active"
dmsetup remove "$vg-pvmove0"

View File

@ -274,6 +274,10 @@ static int _activate_lv(struct cmd_context *cmd, struct logical_volume *lv_mirr,
return activate_lv(cmd, lv_mirr); return activate_lv(cmd, lv_mirr);
} }
static int _finish_pvmove(struct cmd_context *cmd, struct volume_group *vg,
struct logical_volume *lv_mirr,
struct dm_list *lvs_changed);
static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg, static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg,
struct logical_volume *lv_mirr, struct logical_volume *lv_mirr,
struct dm_list *lvs_changed, unsigned flags) struct dm_list *lvs_changed, unsigned flags)
@ -315,12 +319,16 @@ static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg,
/* FIXME: Add option to use a log */ /* FIXME: Add option to use a log */
if (first_time) { if (first_time) {
if (!_activate_lv(cmd, lv_mirr, exclusive)) { if (!_activate_lv(cmd, lv_mirr, exclusive)) {
if (!test_mode()) if (test_mode())
log_error("ABORTING: Temporary mirror " goto out;
"activation failed. "
"Run pvmove --abort."); /*
/* FIXME Resume using *original* metadata here! */ * Nothing changed yet, try to revert pvmove.
resume_lvs(cmd, lvs_changed); */
log_error("Temporary pvmove mirror activation failed.");
if (!_finish_pvmove(cmd, vg, lv_mirr, lvs_changed))
log_error("ABORTING: Restoring original configuration "
"before pvmove failed. Run pvmove --abort.");
goto out; goto out;
} }
} else if (!resume_lv(cmd, lv_mirr)) { } else if (!resume_lv(cmd, lv_mirr)) {