class documentation

class InstancePolicy(ConfigObject):

View In Hierarchy

Config object representing instance policy limits dictionary.

Note that this object is not actually used in the config, it's just used as a placeholder for a few functions.

Class Method CheckDiskTemplates Checks the disk templates for validity.
Class Method CheckISpecSyntax Check the instance policy specs for validity.
Class Method CheckParameter Checks a parameter.
Class Method CheckParameterSyntax Check the instance policy for validity.
Class Method UpgradeDiskTemplates Upgrades the ipolicy configuration.
Class Method _CheckIncompleteSpec Undocumented
Class Method _CheckISpecParamSyntax Check the instance policy specs for validity on a given key.

Inherited from ConfigObject:

Class Method FromDict Create an object from a dictionary.
Method __getattr__ Undocumented
Method __repr__ Implement __repr__ for ConfigObjects.
Method __setstate__ Undocumented
Method Copy Makes a deep copy of the current object and its children.
Method ToDict Convert to a dict holding only standard python types.
Method UpgradeConfig Fill defaults for missing configuration values.
Method Validate Validates the slots.
Class Variable __slots__ Undocumented

Inherited from ValidatedSlots (via ConfigObject):

Class Method GetAllSlots Compute the list of all declared slots for a class.
Method __init__ Constructor for BaseOpCode.
@classmethod
def CheckDiskTemplates(cls, disk_templates):

Checks the disk templates for validity.

@classmethod
def CheckISpecSyntax(cls, ipolicy, check_std):

Check the instance policy specs for validity.

Parameters
ipolicy:dictdictionary with min/max/std specs
check_std:boolWhether to check std value or just assume compliance
Raises
errors.ConfigurationErrorwhen specs are not valid
@classmethod
def CheckParameter(cls, key, value):

Checks a parameter.

Currently we expect all parameters to be float values.

@classmethod
def CheckParameterSyntax(cls, ipolicy, check_std):

Check the instance policy for validity.

Parameters
ipolicy:dictdictionary with min/max/std specs and policies
check_std:boolWhether to check std value or just assume compliance
Raises
errors.ConfigurationErrorwhen the policy is not legal
@classmethod
def UpgradeDiskTemplates(cls, ipolicy, enabled_disk_templates):

Upgrades the ipolicy configuration.

@classmethod
def _CheckIncompleteSpec(cls, spec, keyname):

Undocumented

@classmethod
def _CheckISpecParamSyntax(cls, minmaxspecs, stdspec, name, check_std):

Check the instance policy specs for validity on a given key.

We check if the instance specs makes sense for a given key, that is if minmaxspecs[min][name] <= stdspec[name] <= minmaxspec[max][name].

Parameters
minmaxspecs:dictdictionary with min and max instance spec
stdspec:dictdictionary with standard instance spec
name:stringwhat are the limits for
check_std:boolWhether to check std value or just assume compliance
Returns
boolTrue when specs are valid, False when standard spec for the given name is not valid
Raises
errors.ConfigurationErrorwhen min/max specs for the given name are not valid