Commit 53c14ef1 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert blockdev_assemble rpc to (status, data)

This converts the RPC call blockdev_assemble to the new-style result
format. Note that we won't usually have error information, but it's the
first step toward it.

Reviewed-by: ultrotter
parent 7a6b9510
......@@ -1216,10 +1216,18 @@ def BlockdevAssemble(disk, owner, as_primary):
C{True} for secondary nodes
"""
result = _RecursiveAssembleBD(disk, owner, as_primary)
if isinstance(result, bdev.BlockDev):
result = result.dev_path
return result
status = False
result = "no error information"
try:
result = _RecursiveAssembleBD(disk, owner, as_primary)
if isinstance(result, bdev.BlockDev):
result = result.dev_path
status = True
if result == True:
status = True
except errors.BlockDeviceError, err:
result = "Error while assembling disk: %s" % str(err)
return (status, result)
def BlockdevShutdown(disk):
......
......@@ -2459,10 +2459,11 @@ def _AssembleInstanceDisks(lu, instance, ignore_secondaries=False):
for node, node_disk in inst_disk.ComputeNodeTree(instance.primary_node):
lu.cfg.SetDiskID(node_disk, node)
result = lu.rpc.call_blockdev_assemble(node, node_disk, iname, False)
if result.failed or not result:
msg = result.RemoteFailMsg()
if msg:
lu.proc.LogWarning("Could not prepare block device %s on node %s"
" (is_primary=False, pass=1)",
inst_disk.iv_name, node)
" (is_primary=False, pass=1): %s",
inst_disk.iv_name, node, msg)
if not ignore_secondaries:
disks_ok = False
......@@ -2475,10 +2476,11 @@ def _AssembleInstanceDisks(lu, instance, ignore_secondaries=False):
continue
lu.cfg.SetDiskID(node_disk, node)
result = lu.rpc.call_blockdev_assemble(node, node_disk, iname, True)
if result.failed or not result:
msg = result.RemoteFailMsg()
if msg:
lu.proc.LogWarning("Could not prepare block device %s on node %s"
" (is_primary=True, pass=2)",
inst_disk.iv_name, node)
" (is_primary=True, pass=2): %s",
inst_disk.iv_name, node, msg)
disks_ok = False
device_info.append((instance.primary_node, inst_disk.iv_name, result.data))
......
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