class LXCHypervisor(hv_base.BaseHypervisor):
LXC-based virtualization.
Class Method |
|
Return a command for connecting to the console of an instance. |
Class Method |
|
LXC powercycle, just a wrapper over Linux powercycle. |
Method | __init__ |
Undocumented |
Method |
|
Balloon an instance memory to a certain value. |
Method |
|
Cleanup after a stopped instance. |
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. |
Method |
|
Reboot an instance. |
Method |
|
Start an instance. |
Method |
|
Stop an instance. |
Method |
|
Verify the hypervisor. |
Constant | PARAMETERS |
Undocumented |
Class Method | _ |
Ensures all cgroup subsystems required to run LXC container are mounted. |
Class Method | _ |
Return the list of CPU ids for an instance. |
Class Method | _ |
Return the CPU usage of an instance. |
Class Method | _ |
Return cgroup subsystems list that are enabled in current kernel. |
Class Method | _ |
Return the value of the specified cgroup parameter. |
Class Method | _ |
Return the memory limit for an instance |
Class Method | _ |
Return the directory that should be the base of cgroup fs. |
Class Method | _ |
Return the path of the specified cgroup parameter file. |
Class Method | _ |
Return the directory of the cgroup subsystem we use. |
Class Method | _ |
Return the dict of cgroup subsystem hierarchies this process belongs to. |
Class Method | _ |
Get and parse the drop capabilities list from the instance hvparams. |
Class Method | _ |
Return the LXC version currently used in the system. |
Class Method | _ |
Prepare cgroup subsystem mount point. |
Class Method | _ |
Return the configuration file for an instance. |
Class Method | _ |
Return the console log file path for an instance. |
Class Method | _ |
Return the root directory for an instance. |
Class Method | _ |
Return the log file for an instance. |
Class Method | _ |
Return the stash file path for an instance. |
Class Method | _ |
Return whether a cgroup parameter can be used. |
Class Method | _ |
Return True if instance is alive. |
Class Method | _ |
Return list of alive instances. |
Class Method | _ |
Mount the cgroup subsystem fs under the cgroup root dir. |
Class Method | _ |
Return mountable path for storage_path. |
Class Method | _ |
Set the value to the specified instance cgroup parameter. |
Class Method | _ |
Insures that the disks provided work with the current implementation. |
Class Method | _ |
Verify the validity of lxc command line tools. |
Class Method | _ |
Wait for an instance state transition within timeout |
Method | _ |
Actual implementation of the instance cleanup procedure. |
Method | _ |
Create an lxc.conf file for an instance. |
Method | _ |
Ensures all the directories needed for LXC use exist. |
Method | _ |
Get instance properties. |
Method | _ |
Load information stashed in file which was created by _SaveInstanceStash . |
Method | _ |
Save data to the instance stash file in serialized format. |
Method | _ |
Execute lxc-start and wait until container health is confirmed. |
Constant | _CGROUP |
Undocumented |
Constant | _DIR |
Undocumented |
Constant | _INSTANCE |
Undocumented |
Constant | _LOG |
Undocumented |
Constant | _LXC |
Undocumented |
Constant | _LXC |
Undocumented |
Constant | _MEMORY |
Undocumented |
Constant | _MEMORY |
Undocumented |
Constant | _PROC |
Undocumented |
Constant | _PROC |
Undocumented |
Constant | _REBOOT |
Undocumented |
Constant | _REQUIRED |
Undocumented |
Constant | _ROOT |
Undocumented |
Constant | _STASH |
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. |
Static Method |
|
Decide if migration between those version is likely to suceed. |
Method |
|
Prepare to accept an instance. |
Method |
|
Finalize the instance migration on the target node. |
Method |
|
Finalize the instance migration on the source node. |
Method |
|
Hot-add a device. |
Method |
|
Hot-del a device. |
Method |
|
Hot-mod a device. |
Method |
|
Checks if hotplug is supported. |
Method |
|
Get instance information to perform a migration. |
Method |
|
Fixup running instance's (config) state. |
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) |
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 |
LXC powercycle, just a wrapper over Linux powercycle.
Parameters | |
hvparams:dict of strings | hypervisor params to be used 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 |
Get properties of all instances.
Parameters | |
hvparams:dict of strings | hypervisor parameter |
Returns | |
[(name, id, memory, vcpus, stat, times),...] |
Get instance properties.
Parameters | |
instance | the instance name |
hvparams:dict of strings | hvparams to be used with this instance |
Returns | |
tuple of strings | (name, id, memory, vcpus, stat, times) |
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 |
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 |
Start an instance.
For LXC, we try to mount the block device and execute 'lxc-start'. We use volatile containers.
Verify the hypervisor.
For the LXC manager, it just checks the existence of the base dir.
Parameters | |
hvparams:dict of strings | hypervisor parameters to be verified against; not used here |
Returns | |
Problem description if something is wrong, None otherwise |
Undocumented
Return the value of the specified cgroup parameter.
Parameters | |
instance | instance name |
param | cgroup subsystem parameter name @rtype string @return value read from cgroup subsystem fs |
Return the path of the specified cgroup parameter file.
Parameters | |
param | cgroup subsystem parameter name |
instance | Undocumented |
Returns | |
string | path of the cgroup subsystem parameter file |
Return the directory of the cgroup subsystem we use.
Parameters | |
subsystem:string | cgroup subsystem name |
Returns | |
string | path of the hierarchy directory for the subsystem |
Return the dict of cgroup subsystem hierarchies this process belongs to.
The dictionary has the cgroup subsystem as a key and its hierarchy as a value. Information is read from /proc/self/cgroup.
Get and parse the drop capabilities list from the instance hvparams.
Parameters | |
hvparams:dict of strings | instance hvparams @rtype list(string) @return list of drop capabilities |
Return the LXC version currently used in the system.
Version information will be retrieved by command specified by from_cmd.
Parameters | |
from | the lxc command used to retrieve version information |
Returns | |
LXCVersion | a version object which represents the version retrieved from the command |
Prepare cgroup subsystem mount point.
Parameters | |
subsystem:string | cgroup subsystem name to mount @rtype string @return path of subsystem mount point |
Return the stash file path for an instance.
The stash file is used to keep information needed to clean up after the destruction of the instance.
Return whether a cgroup parameter can be used.
This is checked by seeing whether there is a file representation of the parameter in the location where the cgroup is mounted.
Parameters | |
parameter:string | The name of the parameter. |
hvparams | The hypervisor parameters, optional. |
Returns | |
boolean | Undocumented |
Mount the cgroup subsystem fs under the cgroup root dir.
Parameters | |
subsystem:string | cgroup subsystem name to mount @rtype string @return path of subsystem mount point |
Return mountable path for storage_path.
This function creates a partition mapping for storage_path and returns the first partition device path as a rootfs partition, and stashes the loopback device path. If storage_path is not a multi-partition block device, just return storage_path.
Set the value to the specified instance cgroup parameter.
Parameters | |
instance | instance name |
param | cgroup subsystem parameter name |
param | cgroup subsystem parameter value to be set |
Verify the validity of lxc command line tools.
Returns | |
list(str) | list of problem descriptions. the blank list will be returned if there is no problem. |
Wait for an instance state transition within timeout
Return True if an instance state changed to the desired state within timeout secs.
Actual implementation of the instance cleanup procedure.
Parameters | |
instance | instance name |
stash:dict(string:any) | dict that contains desired information for instance cleanup |
Get instance properties.
Parameters | |
instance | the instance name |
Returns | |
tuple of strings | (name, id, memory, vcpus, stat, times) |