Commit 9205a895 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert call_blockdev_removechildren to new result



This patch converts blockdev_removechildren to new result type and
slightly changes a message in addchildren to match this (paired)
function.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 2cc1da8b
......@@ -1326,7 +1326,7 @@ def BlockdevAddchildren(parent_cdev, new_cdevs):
"""
parent_bdev = _RecursiveFindBD(parent_cdev)
if parent_bdev is None:
msg = "Can't find parent device %s" % str(parent_cdev)
msg = "Can't find parent device '%s' in add children" % str(parent_cdev)
logging.error("BlockdevAddchildren: %s", msg)
return (False, msg)
new_bdevs = [_RecursiveFindBD(disk) for disk in new_cdevs]
......@@ -1351,23 +1351,24 @@ def BlockdevRemovechildren(parent_cdev, new_cdevs):
"""
parent_bdev = _RecursiveFindBD(parent_cdev)
if parent_bdev is None:
logging.error("Can't find parent in remove children: %s", parent_cdev)
return False
msg = "Can't find parent device '%s' in remove children" % str(parent_cdev)
logging.error(msg)
return (False, msg)
devs = []
for disk in new_cdevs:
rpath = disk.StaticDevPath()
if rpath is None:
bd = _RecursiveFindBD(disk)
if bd is None:
logging.error("Can't find dynamic device %s while removing children",
disk)
return False
msg = "Can't find device %s while removing children" % (disk,)
logging.error(msg)
return (False, msg)
else:
devs.append(bd.dev_path)
else:
devs.append(rpath)
parent_bdev.RemoveChildren(devs)
return True
return (True, None)
def BlockdevGetmirrorstatus(disks):
......
......@@ -5224,10 +5224,11 @@ class LUReplaceDisks(LogicalUnit):
for dev, old_lvs, new_lvs in iv_names.itervalues():
info("detaching %s drbd from local storage" % dev.iv_name)
result = self.rpc.call_blockdev_removechildren(tgt_node, dev, old_lvs)
result.Raise()
if not result.data:
msg = result.RemoteFailMsg()
if msg:
raise errors.OpExecError("Can't detach drbd from local storage on node"
" %s for device %s" % (tgt_node, dev.iv_name))
" %s for device %s: %s" %
(tgt_node, dev.iv_name, msg))
#dev.children = []
#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