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

Module rpc

source code

Inter-node RPC library.

Classes [hide private]
  _RpcThreadLocal
  RpcResult
RPC Result class.
  Client
RPC Client class.
  RpcRunner
RPC runner class
Functions [hide private]
 
Init()
Initializes the module-global HTTP client manager.
source code
 
Shutdown()
Stops the module-global HTTP client manager.
source code
 
_ConfigRpcCurl(curl) source code
 
_RpcTimeout(secs)
Timeout decorator.
source code
 
RunWithRPC(fn)
RPC-wrapper decorator.
source code
list of addresses and/or None's
_AddressLookup(node_list, ssc=ssconf.SimpleStore, nslookup_fn=netutils.Hostname.GetIP)
Return addresses for given node names.
source code
 
_EncodeImportExportIO(ieio, ieioargs)
Encodes import/export I/O information.
source code
Variables [hide private]
  _RPC_CONNECT_TIMEOUT = 5
  _RPC_CLIENT_HEADERS = ["Content-type: %s" % http.HTTP_APP_JSON...
  _TMO_URGENT = 60
  _TMO_FAST = 5* 60
  _TMO_NORMAL = 15* 60
  _TMO_SLOW = 3600
  _TMO_4HRS = 4* 3600
  _TMO_1DAY = 86400
  _TIMEOUTS = {}
  _thread_local = _RpcThreadLocal()

Imports: os, logging, zlib, base64, pycurl, threading, utils, objects, http, serializer, constants, errors, netutils, ssconf, ganeti


Function Details [hide private]

Init()

source code 

Initializes the module-global HTTP client manager.

Must be called before using any RPC function and while exactly one thread is running.

Shutdown()

source code 

Stops the module-global HTTP client manager.

Must be called before quitting the program and while exactly one thread is running.

_RpcTimeout(secs)

source code 

Timeout decorator.

When applied to a rpc call_* function, it updates the global timeout table with the given function/timeout.

RunWithRPC(fn)

source code 

RPC-wrapper decorator.

When applied to a function, it runs it with the RPC system initialized, and it shutsdown the system afterwards. This means the function must be called without RPC being initialized.

_AddressLookup(node_list, ssc=ssconf.SimpleStore, nslookup_fn=netutils.Hostname.GetIP)

source code 

Return addresses for given node names.

Parameters:
  • node_list (list) - List of node names
  • ssc (class) - SimpleStore class that is used to obtain node->ip mappings
  • nslookup_fn (callable) - function use to do NS lookup
Returns: list of addresses and/or None's
List of corresponding addresses, if found

Variables Details [hide private]

_RPC_CLIENT_HEADERS

Value:
["Content-type: %s" % http.HTTP_APP_JSON, "Expect:",]