Commit 2cc1da8b authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert call_blockdev_addchildren to new result



This patch converts the blockdev_addchildren rpc call to the new result
format.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 6b5e3f70
......@@ -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):
......
......@@ -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)
......
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