class BaseHypervisor(object):
Known subclasses: ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Abstract virtualisation technology interface
The goal is that all aspects of the virtualisation technology are abstracted away from the rest of code.
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 |
|
Return information for connecting to the console of an instance. |
Class Method |
|
Linux-specific powercycle method. |
Class Method |
|
Hard powercycle a node using hypervisor specific methods. |
Class Method |
|
Check the given parameters for validity. |
Static Method |
|
For linux systems, return actual OS information. |
Static Method |
|
Decide if migration between those version is likely to suceed. |
Method |
|
Prepare to accept an instance. |
Method |
|
Balloon an instance memory to a certain value. |
Method |
|
Cleanup after a stopped instance |
Method |
|
Finalize the instance migration on the target node. |
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 |
|
Hot-add a device. |
Method |
|
Hot-del a device. |
Method |
|
Hot-mod a device. |
Method |
|
Checks if hotplug is supported. |
Method |
|
Get the list of running instances. |
Method |
|
Migrate an instance. |
Method |
|
Get instance information to perform a migration. |
Method |
|
Reboot an instance. |
Method |
|
Fixup running instance's (config) state. |
Method |
|
Start an instance. |
Method |
|
Stop an instance |
Method |
|
Verify the hypervisor. |
Method |
|
Verifies that hotplug is supported. |
Method |
|
Verify if running instance (config) is in correct state. |
Constant | ANCILLARY |
Undocumented |
Constant | ANCILLARY |
Undocumented |
Constant | CAN |
whether this hypervisor can do migration (either live or non-live) |
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 |
ganeti.hypervisor.hv_kvm.KVMHypervisor
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 | |
errors.HypervisorError | when a parameter is not valid |
Return a list of ancillary files to be copied to all nodes as ancillary configuration files.
Returns | |
(list of absolute paths, list of absolute paths) | (all files, optional files) |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Return information for connecting to the console of an instance.
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
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.
Parameters | |
hvparams:dict of strings | hypervisor params to be used on this node |
ganeti.hypervisor.hv_kvm.KVMHypervisor
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 | |
errors.HypervisorError | when a parameter is not valid |
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.
Parameters | |
meminfo:string | name of the file containing meminfo |
cpuinfo:string | name of the file containing cpuinfo |
Returns | |
a dict with the following keys (values in MiB):
|
Decide if migration between those version is likely to suceed.
Given two versions of a hypervisor, give a guess whether live migration from the one version to the other version is likely to succeed. The current
ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
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 |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
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 |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
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 | instance name to cleanup after |
ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Finalize the instance migration on the target node.
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 |
ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Finalize the instance migration on the source node.
Parameters | |
instance:objects.Instance | the instance that was migrated |
success:bool | whether the migration succeeded or not |
live:bool | whether the user requested a live migration or not |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Get properties of all instances.
Parameters | |
hvparams:dict of strings | hypervisor parameter |
Returns | |
(string, string, int, int, HvInstanceState, int) | list of tuples (name, id, memory, vcpus, state, times) |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Get instance properties.
Parameters | |
instance | the instance name |
hvparams:dict of strings | hvparams to be used with this instance |
Returns | |
(string, string, int, int, HvInstanceState, int) | tuple (name, id, memory, vcpus, state, times) |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Get the migration status
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 |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Return information about the node.
Parameters | |
hvparams:dict of strings | hypervisor parameters |
Returns | |
a dict with at least the following keys (memory values in MiB):
|
ganeti.hypervisor.hv_kvm.KVMHypervisor
Checks if hotplug is supported.
By default is not. Currently only KVM hypervisor supports it.
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Get the list of running instances.
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Migrate an instance.
Parameters | |
cluster | name of the cluster |
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 |
Get instance information to perform a migration.
By default assume no information is needed.
Parameters | |
instance:objects.Instance | instance to be migrated |
Returns | |
string/data (opaque) | instance migration information - serialized form |
ganeti.hypervisor.hv_xen.XenHypervisor
Fixup running instance's (config) state.
Parameters | |
instance:objects.Instance | instance to restore |
block | blockdevices assigned to this instance |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Start an instance.
Parameters | |
instance:objects.Instance | instance to start |
block | blockdevices assigned to this instance |
startup | if instance should be paused at startup |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
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 |
timeout:int or None | if the parameter is not None, a soft shutdown operation will be killed after the specified number of seconds. A hard (forced) shutdown cannot have a timeout |
Raises | |
errors.HypervisorError | when a parameter is not valid or the instance failed to be stopped |
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
Verify the hypervisor.
Parameters | |
hvparams:dict of strings | hypervisor parameters to be verified against |
Returns | |
Problem description if something is wrong, None otherwise |
ganeti.hypervisor.hv_kvm.KVMHypervisor
Verifies that hotplug is supported.
Given the target device and hotplug action checks if hotplug is actually supported.
Parameters | |
instance:objects.Instance | the instance object |
action:string | one of the supported hotplug commands |
dev | one of the supported device types to hotplug |
Raises | |
errors.HotplugError | if hotplugging is not supported |
ganeti.hypervisor.hv_xen.XenHypervisor
Verify if running instance (config) is in correct state.
Parameters | |
instance:objects.Instance | instance to verify |
Returns | |
bool, if instance in correct state |
ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_xen.XenHypervisor
whether this hypervisor can do migration (either live or non-live)
Value |
|
ganeti.hypervisor.hv_chroot.ChrootManager
, ganeti.hypervisor.hv_fake.FakeHypervisor
, ganeti.hypervisor.hv_kvm.KVMHypervisor
, ganeti.hypervisor.hv_lxc.LXCHypervisor
, ganeti.hypervisor.hv_xen.XenHvmHypervisor
, ganeti.hypervisor.hv_xen.XenPvmHypervisor
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 |
|
Check if the parameter value is a kind of value meaning unspecified.
This function checks if the parameter value is a kind of value meaning unspecified.
Parameters | |
param | the parameter value that needs to be checked |
Returns | |
bool | True if the parameter value is a kind of value meaning unspecified, False otherwise |
Formats the verification results, given a list of errors.
Parameters | |
msgs | list of errors, possibly empty |
Returns | |
overall problem description if something is wrong, None otherwise |
Get the correct startup memory for an instance
This function calculates how much memory an instance should be started with, making sure it's a value between the minimum and the maximum memory, but also trying to use no more than the current free memory on the node.
Parameters | |
instance:objects.Instance | the instance that is being started |
Returns | |
integer | memory the instance should be started with |