From 1b3fbef66f0cf87fe0e6c3a49de54ddb94b3fdc1 Mon Sep 17 00:00:00 2001 From: Guido Trotter Date: Fri, 21 Jun 2013 15:23:28 +0200 Subject: [PATCH] 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: Guido Trotter Reviewed-by: Michele Tartara --- lib/cmdlib.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 28dec18..ba1ad64 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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 -- 1.7.10.4