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

Module ssconf

source code

Global Configuration data for Ganeti.

This module provides the interface to a special case of cluster configuration data, which is mostly static and available to all nodes.

Classes [hide private]
  SimpleStore
Interface to static cluster data.
Functions [hide private]
string
ReadSsconfFile(filename)
Reads an ssconf file and verifies its size.
source code
 
WriteSsconfFiles(values, dry_run=False)
Update all ssconf files.
source code
tuple
GetMasterAndMyself(ss=None)
Get the master node and my own hostname.
source code
 
CheckMaster(debug, ss=None)
Checks the node setup.
source code
 
VerifyClusterName(name, _cfg_location=None)
Verifies cluster name against a local cluster name.
source code
 
VerifyKeys(keys)
Raises an exception if unknown ssconf keys are given.
source code
Variables [hide private]
  SSCONF_LOCK_TIMEOUT = 10
  _VALID_KEYS = compat.UniqueFrozenset([constants.SS_CLUSTER_NAM...
Valid ssconf keys
  _MAX_SIZE = 128* 1024
Maximum size for ssconf files

Imports: sys, errno, logging, compat, errors, constants, utils, netutils, pathutils


Function Details [hide private]

ReadSsconfFile(filename)

source code 

Reads an ssconf file and verifies its size.

Parameters:
  • filename (string) - Path to file
Returns: string
File contents without newlines at the end
Raises:
  • RuntimeError - When the file size exceeds _MAX_SIZE

WriteSsconfFiles(values, dry_run=False)

source code 

Update all ssconf files.

Wrapper around SimpleStore.WriteFiles.

GetMasterAndMyself(ss=None)

source code 

Get the master node and my own hostname.

This can be either used for a 'soft' check (compared to CheckMaster, which exits) or just for computing both at the same time.

The function does not handle any errors, these should be handled in the caller (errors.ConfigurationError, errors.ResolverError).

Parameters:
  • ss - either a sstore.SimpleConfigReader or a sstore.SimpleStore instance
Returns: tuple
a tuple (master node name, my own name)

CheckMaster(debug, ss=None)

source code 

Checks the node setup.

If this is the master, the function will return. Otherwise it will exit with an exit code based on the node status.

VerifyClusterName(name, _cfg_location=None)

source code 

Verifies cluster name against a local cluster name.

Parameters:
  • name (string) - Cluster name

VerifyKeys(keys)

source code 

Raises an exception if unknown ssconf keys are given.

Parameters:
  • keys (sequence) - Key names to verify
Raises:

Variables Details [hide private]

_VALID_KEYS

Valid ssconf keys

Value:
compat.UniqueFrozenset([constants.SS_CLUSTER_NAME, constants.SS_CLUSTE\
R_TAGS, constants.SS_FILE_STORAGE_DIR, constants.SS_SHARED_FILE_STORAG\
E_DIR, constants.SS_MASTER_CANDIDATES, constants.SS_MASTER_CANDIDATES_\
IPS, constants.SS_MASTER_IP, constants.SS_MASTER_NETDEV, constants.SS_\
MASTER_NETMASK, constants.SS_MASTER_NODE, constants.SS_NODE_LIST, cons\
tants.SS_NODE_PRIMARY_IPS, constants.SS_NODE_SECONDARY_IPS, constants.\
SS_OFFLINE_NODES, constants.SS_ONLINE_NODES, constants.SS_PRIMARY_IP_F\
AMILY, constants.SS_INSTANCE_LIST, constants.SS_RELEASE_VERSION, const\
...