Package ganeti :: Package config
[hide private]
[frames] | no frames]

Package config

source code

Configuration management for Ganeti

This module provides the interface to the Ganeti cluster configuration.

The configuration data is stored on every node but is updated on the master only. After each update, the master distributes the data to the other nodes.

Currently, the data storage format is JSON. YAML was slow and consuming too much memory.

Submodules [hide private]

Classes [hide private]
  ConfigWriter
The interface to the cluster configuration.
  DetachedConfig
Read-only snapshot of the config.
Functions [hide private]
 
GetWConfdContext(ec_id, livelock)
Prepare a context for communication with WConfd.
source code
ConfigWriter
GetConfig(ec_id, livelock, **kwargs)
A utility function for constructing instances of ConfigWriter.
source code
 
_MatchNameComponentIgnoreCase(short_name, names)
Wrapper around utils.text.MatchNameComponent.
source code
list of tuples; (int, string, string)
_CheckInstanceDiskIvNames(disks)
Checks if instance's disks' iv_name attributes are in order.
source code
 
_UpdateIvNames(base_idx, disks)
Update the iv_name attribute of disks.
source code
Variables [hide private]
  _UPGRADE_CONFIG_JID = "jid-cfg-upgrade"

Imports: copy, os, random, logging, time, threading, itertools, TemporaryReservationManager, ConfigSync, ConfigManager, VerifyType, VerifyNic, VerifyIpolicy, ValidateConfig, errors, utils, constants, wc, objects, serializer, uidpool, netutils, runtime, pathutils, network


Function Details [hide private]

GetWConfdContext(ec_id, livelock)

source code 

Prepare a context for communication with WConfd.

WConfd needs to know the identity of each caller to properly manage locks and detect job death. This helper function prepares the identity object given a job ID (optional) and a livelock file.

Parameters:
  • ec_id (int, or None) - the job ID or None, if the caller isn't a job
  • livelock (ganeti.utils.livelock.LiveLock) - a livelock object holding the lockfile needed for WConfd
Returns:
the WConfd context

GetConfig(ec_id, livelock, **kwargs)

source code 

A utility function for constructing instances of ConfigWriter.

It prepares a WConfd context and uses it to create a ConfigWriter instance.

Parameters:
  • ec_id (int, or None) - the job ID or None, if the caller isn't a job
  • livelock (ganeti.utils.livelock.LiveLock) - a livelock object holding the lockfile needed for WConfd
  • kwargs (dict) - Any additional arguments for the ConfigWriter constructor
Returns: ConfigWriter
the ConfigWriter context

_CheckInstanceDiskIvNames(disks)

source code 

Checks if instance's disks' iv_name attributes are in order.

Parameters:
Returns: list of tuples; (int, string, string)
List of wrongly named disks, each tuple contains disk index, expected and actual name

_UpdateIvNames(base_idx, disks)

source code 

Update the iv_name attribute of disks.

Parameters: