module documentation

Base class for all hypervisors

The syntax for the _CHECK variables and the contents of the PARAMETERS dict is the same, see the docstring for BaseHypervisor.PARAMETERS.

Class BaseHypervisor Abstract virtualisation technology interface
Class HvInstanceState Undocumented
Function ConfigureNIC Run the network configuration script for a specified NIC
Function GenerateTapName Generate a TAP network interface name for a NIC.
Function ParamInSet Builds parameter checker for set membership.
Constant MIGRATION_MODE_CHECK Undocumented
Constant NO_CHECK parameter without any checks at all
Constant OPT_CPU_MASK_CHECK Undocumented
Constant OPT_DIR_CHECK optional directory parameter
Constant OPT_FILE_CHECK optional file parameter
Constant OPT_FILE_OR_URL_CHECK Undocumented
Constant OPT_MULTI_CPU_MASK_CHECK Undocumented
Constant OPT_NET_PORT_CHECK Undocumented
Constant OPT_NONNEGATIVE_INT_CHECK Undocumented
Constant OPT_VIRTIO_NET_QUEUES_CHECK Undocumented
Constant REQ_CPU_MASK_CHECK Undocumented
Constant REQ_DIR_CHECK mandatory directory parametr
Constant REQ_FILE_CHECK mandatory file parameter
Constant REQ_FILE_OR_URL_CHECK Undocumented
Constant REQ_MULTI_CPU_MASK_CHECK Undocumented
Constant REQ_NET_PORT_CHECK Undocumented
Constant REQ_NONNEGATIVE_INT_CHECK Undocumented
Constant REQ_VIRTIO_NET_QUEUES_CHECK Undocumented
Constant REQUIRED_CHECK parameter required to exist (and non-false), but without other checks; beware that this can't be used for boolean parameters, where you should use NO_CHECK or a custom checker
Function _IsCpuMaskWellFormed Verifies if the given single CPU mask is valid
Function _IsMultiCpuMaskWellFormed Verifies if the given multiple CPU mask is valid
Constant _CPU_MASK_CHECK Undocumented
Constant _DIR_CHECK stub for directory checks, without the required flag
Constant _FILE_CHECK stub for file checks, without the required flag
Constant _FILE_OR_URL_CHECK Undocumented
Constant _MULTI_CPU_MASK_CHECK Undocumented
Constant _NET_PORT_CHECK Undocumented
Constant _NONNEGATIVE_INT_CHECK Undocumented
Constant _VIRTIO_NET_QUEUES_CHECK Undocumented
def ConfigureNIC(cmd, instance, seq, nic, tap):

Run the network configuration script for a specified NIC

Parameters
cmd:stringcommand to run
instance:instance objectinstance we're acting on
seq:intnic sequence number
nic:nic objectnic we're acting on
tap:strthe host's tap interface this NIC corresponds to
def GenerateTapName():

Generate a TAP network interface name for a NIC.

This helper function generates a special TAP network interface name for NICs that are meant to be used in instance communication. This function checks the existing TAP interfaces in order to find a unique name for the new TAP network interface. The TAP network interface names are of the form 'gnt.com.%d', where '%d' is a unique number within the node.

Returns
stringTAP network interface name, or the empty string if the NIC is not used in instance communication
def ParamInSet(required, my_set):

Builds parameter checker for set membership.

Parameters
required:booleanwhether this is a required parameter
my_set:tuple, list or setallowed values set
MIGRATION_MODE_CHECK =

Undocumented

Value
(True,
 (lambda x: x in constants.HT_MIGRATION_MODES),
 'invalid migration mode',
 None,
 None)
NO_CHECK: tuple =

parameter without any checks at all

Value
(False, None, None, None, None)
OPT_CPU_MASK_CHECK =

Undocumented

Value
(False)+_CPU_MASK_CHECK
OPT_DIR_CHECK =

optional directory parameter

