class documentation

class FakeHypervisor(hv_base.BaseHypervisor):

View In Hierarchy

Fake hypervisor interface.

This can be used for testing the ganeti code without having to have a real virtualisation software installed.

Class Method GetInstanceConsole Return information for connecting to the console of an instance.
Class Method PowercycleNode Fake hypervisor powercycle, just a wrapper over Linux powercycle.
Method __init__ Undocumented
Method AcceptInstance Prepare to accept an instance.
Method BalloonInstanceMemory Balloon an instance memory to a certain value.
Method FinalizeMigrationDst Finalize the instance migration on the target node.
Method FinalizeMigrationSource Finalize the instance migration on the source node.
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 CAN_MIGRATE Undocumented
Constant PARAMETERS Undocumented
Class Method _InstanceFile Compute the instance file for an instance name.
Method _IsAlive Checks if an instance is alive.
Method _MarkDown Mark the instance as running.
Method _MarkUp Mark the instance as running.
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 CleanupInstance Cleanup after a stopped instance
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
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):

Return information for connecting to the console of an instance.

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

Fake hypervisor powercycle, just a wrapper over Linux powercycle.

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

Undocumented

def AcceptInstance(self, instance, info, target):

Prepare to accept an instance.

Parameters
instance:objects.Instanceinstance to be accepted
info:stringinstance info, not used
target:stringtarget host (usually ip), on this node
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 FinalizeMigrationDst(self, instance, info, success):

Finalize the instance migration on the target node.

For the fake hv, this just marks the instance up.

Parameters
instance:objects.Instanceinstance whose migration is being finalized
info:string/data (opaque)migration information, from the source node
success:booleanwhether the migration was a success or a failure
def FinalizeMigrationSource(self, instance, success, live):

Finalize the instance migration on the source node.

Parameters
instance:objects.Instancethe instance that was migrated
success:boolwhether the migration succeeded or not
live:boolwhether the user requested a live migration or not
def GetAllInstancesInfo(self, hvparams=None):

Get properties of all instances.

Parameters
hvparams:dict of stringshypervisor parameter
Returns
list of tuples (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
tuple of (name, id, memory, vcpus, stat, times)
def GetMigrationStatus(self, instance):

Get the migration status

The fake hypervisor migration always succeeds.

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.

For the fake hypervisor, this does nothing.

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

Start an instance.

For the fake hypervisor, it just creates a file in the base dir, creating an exception if it already exists. We don't actually handle race conditions properly, since these are *FAKE* instances.

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

Stop an instance.

For the fake hypervisor, this just removes the file in the base dir, if it exist, otherwise we raise an exception.

def Verify(self, hvparams=None):

Verify the hypervisor.

For the fake hypervisor, it just checks the existence of the base dir.

Parameters
hvparams:dict of stringshypervisor parameters to be verified against; not used for fake hypervisors
Returns
Problem description if something is wrong, None otherwise
CAN_MIGRATE: bool =

Undocumented

Value
True
@classmethod
def _InstanceFile(cls, instance_name):

Compute the instance file for an instance name.

def _IsAlive(self, instance_name):

Checks if an instance is alive.

def _MarkDown(self, instance_name):

Mark the instance as running.

This does no checks, which should be done by its callers.

def _MarkUp(self, instance, memory):

Mark the instance as running.

This does no checks, which should be done by its callers.

_ROOT_DIR =

Undocumented

Value
pathutils.RUN_DIR+'/fake-hypervisor'