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 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 help(type(x)) for signature
source code
 
Raise(self, msg, prereq=False, ecode=None)
If the result has failed, raise an OpExecError.
source code
 
Warn(self, msg, feedback_fn)
If the result has failed, call the feedback_fn.
source code

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

Static Methods [hide private]
 
_EnsureErr(val)
Helper to ensure we return a 'True' value for error.
source code
Instance Variables [hide private]
  call
the name of the RPC call
  data
the data payload, for successful results, or None
  fail_msg
the error message if the call failed
  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 help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

Raise(self, msg, prereq=False, ecode=None)

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.

Warn(self, msg, feedback_fn)

source code 

If the result has failed, call the feedback_fn.

This is used to in cases were LU wants to warn the user about a failure, but continue anyway.