Package ganeti :: Package hypervisor :: Module hv_xen
[hide private]
[frames] | no frames]

Module hv_xen

source code

Xen hypervisors

Classes [hide private]
  XenHypervisor
Xen generic hypervisor interface
  XenPvmHypervisor
Xen PVM hypervisor interface
  XenHvmHypervisor
Xen HVM hypervisor interface
Functions [hide private]
 
_CreateConfigCpus(cpu_mask)
Create a CPU config string for Xen's config file.
source code
list
_RunInstanceList(fn, instance_list_errors)
Helper function for _GetInstanceList to retrieve the list of instances from xen.
source code
 
_ParseInstanceList(lines, include_node)
Parses the output of listing instances by xen.
source code
 
_GetInstanceList(fn, include_node, _timeout=5)
Return the list of running instances.
source code
 
_IsInstanceRunning(instance_info) source code
 
_IsInstanceShutdown(instance_info) source code
 
_ParseNodeInfo(info)
Return information about the node.
source code
dict
_MergeInstanceInfo(info, instance_list)
Updates node information from _ParseNodeInfo with instance info.
source code
 
_GetNodeInfo(info, instance_list)
Combines _MergeInstanceInfo and _ParseNodeInfo.
source code
 
_GetConfigFileDiskData(block_devices, blockdev_prefix, _letters=_DISK_LETTERS)
Get disk directives for Xen config file.
source code
Variables [hide private]
  XEND_CONFIG_FILE = utils.PathJoin(pathutils.XEN_CONFIG_DIR, "x...
  XL_CONFIG_FILE = utils.PathJoin(pathutils.XEN_CONFIG_DIR, "xen...
  VIF_BRIDGE_SCRIPT = utils.PathJoin(pathutils.XEN_CONFIG_DIR, "...
  _DOM0_NAME = "Domain-0"
  _DISK_LETTERS = string.ascii_lowercase
  _FILE_DRIVER_MAP = {constants.FD_LOOP: "file", constants.FD_BL...

Imports: logging, errno, string, shutil, StringIO, constants, errors, utils, hv_base, netutils, objects, pathutils


Function Details [hide private]

_RunInstanceList(fn, instance_list_errors)

source code 

Helper function for _GetInstanceList to retrieve the list of instances from xen.

Parameters:
  • fn (callable) - Function to query xen for the list of instances
  • instance_list_errors (list) - Error list
Returns: list

_ParseInstanceList(lines, include_node)

source code 

Parses the output of listing instances by xen.

Parameters:
  • lines (list) - Result of retrieving the instance list from xen
  • include_node (boolean) - If True, return information for Dom0
Returns:
list of tuple containing (name, id, memory, vcpus, state, time spent)

_GetInstanceList(fn, include_node, _timeout=5)

source code 

Return the list of running instances.

See _RunInstanceList and _ParseInstanceList for parameter details.

_ParseNodeInfo(info)

source code 

Return information about the node.

Returns:
a dict with the following keys (memory values in MiB):
  • memory_total: the total memory size on the node
  • memory_free: the available memory on the node for instances
  • nr_cpus: total number of CPUs
  • nr_nodes: in a NUMA system, the number of domains
  • nr_sockets: the number of physical CPU sockets in the node
  • hv_version: the hypervisor version in the form (major, minor)

_MergeInstanceInfo(info, instance_list)

source code 

Updates node information from _ParseNodeInfo with instance info.

Parameters:
  • info (dict) - Result from _ParseNodeInfo
  • instance_list (list of tuples) - list of instance information; one tuple per instance
Returns: dict

_GetNodeInfo(info, instance_list)

source code 

Combines _MergeInstanceInfo and _ParseNodeInfo.

Parameters:
  • instance_list (list of tuples) - list of instance information; one tuple per instance

_GetConfigFileDiskData(block_devices, blockdev_prefix, _letters=_DISK_LETTERS)

source code 

Get disk directives for Xen config file.

This method builds the xen config disk directive according to the given disk_template and block_devices.

Parameters:
  • block_devices - list of tuples (cfdev, rldev):
    • cfdev: dict containing ganeti config disk part
    • rldev: ganeti.block.bdev.BlockDev object
  • blockdev_prefix - a string containing blockdevice prefix, e.g. "sd" for /dev/sda
Returns:
string containing disk directive for xen instance config file

Variables Details [hide private]

XEND_CONFIG_FILE

Value:
utils.PathJoin(pathutils.XEN_CONFIG_DIR, "xend-config.sxp")

XL_CONFIG_FILE

Value:
utils.PathJoin(pathutils.XEN_CONFIG_DIR, "xen/xl.conf")

VIF_BRIDGE_SCRIPT

Value:
utils.PathJoin(pathutils.XEN_CONFIG_DIR, "scripts/vif-bridge")

_FILE_DRIVER_MAP

Value:
{constants.FD_LOOP: "file", constants.FD_BLKTAP: "tap:aio", constants.\
FD_BLKTAP2: "tap2:tapdisk:aio",}