module documentation

Inter-node RPC library.

Class BootstrapRunner RPC wrappers for bootstrapping.
Class ConfigRunner RPC wrappers for config.
Class DnsOnlyRunner RPC wrappers for calls using only DNS.
Class JobQueueRunner RPC wrappers for job queue.
Class RpcResult RPC Result class.
Class RpcRunner RPC runner class.
Function AnnotateDiskParams Annotates the disk objects with the disk parameters.
Function GetExclusiveStorageForNodes Return the exclusive storage flag for all the given nodes.
Function Init Initializes the module-global HTTP client manager.
Function MakeLegacyNodeInfo Formats the data returned by call_node_info.
Function PrepareStorageUnitsForNodes Return the lvm storage unit for all the given nodes.
Function RunWithRPC RPC-wrapper decorator.
Function Shutdown Stops the module-global HTTP client manager.
Class _RpcClientBase No class docstring; 0/2 instance variable, 2/2 methods, 1/1 static method documented
Class _RpcProcessor No class docstring; 0/3 instance variable, 2/2 methods, 2/2 static methods documented
Class _StaticResolver No class docstring; 0/1 instance variable, 2/2 methods documented
Function _AddExclusiveStorageFlagToLvmStorageUnits Adds the exclusive storage flag to lvm units.
Function _AddSpindlesToLegacyNodeInfo Extracts the spindle information from the space info and adds it to the result dictionary.
Function _AddStorageInfoToLegacyNodeInfoByTemplate Extracts the storage space information of the disk template from the space info and adds it to the result dictionary.
Function _AnnotateDParamsDRBD Annotates just DRBD disks layouts.
Function _AnnotateDParamsGeneric Generic disk parameter annotation routine.
Function _CheckConfigNode Checks if a node is online.
Function _Compress Compresses a string for transport over RPC.
Function _ConfigRpcCurl Undocumented
Function _EncodeBlockdevRename Encodes information for renaming block devices.
Function _GetExclusiveStorageFlag Undocumented
Function _NodeConfigResolver Calculate node addresses using configuration.
Function _ObjectListToDict Converts a list of objects to dictionaries.
Function _ObjectToDict Converts an object to a dictionary.
Function _PrepareFileUpload Loads a file and prepares it for an upload to nodes.
Function _PrepareFinalizeExportDisks Encodes disks for finalizing export.
Function _SsconfResolver Return addresses for given node names.
Constant _ENCODERS Undocumented
Constant _OFFLINE Undocumented
Constant _RPC_CLIENT_HEADERS Undocumented
def AnnotateDiskParams(disks, disk_params):

Annotates the disk objects with the disk parameters.

Parameters
disksThe list of disks objects to annotate
disk_paramsThe disk parameters for annotation
Returns
A list of disk objects annotated
def GetExclusiveStorageForNodes(cfg, node_uuids):

Return the exclusive storage flag for all the given nodes.

Parameters
cfg:config.ConfigWritercluster configuration
node_uuids:list or tuplenode UUIDs for which to read the flag
Returns
dictmapping from node uuids to exclusive storage flags
Raises
errors.OpPrereqErrorif any given node name has no corresponding node
def Init():

Initializes the module-global HTTP client manager.

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

def MakeLegacyNodeInfo(data, disk_template):

Formats the data returned by call_node_info.

Converts the data into a single dictionary. This is fine for most use cases, but some require information from more than one volume group or hypervisor.

def PrepareStorageUnitsForNodes(cfg, storage_units, node_uuids):

Return the lvm storage unit for all the given nodes.

Main purpose of this function is to map the exclusive storage flag, which can be different for each node, to the default LVM storage unit.

Parameters
cfg:config.ConfigWritercluster configuration
storage_units:list of pairs (string, string)list of 'raw' storage units, e.g. pairs of (storage_type, storage_key)
node_uuids:list or tuplenode UUIDs for which to read the flag
Returns
dictmapping from node uuids to a list of storage units which include the exclusive storage flag for lvm storage
Raises
errors.OpPrereqErrorif any given node name has no corresponding node
def RunWithRPC(fn):

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.

def Shutdown():

Stops the module-global HTTP client manager.

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

def _AddExclusiveStorageFlagToLvmStorageUnits(storage_units, es_flag):

Adds the exclusive storage flag to lvm units.

This function creates a copy of the storage_units lists, with the es_flag being added to all lvm storage units.

Parameters
storage_units:list of pairs (string, string)list of 'raw' storage units, consisting only of (storage_type, storage_key)
es_flag:booleanexclusive storage flag
Returns
list of tuples (string, string, list)list of storage units (storage_type, storage_key, params) with the params containing the es_flag for lvm-vg storage units
def _AddSpindlesToLegacyNodeInfo(result, space_info):

Extracts the spindle information from the space info and adds it to the result dictionary.

Parameters
result:dict of stringsdictionary holding the result of the legacy node info
space_info:list of dicts of stringslist, each row holding space information of one storage unit
Returns
Nonedoes not return anything, manipulates the result variable
def _AddStorageInfoToLegacyNodeInfoByTemplate(result, space_info, disk_template):

Extracts the storage space information of the disk template from the space info and adds it to the result dictionary.

See Also
_AddSpindlesToLegacyNodeInfo for parameter information.
def _AnnotateDParamsDRBD(disk, params):

Annotates just DRBD disks layouts.

def _AnnotateDParamsGeneric(disk, params):

Generic disk parameter annotation routine.

def _CheckConfigNode(node_uuid_or_name, node, accept_offline_node):

Checks if a node is online.

Parameters
node_uuid_or_name:stringNode UUID
node:objects.Node or NoneNode object
accept_offline_nodeUndocumented
def _Compress(_, data):

Compresses a string for transport over RPC.

Small amounts of data are not compressed.

Parameters
_Undocumented
data:strData
Returns
tupleEncoded data to send
def _ConfigRpcCurl(curl):

Undocumented

def _EncodeBlockdevRename(_, value):

Encodes information for renaming block devices.

def _GetExclusiveStorageFlag(cfg, node_uuid):

Undocumented

def _NodeConfigResolver(single_node_fn, all_nodes_fn, node_uuids, opts):

Calculate node addresses using configuration.

Note that strings in node_uuids are treated as node names if the UUID is not found in the configuration.

def _ObjectListToDict(node, value):

Converts a list of objects to dictionaries.

def _ObjectToDict(_, value):

Converts an object to a dictionary.

Note
See objects.
def _PrepareFileUpload(getents_fn, node, filename):

Loads a file and prepares it for an upload to nodes.

def _PrepareFinalizeExportDisks(_, snap_disks):

Encodes disks for finalizing export.

def _SsconfResolver(ssconf_ips, node_list, _, ssc=ssconf.SimpleStore, nslookup_fn=netutils.Hostname.GetIP):

Return addresses for given node names.

Parameters
ssconf_ips:boolUse the ssconf IPs
node_list:listList of node names
_Undocumented
ssc:classSimpleStore class that is used to obtain node->ip mappings
nslookup_fn:callablefunction use to do NS lookup
Returns
list of tuple; (string, string)List of tuples containing node name and IP address
_OFFLINE =

Undocumented

Value
object()
_RPC_CLIENT_HEADERS =

Undocumented

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