Package ganeti :: Package hypervisor :: Module hv_base :: Class BaseHypervisor
[hide private]
[frames] | no frames]

Class BaseHypervisor

source code


Abstract virtualisation technology interface

The goal is that all aspects of the virtualisation technology are abstracted away from the rest of code.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
StartInstance(self, instance, block_devices)
Start an instance.
source code
 
StopInstance(self, instance, force=False, retry=False, name=None)
Stop an instance
source code
 
CleanupInstance(self, instance_name)
Cleanup after a stopped instance
source code
 
RebootInstance(self, instance)
Reboot an instance.
source code
 
ListInstances(self)
Get the list of running instances.
source code
 
GetInstanceInfo(self, instance_name)
Get instance properties.
source code
 
GetAllInstancesInfo(self)
Get properties of all instances.
source code
 
GetNodeInfo(self)
Return information about the node.
source code
 
Verify(self)
Verify the hypervisor.
source code
string/data (opaque)
MigrationInfo(self, instance)
Get instance information to perform a migration.
source code
 
AcceptInstance(self, instance, info, target)
Prepare to accept an instance.
source code
 
FinalizeMigration(self, instance, info, success)
Finalized an instance migration.
source code
 
MigrateInstance(self, instance, target, live)
Migrate an instance.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
GetShellCommandForConsole(cls, instance, hvparams, beparams)
Return a command for connecting to the console of an instance.
source code
list of strings
GetAncillaryFiles(cls)
Return a list of ancillary files to be copied to all nodes as ancillary configuration files.
source code
 
CheckParameterSyntax(cls, hvparams)
Check the given parameters for validity.
source code
 
ValidateParameters(cls, hvparams)
Check the given parameters for validity.
source code
 
PowercycleNode(cls)
Hard powercycle a node using hypervisor specific methods.
source code
 
LinuxPowercycle(cls)
Linux-specific powercycle method.
source code
Static Methods [hide private]
 
GetLinuxNodeInfo()
For linux systems, return actual OS information.
source code
Class Variables [hide private]
  PARAMETERS = {}
a dict of parameter name: check type; the check type is a five-tuple containing:
  ANCILLARY_FILES = []
boolean CAN_MIGRATE = False
whether this hypervisor can do migration (either live or non-live)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

StopInstance(self, instance, force=False, retry=False, name=None)

source code 

Stop an instance

Parameters:
  • instance (objects.Instance) - instance to stop
  • force (boolean) - whether to do a "hard" stop (destroy)
  • retry (boolean) - whether this is just a retry call
  • name (string or None) - if this parameter is passed, the the instance object should not be used (will be passed as None), and the shutdown must be done by name only

CleanupInstance(self, instance_name)

source code 

Cleanup after a stopped instance

This is an optional method, used by hypervisors that need to cleanup after an instance has been stopped.

Parameters:
  • instance_name (string) - instance name to cleanup after

GetInstanceInfo(self, instance_name)

source code 

Get instance properties.

Parameters:
  • instance_name (string) - the instance name
Returns:
tuple (name, id, memory, vcpus, state, times)

GetAllInstancesInfo(self)

source code 

Get properties of all instances.

Returns:
list of tuples (name, id, memory, vcpus, stat, times)

GetNodeInfo(self)

source code 

Return information about the node.

Returns:
a dict with the following keys (values in MiB):
  • memory_total: the total memory size on the node
  • memory_free: the available memory on the node for instances
  • memory_dom0: the memory used by the node itself, if available

GetAncillaryFiles(cls)
Class Method

source code 

Return a list of ancillary files to be copied to all nodes as ancillary configuration files.

Returns: list of strings
list of absolute paths of files to ship cluster-wide

MigrationInfo(self, instance)

source code 

Get instance information to perform a migration.

By default assume no information is needed.

Parameters:
Returns: string/data (opaque)
instance migration information - serialized form

AcceptInstance(self, instance, info, target)

source code 

Prepare to accept an instance.

By default assume no preparation is needed.

Parameters:
  • instance (objects.Instance) - instance to be accepted
  • info (string/data (opaque)) - migration information, from the source node
  • target (string) - target host (usually ip), on this node

FinalizeMigration(self, instance, info, success)

source code 

Finalized an instance migration.

Should finalize or revert any preparation done to accept the instance. Since by default we do no preparation, we also don't have anything to do

Parameters:
  • instance (objects.Instance) - instance whose migration is being finalized
  • info (string/data (opaque)) - migration information, from the source node
  • success (boolean) - whether the migration was a success or a failure

MigrateInstance(self, instance, target, live)

source code 

Migrate an instance.

Parameters:
  • instance (objects.Instance) - the instance to be migrated
  • target (string) - hostname (usually ip) of the target node
  • live (boolean) - whether to do a live or non-live migration

CheckParameterSyntax(cls, hvparams)
Class Method

source code 

Check the given parameters for validity.

This should check the passed set of parameters for validity. Classes should extend, not replace, this function.

Parameters:
  • hvparams (dict) - dictionary with parameter names/value
Raises:

ValidateParameters(cls, hvparams)
Class Method

source code 

Check the given parameters for validity.

This should check the passed set of parameters for validity. Classes should extend, not replace, this function.

Parameters:
  • hvparams (dict) - dictionary with parameter names/value
Raises:

PowercycleNode(cls)
Class Method

source code 

Hard powercycle a node using hypervisor specific methods.

This method should hard powercycle the node, using whatever methods the hypervisor provides. Note that this means that all instances running on the node must be stopped too.

GetLinuxNodeInfo()
Static Method

source code 

For linux systems, return actual OS information.

This is an abstraction for all non-hypervisor-based classes, where the node actually sees all the memory and CPUs via the /proc interface and standard commands. The other case if for example xen, where you only see the hardware resources via xen-specific tools.

Returns:
a dict with the following keys (values in MiB):
  • memory_total: the total memory size on the node
  • memory_free: the available memory on the node for instances
  • memory_dom0: the memory used by the node itself, if available

Class Variable Details [hide private]

PARAMETERS

a dict of parameter name: check type; the check type is a five-tuple containing:
  • the required flag (boolean)
  • a function to check for syntax, that will be used in CheckParameterSyntax, in the master daemon process
  • an error message for the above function
  • a function to check for parameter validity on the remote node, in the ValidateParameters function
  • an error message for the above function
Value:
{}