ganeti :: hypervisor :: hv_chroot :: ChrootManager :: Class ChrootManager
[hide private]
[frames] | no frames]

Class ChrootManager

source code


Chroot manager.

This not-really hypervisor allows ganeti to manage chroots. It has special behaviour and requirements on the OS definition and the node environemnt:

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
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
 
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
 
GetNodeInfo(self)
Return information about the node.
source code
 
Verify(self)
Verify the hypervisor.
source code
 
MigrateInstance(self, instance, target, live)
Migrate an instance.
source code

Inherited from hv_base.BaseHypervisor: AcceptInstance, FinalizeMigration, MigrationInfo

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

Class Methods [hide private]
 
_InstanceDir(cls, instance_name)
Return the root directory for an instance.
source code
 
GetInstanceConsole(cls, instance, hvparams, beparams, root_dir=None)
Return information for connecting to the console of an instance.
source code
 
PowercycleNode(cls)
Chroot powercycle, just a wrapper over Linux powercycle.
source code

Inherited from hv_base.BaseHypervisor: CheckParameterSyntax, GetAncillaryFiles, LinuxPowercycle, ValidateParameters

Static Methods [hide private]
 
_IsDirLive(path)
Check if a directory looks like a live chroot.
source code
 
_GetMountSubdirs(path)
Return the list of mountpoints under a given path.
source code

Inherited from hv_base.BaseHypervisor: GetLinuxNodeInfo

Class Variables [hide private]
  _ROOT_DIR = constants.RUN_GANETI_DIR+ "/chroot-hypervisor"
  PARAMETERS = {constants.HV_INIT_SCRIPT:(True, utils.IsNormAbsP...
a dict of parameter name: check type; the check type is a five-tuple containing:

Inherited from hv_base.BaseHypervisor: ANCILLARY_FILES, CAN_MIGRATE

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)

ListInstances(self)

source code 

Get the list of running instances.

Overrides: hv_base.BaseHypervisor.ListInstances

GetInstanceInfo(self, instance_name)

source code 

Get instance properties.

Parameters:
  • instance_name (string) - the instance name
Returns:
(name, id, memory, vcpus, stat, times)
Overrides: hv_base.BaseHypervisor.GetInstanceInfo

GetAllInstancesInfo(self)

source code 

Get properties of all instances.

Returns:
[(name, id, memory, vcpus, stat, times),...]
Overrides: hv_base.BaseHypervisor.GetAllInstancesInfo

StartInstance(self, instance, block_devices)

source code 

Start an instance.

For the chroot manager, we try to mount the block device and execute '/ganeti-chroot start'.

Overrides: hv_base.BaseHypervisor.StartInstance

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

source code 

Stop an instance.

This method has complicated cleanup tests, as we must:

  • try to kill all leftover processes
  • try to unmount any additional sub-mountpoints
  • finally unmount the instance dir
Parameters:
  • instance - instance to stop
  • force - whether to do a "hard" stop (destroy)
  • retry - whether this is just a retry call
  • name - 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
Overrides: hv_base.BaseHypervisor.StopInstance

CleanupInstance(self, instance_name)

source code 

Cleanup after a stopped instance

Parameters:
  • instance_name - instance name to cleanup after
Overrides: hv_base.BaseHypervisor.CleanupInstance

RebootInstance(self, instance)

source code 

Reboot an instance.

This is not (yet) implemented for the chroot manager.

Overrides: hv_base.BaseHypervisor.RebootInstance

GetNodeInfo(self)

source code 

Return information about the node.

This is just a wrapper over the base GetLinuxNodeInfo method.

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
Overrides: hv_base.BaseHypervisor.GetNodeInfo

GetInstanceConsole(cls, instance, hvparams, beparams, root_dir=None)
Class Method

source code 

Return information for connecting to the console of an instance.

Overrides: hv_base.BaseHypervisor.GetInstanceConsole

Verify(self)

source code 

Verify the hypervisor.

For the chroot manager, it just checks the existence of the base dir.

Overrides: hv_base.BaseHypervisor.Verify

PowercycleNode(cls)
Class Method

source code 

Chroot powercycle, just a wrapper over Linux powercycle.

Overrides: hv_base.BaseHypervisor.PowercycleNode

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
Overrides: hv_base.BaseHypervisor.MigrateInstance

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:
{constants.HV_INIT_SCRIPT:(True, utils.IsNormAbsPath, "must be an abso\
lute normalized path", None, None),}