Commit 1b3fbef6 authored by Guido Trotter's avatar Guido Trotter
Browse files

Catch DeviceCreationError unhandled exceptions



_CreateBlockDevInner is called twice in TLReplaceDisks. While this
should be fixed, right now this leaves the DeviceCreationError exception
unhandled, which causes a problem due to the fact that this exception
was never supposed to be sent over the wire. For 2.7 we just catch the
exception and convert it to an OpExecError, but we should later do a
more proper cleanup.

This addresses Issue 472.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent bbf50ea0
......@@ -12001,9 +12001,12 @@ class TLReplaceDisks(Tasklet):
 
# we pass force_create=True to force the LVM creation
for new_lv in new_lvs:
_CreateBlockDevInner(self.lu, node_name, self.instance, new_lv, True,
_GetInstanceInfoText(self.instance), False,
excl_stor)
try:
_CreateBlockDevInner(self.lu, node_name, self.instance, new_lv,
True, _GetInstanceInfoText(self.instance),
False, excl_stor)
except errors.DeviceCreationError, e:
raise errors.OpExecError("Can't create block device: %s" % e.message)
 
return iv_names
 
......@@ -12218,9 +12221,12 @@ class TLReplaceDisks(Tasklet):
(self.new_node, idx))
# we pass force_create=True to force LVM creation
for new_lv in dev.children:
_CreateBlockDevInner(self.lu, self.new_node, self.instance, new_lv,
True, _GetInstanceInfoText(self.instance), False,
excl_stor)
try:
_CreateBlockDevInner(self.lu, self.new_node, self.instance, new_lv,
True, _GetInstanceInfoText(self.instance),
False, excl_stor)
except errors.DeviceCreationError, e:
raise errors.OpExecError("Can't create block device: %s" % e.message)
 
# Step 4: dbrd minors and drbd setups changes
# after this, we must manually remove the drbd minors on both the
......
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