Package ganeti :: Module rpc :: Class RpcResult
[hide private]
[frames] | no frames]

Class RpcResult

source code


RPC Result class.

This class holds an RPC result. It is needed since in multi-node calls we can't raise an exception just because one one out of many failed, and therefore we use this class to encapsulate the result.

Instance Methods [hide private]
 
__init__(self, data=None, failed=False, offline=False, call=None, node=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
Raise(self)
If the result has failed, raise an OpExecError.
source code
 
RemoteFailMsg(self)
Check if the remote procedure failed.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  call
the name of the RPC call
  data
the data payload, for successful results, or None
boolean failed
whether the operation failed at RPC level (not application level on the remote node)
  node
the name of the node to which we made the call
  offline
whether the operation failed because the node was offline, as opposed to actual failure; offline=True will always imply failed=True, in order to allow simpler checking if the user doesn't care about the exact failure mode
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, data=None, failed=False, offline=False, call=None, node=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

Raise(self)

source code 

If the result has failed, raise an OpExecError.

This is used so that LU code doesn't have to check for each result, but instead can call this function.

RemoteFailMsg(self)

source code 

Check if the remote procedure failed.

This is valid only for RPC calls which return result of the form (status, data | error_msg).

Returns:
empty string for succcess, otherwise an error message