diff --git a/lib/backend.py b/lib/backend.py index 2c601dbb6ac1f0f40e9c4b44d20e3cc6c963582d..e56628e9934d4c4babb8efe153d88728af1fa28c 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1248,18 +1248,26 @@ def BlockdevShutdown(disk): @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): diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 3171c18fd996fd87066e4211b58ccf33944eca13..4b9f62c2a5e6d280ffb5e4c6ae3df99c94966bf4 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2572,17 +2572,18 @@ def _ShutdownInstanceDisks(lu, instance, ignore_primary=False): 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): @@ -5197,9 +5198,10 @@ class LUReplaceDisks(LogicalUnit): # 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)")