Value
(False)+_DIR_CHECK
OPT_FILE_CHECK =

optional file parameter

Value
(False)+_FILE_CHECK
OPT_FILE_OR_URL_CHECK =

Undocumented

Value
(False)+_FILE_OR_URL_CHECK
OPT_MULTI_CPU_MASK_CHECK =

Undocumented

Value
(False)+_MULTI_CPU_MASK_CHECK
OPT_NET_PORT_CHECK =

Undocumented

Value
(False)+_NET_PORT_CHECK
OPT_NONNEGATIVE_INT_CHECK =

Undocumented

Value
(False)+_NONNEGATIVE_INT_CHECK
OPT_VIRTIO_NET_QUEUES_CHECK =

Undocumented

Value
(False)+_VIRTIO_NET_QUEUES_CHECK
REQ_CPU_MASK_CHECK =

Undocumented

Value
(True)+_CPU_MASK_CHECK
REQ_DIR_CHECK =

mandatory directory parametr

Value
(True)+_DIR_CHECK
REQ_FILE_CHECK =

mandatory file parameter

Value
(True)+_FILE_CHECK
REQ_FILE_OR_URL_CHECK =

Undocumented

Value
(True)+_FILE_OR_URL_CHECK
REQ_MULTI_CPU_MASK_CHECK =

Undocumented

Value
(True)+_MULTI_CPU_MASK_CHECK
REQ_NET_PORT_CHECK =

Undocumented

Value
(True)+_NET_PORT_CHECK
REQ_NONNEGATIVE_INT_CHECK =

Undocumented

Value
(True)+_NONNEGATIVE_INT_CHECK
REQ_VIRTIO_NET_QUEUES_CHECK =

Undocumented

Value
(True)+_VIRTIO_NET_QUEUES_CHECK
REQUIRED_CHECK: tuple =

parameter required to exist (and non-false), but without other checks; beware that this can't be used for boolean parameters, where you should use NO_CHECK or a custom checker

Value
(True, None, None, None, None)
def _IsCpuMaskWellFormed(cpu_mask):

Verifies if the given single CPU mask is valid

The single CPU mask should be in the form "a,b,c,d", where each letter is a positive number or range.

def _IsMultiCpuMaskWellFormed(cpu_mask):

Verifies if the given multiple CPU mask is valid

A valid multiple CPU mask is in the form "a:b:c:d", where each letter is a single CPU mask.

_CPU_MASK_CHECK =

Undocumented

Value
(_IsCpuMaskWellFormed, 'CPU mask definition is not well-formed', None, None)
_DIR_CHECK =

stub for directory checks, without the required flag

Value
(utils.IsNormAbsPath,
 'must be an absolute normalized path',
 os.path.isdir,
 'not found or not a directory')
_FILE_CHECK =

stub for file checks, without the required flag

Value
(utils.IsNormAbsPath,
 'must be an absolute normalized path',
 os.path.isfile,
 'not found or not a file')
_FILE_OR_URL_CHECK =

Undocumented

Value
((lambda x: utils.IsNormAbsPath(x) or utils.IsUrl(x)),
 'must be an absolute normalized path or a URL',
 (lambda x: os.path.isfile(x) or utils.IsUrl(x)),
 'not found or not a file or URL')
_MULTI_CPU_MASK_CHECK =

Undocumented

Value
(_IsMultiCpuMaskWellFormed,
 'Multiple CPU mask definition is not well-formed',
 None,
 None)
_NET_PORT_CHECK =

Undocumented

Value
((lambda x: 0 < x < 65535), 'invalid port number', None, None)
_NONNEGATIVE_INT_CHECK =

Undocumented

Value
((lambda x: x >= 0), 'cannot be negative', None, None)
_VIRTIO_NET_QUEUES_CHECK =

Undocumented

Value
((lambda x: 0 < x < 9), 'invalid number of queues', None, None)