class XenHypervisor(hv_base.BaseHypervisor):
Known subclasses: ganeti.hypervisor.hv_xen.XenHvmHypervisor
, ganeti.hypervisor.hv_xen.XenPvmHypervisor
Xen generic hypervisor interface
This is the Xen base class used for both Xen PVM and HVM. It contains all the functionality that is identical for both.
Class Method |
|
Return a command for connecting to the console of an instance. |
Static Method |
|
Decide if migration is likely to suceed for hypervisor versions. |
Method | __init__ |
Undocumented |
Method |
|
Prepare to accept an instance. |
Method |
|
Balloon an instance memory to a certain value. |
Method |
|
Finalize an instance migration. |
Method |
|
Finalize the instance migration on the source node. |
Method |
|
Get properties of all instances. |
Method |
|
Get instance properties. |
Method |
|
Get the migration status |
Method |
|
Return information about the node. |
Method |
|
Get the list of running instances. |
Method |
|
Migrate an instance to a target node. |
Method |
|
Get instance information to perform a migration. |
Method |
|
Xen-specific powercycle. |
Method |
|
Reboot an instance. |
Method |
|
Fixup running instance's state. |
Method |
|
Start an instance. |
Method |
|
Stop an instance. |
Method |
|
Verify the hypervisor. |
Method |
|
Verify if running instance (configuration) is in correct state. |
Constant | ANCILLARY |
Undocumented |
Constant | ANCILLARY |
Undocumented |
Constant | CAN |
Undocumented |
Constant | REBOOT |
Undocumented |
Constant | REBOOT |
Undocumented |
Class Method | _ |
Makes sure that the directories needed by the hypervisor exist. |
Class Method | _ |
Build Xen configuration for an instance. |
Class Method | _ |
Returns the name of the pid file for a socat process used to migrate. |
Class Method | _ |
Returns the directory holding the tap device files for a given instance. |
Class Method | _ |
Returns the name of the file containing the tap device for a given NIC |
Class Method | _ |
Kills the migration daemon if present. |
Class Method | _ |
Write the Xen config file for the instance. |
Method | _ |
Checks whether xl is enabled on an xl-capable node. |
Method | _ |
Get the config file name for an instance. |
Method | _ |
Destroy an instance if the instance exists. |
Method | _ |
Undocumented |
Method | _ |
Wrapper around module level _GetAllInstanceList . |
Method | _ |
Gather configuration details and write to disk. |
Method | _ |
Migrate an instance to a target node. |
Method | _ |
Returns the contents of the instance config file. |
Method | _ |
Remove the xen configuration file. |
Method | _ |
Rename an instance (domain). |
Method | _ |
Wrapper around utils.process.RunCmd to run Xen command. |
Method | _ |
Shutdown an instance if the instance is running. |
Method | _ |
Move the Xen config file to the log directory and return its new path. |
Method | _ |
Stop an instance. |
Method | _ |
Write the Xen config file for the instance. |
Method | _ |
Undocumented |
Constant | _DIRS |
Undocumented |
Constant | _INSTANCE |
Undocumented |
Constant | _INSTANCE |
Undocumented |
Constant | _MIGRATION |
Undocumented |
Constant | _NICS |
Undocumented |
Constant | _ROOT |
Undocumented |
Instance Variable | _cfgdir |
Undocumented |
Instance Variable | _cmd |
Undocumented |
Instance Variable | _run |
Undocumented |
Inherited from BaseHypervisor
:
Class Method |
|
Check the given parameters for validity. |
Class Method |
|
Return a list of ancillary files to be copied to all nodes as ancillary configuration files. |
Class Method |
|
Linux-specific powercycle method. |
Class Method |
|
Check the given parameters for validity. |
Static Method |
|
For linux systems, return actual OS information. |
Method |
|
Cleanup after a stopped instance |
Method |
|
Hot-add a device. |
Method |
|
Hot-del a device. |
Method |
|
Hot-mod a device. |
Method |
|
Checks if hotplug is supported. |
Method |
|
Verifies that hotplug is supported. |
Constant | PARAMETERS |
a dict of parameter name: check type; the check type is a five-tuple containing: |
Class Method | _ |
Check if the parameter value is a kind of value meaning unspecified. |
Static Method | _ |
Formats the verification results, given a list of errors. |
Method | _ |
Get the correct startup memory for an instance |
Decide if migration is likely to suceed for hypervisor versions.
Given two versions of a hypervisor, give a guess whether live migration from the one version to the other version is likely to succeed. For Xen, the heuristics is, that an increase by one on the second digit is OK. This fits with the current numbering scheme.
Parameters | |
src:list or tuple | Undocumented |
target:list or tuple | Undocumented |
Returns | |
bool | Undocumented |
Prepare to accept an instance.
Parameters | |
instance:objects.Instance | instance to be accepted |
info:string | content of the xen config file on the source node |
target:string | target host (usually ip), on this node |
Balloon an instance memory to a certain value.
Parameters | |
instance:objects.Instance | instance to be accepted |
mem:int | actual memory size to use for instance runtime |
Finalize an instance migration.
Write a config file if the instance is running on the destination node regardles if we think the migration succeeded or not. This will cover cases, when the migration succeeded but due to a timeout on the source node we think it failed. If we think the migration failed and there is an unstarted domain, clean it up.
Parameters | |
instance:objects.Instance | instance whose migration is being finalized |
config:string | content of the xen config file from the source node |
success:boolean | whether the master node thinks the migration succeeded |
Finalize the instance migration on the source node.
Parameters | |
instance:objects.Instance | the instance that was migrated |
success:bool | whether the master thinks the migration succeeded |
_ | Undocumented |
Get properties of all instances.
Parameters | |
hvparams:dict of strings | hypervisor parameters |
Returns | |
(string, string, int, int, HypervisorInstanceState, int) | list of tuples (name, id, memory, vcpus, state, times) |
Get instance properties.
Parameters | |
instance | the instance name |
hvparams:dict of strings | the instance's hypervisor params |
Returns | |
tuple (name, id, memory, vcpus, stat, times) |
Get the migration status
As MigrateInstance for Xen is still blocking, if this method is called it means that MigrateInstance has completed successfully. So we can safely assume that the migration was successful and notify this fact to the client.
Parameters | |
instance:objects.Instance | the instance that is being migrated |
Returns | |
objects.MigrationStatus | the status of the current migration (one of constants.HV_MIGRATION_VALID_STATUSES ), plus any additional progress info that can be retrieved from the hypervisor |
Get the list of running instances.
Parameters | |
hvparams:dict of strings | the instance's hypervisor params |
Returns | |
list of strings | names of running instances |
Migrate an instance to a target node.
The migration will not be attempted if the instance is not currently running.
Parameters | |
_cluster | Undocumented |
instance:objects.Instance | the instance to be migrated |
target:string | ip address of the target node |
live:boolean | perform a live migration |
Get instance information to perform a migration.
Parameters | |
instance:objects.Instance | instance to be migrated |
Returns | |
string | content of the xen config file |
Xen-specific powercycle.
This first does a Linux reboot (which triggers automatically a Xen reboot), and if that fails it tries to do a Xen reboot. The reason we don't try a Xen reboot first is that the xen reboot launches an external command which connects to the Xen hypervisor, and that won't work in case the root filesystem is broken and/or the xend daemon is not working.
Parameters | |
hvparams:dict of strings | hypervisor params to be used on this node |
Fixup running instance's state.
Parameters | |
instance:objects.Instance | instance to restore |
block | blockdevices assigned to this instance |
Start an instance.
Parameters | |
instance:objects.Instance | instance to start |
block list of tuples (cfdev, rldev)
| blockdevices assigned to this instance |
startup | if instance should be paused at startup |
Verify the hypervisor.
For Xen, this verifies that the XL toolstack is present and functional
Parameters | |
hvparams:dict of strings | hypervisor parameters to be verified against |
Returns | |
Problem description if something is wrong, None otherwise |
Verify if running instance (configuration) is in correct state.
Parameters | |
instance:objects.Instance | instance to verify |
Returns | |
bool, if instance in correct state |
ganeti.hypervisor.hv_xen.XenHvmHypervisor
Undocumented
Value |
|
Makes sure that the directories needed by the hypervisor exist.
Parameters | |
extra | Additional directories which ought to exist. |
Write the Xen config file for the instance.
This version of the function just writes the config file from static data.
Checks whether xl is enabled on an xl-capable node.
Returns | |
bool | True if 'xl' is enabled, False otherwise |
Get the config file name for an instance.
Parameters | |
instance | instance name |
Returns | |
str | fully qualified path to instance config file |
Destroy an instance if the instance exists.
Parameters | |
name:string | name of the instance to destroy |
hvparams:dict of string | hypervisor parameters of the instance |
Rename an instance (domain).
Parameters | |
old | current name of the instance |
new | future (requested) name of the instace |
Wrapper around utils.process.RunCmd
to run Xen command.
Parameters | |
args | Undocumented |
timeout:int or None | if a timeout (in seconds) is specified, the command will be terminated after that number of seconds. |
See Also | |
utils.process.RunCmd |
Shutdown an instance if the instance is running.
The '-w' flag waits for shutdown to complete which avoids the need to poll in the case where we want to destroy the domain immediately after shutdown.
Parameters | |
name:string | name of the instance to stop |
hvparams:dict of string | hypervisor parameters of the instance |
timeout:int or None | a timeout after which the shutdown command should be killed, or None for no timeout |
Stop an instance.
Parameters | |
name:string | name of the instance to destroy |
force:boolean | whether to do a "hard" stop (destroy) |
hvparams:dict of string | hypervisor parameters of the instance |
timeout:int or None | a timeout after which the shutdown command should be killed, or None for no timeout |