class documentation

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:

  • the start and stop of the chroot environment are done via a script called ganeti-chroot located in the root directory of the first drive, which should be created by the OS definition
  • this script must accept the start and stop argument and, on shutdown, it should cleanly shutdown the daemons/processes using the chroot
  • the daemons run in chroot should only bind to the instance IP (to which the OS create script has access via the instance name)
  • since some daemons in the node could be listening on the wildcard address, some ports might be unavailable
  • the instance listing will show no memory usage
  • on shutdown, the chroot manager will try to find all mountpoints under the root dir of the instance and unmount them
  • instance alive check is based on whether any process is using the chroot
Class Method GetInstanceConsole Return information for connecting to the console of an instance.
Class Method PowercycleNode Chroot powercycle, just a wrapper over Linux powercycle.
Method __init__ Undocumented
Method BalloonInstanceMemory Balloon an instance memory to a certain value.
Method CleanupInstance Cleanup after a stopped instance
Method GetAllInstancesInfo Get properties of all instances.
Method GetInstanceInfo Get instance properties.
Method GetMigrationStatus Get the migration status
Method GetNodeInfo Return information about the node.
Method ListInstances Get the list of running instances.
Method MigrateInstance Migrate an instance.
Method RebootInstance Reboot an instance.
Method StartInstance Start an instance.
Method StopInstance Stop an instance.
Method Verify Verify the hypervisor.
Constant PARAMETERS Undocumented
Class Method _InstanceDir Return the root directory for an instance.
Static Method _GetMountSubdirs Return the list of mountpoints under a given path.
Static Method _IsDirLive Check if a directory looks like a live chroot.
Constant _ROOT_DIR Undocumented

Inherited from BaseHypervisor:

Class Method CheckParameterSyntax Check the given parameters for validity.
Class Method GetAncillaryFiles Return a list of ancillary files to be copied to all nodes as ancillary configuration files.
Class Method LinuxPowercycle Linux-specific powercycle method.
Class Method ValidateParameters Check the given parameters for validity.
Static Method GetLinuxNodeInfo For linux systems, return actual OS information.
Static Method VersionsSafeForMigration Decide if migration between those version is likely to suceed.
Method AcceptInstance Prepare to accept an instance.
Method FinalizeMigrationDst Finalize the instance migration on the target node.
Method FinalizeMigrationSource Finalize the instance migration on the source node.
Method HotAddDevice Hot-add a device.
Method HotDelDevice Hot-del a device.
Method HotModDevice Hot-mod a device.
Method HotplugSupported Checks if hotplug is supported.
Method MigrationInfo Get instance information to perform a migration.
Method RestoreInstance Fixup running instance's (config) state.
Method VerifyHotplugSupport Verifies that hotplug is supported.
Method VerifyInstance Verify if running instance (config) is in correct state.
Constant ANCILLARY_FILES Undocumented
Constant ANCILLARY_FILES_OPT Undocumented
Constant CAN_MIGRATE whether this hypervisor can do migration (either live or non-live)
Class Method _IsParamValueUnspecified Check if the parameter value is a kind of value meaning unspecified.
Static Method _FormatVerifyResults Formats the verification results, given a list of errors.
Method _InstanceStartupMemory Get the correct startup memory for an instance
@classmethod
def GetInstanceConsole(cls, instance, primary_node, node_group, hvparams, beparams, root_dir=None):

Return information for connecting to the console of an instance.

@classmethod
def PowercycleNode(cls, hvparams=None):

Chroot powercycle, just a wrapper over Linux powercycle.

Parameters
hvparams:dict of stringshypervisor params to be used on this node
def __init__(self):

Undocumented

def BalloonInstanceMemory(self, instance, mem):

Balloon an instance memory to a certain value.

Parameters
instance:objects.Instanceinstance to be accepted
mem:intactual memory size to use for instance runtime
def CleanupInstance(self, instance_name):

Cleanup after a stopped instance

def GetAllInstancesInfo(self, hvparams=None):

Get properties of all instances.

Parameters
hvparams:dict of stringshypervisor parameter
Returns
[(name, id, memory, vcpus, stat, times),...]
def GetInstanceInfo(self, instance_name, hvparams=None):

Get instance properties.

Parameters
instance_name:stringthe instance name
hvparams:dict of stringshvparams to be used with this instance
Returns
(name, id, memory, vcpus, stat, times)
def GetMigrationStatus(self, instance):

Get the migration status

Parameters
instance:objects.Instancethe instance that is being migrated
Returns
objects.MigrationStatusthe status of the current migration (one of constants.HV_MIGRATION_VALID_STATUSES), plus any additional progress info that can be retrieved from the hypervisor
def GetNodeInfo(self, hvparams=None):
def ListInstances(self, hvparams=None):

Get the list of running instances.

def MigrateInstance(self, cluster_name, instance, target, live):

Migrate an instance.

Parameters
cluster_name:stringname of the cluster
instance:objects.Instancethe instance to be migrated
target:stringhostname (usually ip) of the target node
live:booleanwhether to do a live or non-live migration
def RebootInstance(self, instance):

Reboot an instance.

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

def StartInstance(self, instance, block_devices, startup_paused):

Start an instance.

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

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

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
def Verify(self, hvparams=None):

Verify the hypervisor.

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

Parameters
hvparams:dict of stringshypervisor parameters to be verified against, not used in for chroot
Returns
Problem description if something is wrong, None otherwise
PARAMETERS =

Undocumented

Value
{constants.HV_INIT_SCRIPT: (True,
                            utils.IsNormAbsPath,
                            'must be an absolute normalized path',
                            None,
                            None)}
@classmethod
def _InstanceDir(cls, instance_name):

Return the root directory for an instance.

@staticmethod
def _GetMountSubdirs(path):

Return the list of mountpoints under a given path.

@staticmethod
def _IsDirLive(path):

Check if a directory looks like a live chroot.

_ROOT_DIR =

Undocumented

Value
pathutils.RUN_DIR+'/chroot-hypervisor'