Commit dab69e97 authored by Iustin Pop's avatar Iustin Pop
Browse files

Switch call_blockdev_create call to (status, data)

This allows errors to be visible at the user level instead of just node
daemon logs.

Reviewed-by: ultrotter
parent 796cab27
......@@ -1017,14 +1017,16 @@ def CreateBlockDevice(disk, size, owner, on_primary, info):
device = bdev.Create(disk.dev_type, disk.physical_id, clist, size)
device = bdev.Create(disk.dev_type, disk.physical_id, clist, size)
except errors.GenericError, err:
return False, "Can't create block device: %s" % str(err)
if on_primary or disk.AssembleOnSecondary():
if not device.Assemble():
errorstring = "Can't assemble device after creation"
errorstring = "Can't assemble device after creation, very unusual event"
raise errors.BlockDeviceError("%s, very unusual event - check the node"
" daemon logs" % errorstring)
return False, errorstring
if on_primary or disk.OpenOnSecondary():
......@@ -1034,7 +1036,7 @@ def CreateBlockDevice(disk, size, owner, on_primary, info):
physical_id = device.unique_id
return physical_id
return True, physical_id
def RemoveBlockDevice(disk):
......@@ -3702,13 +3702,14 @@ def _CreateBlockDevOnPrimary(lu, node, instance, device, info):
_CreateBlockDevOnPrimary(lu, node, instance, child, info)
lu.cfg.SetDiskID(device, node)
new_id = lu.rpc.call_blockdev_create(node, device, device.size,
result = lu.rpc.call_blockdev_create(node, device, device.size,, True, info)
if new_id.failed or not
msg = result.RemoteFailMsg()
if msg:
raise errors.OpExecError("Can't create block device %s on primary"
" node %s" % (device, node))
" node %s: %s" % (device, node, msg))
if device.physical_id is None:
device.physical_id = new_id
device.physical_id =[1]
def _CreateBlockDevOnSecondary(lu, node, instance, device, force, info):
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