Package ganeti :: Package utils :: Module version
[hide private]
[frames] | no frames]

Module version

source code

Version utilities.

Functions [hide private]
 
BuildVersion(major, minor, revision)
Calculates int version number from major, minor and revision numbers.
source code
 
SplitVersion(version)
Splits version number stored in an int.
source code
tuple or None
ParseVersion(versionstring)
Parses a version string.
source code
string or None
UpgradeRange(target, current=CURRENT_VERSION)
Verify whether a version is within the range of automatic upgrades.
source code
bool
ShouldCfgdowngrade(version, current=CURRENT_VERSION)
Decide whether cfgupgrade --downgrade should be called.
source code
bool
IsCorrectConfigVersion(targetversion, configversion)
Decide whether configuration version is compatible with the target.
source code
Variables [hide private]
  _FULL_VERSION_RE = re.compile(r"(\d+)\.(\d+)\.(\d+)")
  _SHORT_VERSION_RE = re.compile(r"(\d+)\.(\d+)")
  FIRST_UPGRADE_VERSION = 2, 10, 0
  CURRENT_VERSION = constants.VERSION_MAJOR, constants.VERSION_M...

Imports: re, constants


Function Details [hide private]

BuildVersion(major, minor, revision)

source code 

Calculates int version number from major, minor and revision numbers.

Returns: int representing version number

SplitVersion(version)

source code 

Splits version number stored in an int.

Returns: tuple; (major, minor, revision)

ParseVersion(versionstring)

source code 

Parses a version string.

Parameters:
  • versionstring (string) - the version string to parse
Returns: tuple or None
(major, minor, revision) if parsable, None otherwise.

UpgradeRange(target, current=CURRENT_VERSION)

source code 

Verify whether a version is within the range of automatic upgrades.

Parameters:
  • target (tuple) - The version to upgrade to as (major, minor, revision)
  • current (tuple) - The version to upgrade from as (major, minor, revision)
Returns: string or None
None, if within the range, and a human-readable error message otherwise

ShouldCfgdowngrade(version, current=CURRENT_VERSION)

source code 

Decide whether cfgupgrade --downgrade should be called.

Given the current version and the version to change to, decide if in the transition process cfgupgrade --downgrade should be called

Parameters:
  • version (tuple) - The version to upgrade to as (major, minor, revision)
  • current (tuple) - The version to upgrade from as (major, minor, revision)
Returns: bool
True, if cfgupgrade --downgrade should be called.

IsCorrectConfigVersion(targetversion, configversion)

source code 

Decide whether configuration version is compatible with the target.

Parameters:
  • targetversion (tuple) - The version to upgrade to as (major, minor, revision)
  • configversion (tuple) - The version of the current configuration
Returns: bool
True, if the configversion fits with the target version.

Variables Details [hide private]

CURRENT_VERSION

Value:
constants.VERSION_MAJOR, constants.VERSION_MINOR, constants.VERSION_RE\
VISION