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
......@@ -14008,11 +14008,22 @@ class LUInstanceSetParams(LogicalUnit):
 
feedback_fn("Initializing DRBD devices...")
# all child devices are in place, we can now create the DRBD devices
for disk in anno_disks:
for (node, excl_stor) in [(pnode, p_excl_stor), (snode, s_excl_stor)]:
f_create = node == pnode
_CreateSingleBlockDev(self, node, instance, disk, info, f_create,
excl_stor)
try:
for disk in anno_disks:
for (node, excl_stor) in [(pnode, p_excl_stor), (snode, s_excl_stor)]:
f_create = node == pnode
_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
instance.disk_template = constants.DT_DRBD8
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment