@return: the success of the operation
"""
+ msgs = []
r_dev = _RecursiveFindBD(disk)
if r_dev is not None:
r_path = r_dev.dev_path
- result = r_dev.Shutdown()
+ try:
+ result = r_dev.Shutdown()
+ except errors.BlockDeviceError, err:
+ msgs.append(str(err))
+ result = False
if result:
DevCacheManager.RemoveCache(r_path)
else:
result = True
if disk.children:
for child in disk.children:
- result = result and BlockdevShutdown(child)
- return result
+ c_status, c_msg = BlockdevShutdown(child)
+ result = result and c_status
+ if c_msg: # not an empty message
+ msgs.append(c_msg)
+ return (result, "; ".join(msgs))
def BlockdevAddchildren(parent_cdev, new_cdevs):
ignored.
"""
- result = True
+ all_result = True
for disk in instance.disks:
for node, top_disk in disk.ComputeNodeTree(instance.primary_node):
lu.cfg.SetDiskID(top_disk, node)
result = lu.rpc.call_blockdev_shutdown(node, top_disk)
- if result.failed or not result.data:
- logging.error("Could not shutdown block device %s on node %s",
- disk.iv_name, node)
+ msg = result.RemoteFailMsg()
+ if msg:
+ lu.LogWarning("Could not shutdown block device %s on node %s: %s",
+ disk.iv_name, node, msg)
if not ignore_primary or node != instance.primary_node:
- result = False
- return result
+ all_result = False
+ return all_result
def _CheckNodeFreeMemory(lu, node, reason, requested, hypervisor_name):
# we have new devices, shutdown the drbd on the old secondary
info("shutting down drbd for disk/%d on old node" % idx)
cfg.SetDiskID(dev, old_node)
- result = self.rpc.call_blockdev_shutdown(old_node, dev)
- if result.failed or not result.data:
- warning("Failed to shutdown drbd for disk/%d on old node" % idx,
+ msg = self.rpc.call_blockdev_shutdown(old_node, dev).RemoteFailMsg()
+ if msg:
+ warning("Failed to shutdown drbd for disk/%d on old node: %s" %
+ (idx, msg),
hint="Please cleanup this device manually as soon as possible")
info("detaching primary drbds from the network (=> standalone)")