Skip to content
Snippets Groups Projects
Commit f38270c6 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

In plain to drbd conversion, rename LVs back on failure


Currently, if converting an instance from plain to drbd fails after
renaming the original LVs, the instance is left in an inconsistent
state. This commit tries to undo the renaming if a failure occurs
on assembling a DRBD device, e.g., when device minor numbers are
exhausted. (Issue 229)

Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent d466fd8b
No related branches found
No related tags found
Loading
...@@ -14008,11 +14008,22 @@ class LUInstanceSetParams(LogicalUnit): ...@@ -14008,11 +14008,22 @@ class LUInstanceSetParams(LogicalUnit):
   
feedback_fn("Initializing DRBD devices...") feedback_fn("Initializing DRBD devices...")
# all child devices are in place, we can now create the DRBD devices # all child devices are in place, we can now create the DRBD devices
for disk in anno_disks: try:
for (node, excl_stor) in [(pnode, p_excl_stor), (snode, s_excl_stor)]: for disk in anno_disks:
f_create = node == pnode for (node, excl_stor) in [(pnode, p_excl_stor), (snode, s_excl_stor)]:
_CreateSingleBlockDev(self, node, instance, disk, info, f_create, f_create = node == pnode
excl_stor) _CreateSingleBlockDev(self, node, instance, disk, info, f_create,
excl_stor)
except errors.GenericError, e:
feedback_fn("Initializing of DRBD devices failed;"
" renaming back original volumes...")
for disk in new_disks:
self.cfg.SetDiskID(disk, pnode)
rename_back_list = [(n.children[0], o.logical_id)
for (n, o) in zip(new_disks, instance.disks)]
result = self.rpc.call_blockdev_rename(pnode, rename_back_list)
result.Raise("Failed to rename LVs back after error %s" % str(e))
raise
   
# at this point, the instance has been modified # at this point, the instance has been modified
instance.disk_template = constants.DT_DRBD8 instance.disk_template = constants.DT_DRBD8
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment