diff options
author | Jonathan Earl Brassow <jbrassow@redhat.com> | 2012-04-24 20:05:31 +0000 |
---|---|---|
committer | Jonathan Earl Brassow <jbrassow@redhat.com> | 2012-04-24 20:05:31 +0000 |
commit | dfd024d3a810c63a3b4fa45c43b9f2edee023a3e (patch) | |
tree | cb11f5f2e4de09ca4c7226d16f704d57493f9512 /lib | |
parent | 2bfb3e519a934a28f1eb003cc74ef4197299ed06 (diff) | |
download | lvm2-dfd024d3a810c63a3b4fa45c43b9f2edee023a3e.tar.gz lvm2-dfd024d3a810c63a3b4fa45c43b9f2edee023a3e.tar.xz lvm2-dfd024d3a810c63a3b4fa45c43b9f2edee023a3e.zip |
Allow a subset of failed devices to be replaced in RAID LVs.
If two devices in an array failed, it was previously impossible to replace
just one of them. This patch allows for the replacement of some, but perhaps
not all, failed devices.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/metadata/raid_manip.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 3df043fe..a3d6709c 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -1632,10 +1632,28 @@ int lv_raid_replace(struct logical_volume *lv, * * - We need to change the LV names when we insert them. */ +try_again: if (!_alloc_image_components(lv, allocate_pvs, match_count, &new_meta_lvs, &new_data_lvs)) { log_error("Failed to allocate replacement images for %s/%s", lv->vg->name, lv->name); + + /* + * If this is a repair, then try to + * do better than all-or-nothing + */ + if (match_count > 1) { + log_error("Attempting replacement of %u devices" + " instead of %u", match_count - 1, match_count); + match_count--; + + /* + * Since we are replacing some but not all of the bad + * devices, we must set partial_activation + */ + lv->vg->cmd->partial_activation = 1; + goto try_again; + } return 0; } |