diff --git a/lib/backend.py b/lib/backend.py index 9586994a09c9cd39e7c611cf404edcfbe13fe9d8..f941fbb9b095912335c3831aa2712e671c922010 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1326,15 +1326,16 @@ def BlockdevAddchildren(parent_cdev, new_cdevs): """ parent_bdev = _RecursiveFindBD(parent_cdev) if parent_bdev is None: - logging.error("Can't find parent device") - return False + msg = "Can't find parent device %s" % str(parent_cdev) + logging.error("BlockdevAddchildren: %s", msg) + return (False, msg) new_bdevs = [_RecursiveFindBD(disk) for disk in new_cdevs] if new_bdevs.count(None) > 0: - logging.error("Can't find new device(s) to add: %s:%s", - new_bdevs, new_cdevs) - return False + msg = "Can't find new device(s) to add: %s:%s" % (new_bdevs, new_cdevs) + logging.error(msg) + return (False, msg) parent_bdev.AddChildren(new_bdevs) - return True + return (True, None) def BlockdevRemovechildren(parent_cdev, new_cdevs): diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 4bd74b65dece7dfba1cc2cc9e54c9175af6ce384..fba9bb7d452a1d732f3d2ed61981f6d7b8d80b8a 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -5275,13 +5275,14 @@ class LUReplaceDisks(LogicalUnit): # now that the new lvs have the old name, we can add them to the device info("adding new mirror component on %s" % tgt_node) result = self.rpc.call_blockdev_addchildren(tgt_node, dev, new_lvs) - if result.failed or not result.data: + msg = result.RemoteFailMsg() + if msg: for new_lv in new_lvs: msg = self.rpc.call_blockdev_remove(tgt_node, new_lv).RemoteFailMsg() if msg: warning("Can't rollback device %s: %s", dev, msg, hint="cleanup manually the unused logical volumes") - raise errors.OpExecError("Can't add local storage to drbd") + raise errors.OpExecError("Can't add local storage to drbd: %s" % msg) dev.children = new_lvs cfg.Update(instance)