On Mon, Feb 9, 2009 at 6:04 PM, Iustin Pop <ius...@google.com> wrote: > > 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. > --- > lib/backend.py | 16 ++++++++++++---- > lib/cmdlib.py | 14 ++++++++------ > 2 files changed, 20 insertions(+), 10 deletions(-) > > diff --git a/lib/backend.py b/lib/backend.py > index 6e1d039..2c601db 100644 > --- a/lib/backend.py > +++ b/lib/backend.py > @@ -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
Aren't you overloading the meaning of "result" here as discussed this morning?? Thanks, Guido > + 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): > diff --git a/lib/cmdlib.py b/lib/cmdlib.py > index bf66dda..c01b45a 100644 > --- a/lib/cmdlib.py > +++ b/lib/cmdlib.py > @@ -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)) > > -- > 1.5.6.5 > > -- Guido Trotter Google - Sysops Team Google Ireland Ltd. : Registered in Ireland with company number 368047. Gordon House, Barrow Street, Dublin 4, Ireland.