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

Module hv_kvm

source code

KVM hypervisor

Classes [hide private]
  QmpMessage
QEMU Messaging Protocol (QMP) message.
  QmpConnection
Connection to the QEMU Monitor using the QEMU Monitor Protocol (QMP).
  KVMHypervisor
KVM hypervisor interface
Functions [hide private]
 
_GetTunFeatures(fd, _ioctl=fcntl.ioctl)
Retrieves supported TUN features from file descriptor.
source code
 
_ProbeTapVnetHdr(fd, _features_fn=_GetTunFeatures)
Check whether to enable the IFF_VNET_HDR flag.
source code
tuple
_OpenTap(vnet_hdr=True)
Open a new tap device and return its file descriptor.
source code
Variables [hide private]
  affinity = None
  _KVM_NETWORK_SCRIPT = pathutils.CONF_DIR+ "/kvm-vif-bridge"
  _KVM_START_PAUSED_FLAG = "-S"
  TUNSETIFF = 0x400454ca
  TUNGETIFF = 0x800454d2
  TUNGETFEATURES = 0x800454cf
  IFF_TAP = 0x0002
  IFF_NO_PI = 0x1000
  IFF_VNET_HDR = 0x4000
  _SPICE_ADDITIONAL_PARAMS = frozenset([constants.HV_KVM_SPICE_I...
SPICE parameters which depend on constants.HV_KVM_SPICE_BIND

Imports: errno, os, re, tempfile, time, logging, pwd, struct, fcntl, shutil, socket, stat, StringIO, utils, constants, errors, serializer, objects, uidpool, ssconf, netutils, pathutils, hv_base, utils_wrapper


Function Details [hide private]

_GetTunFeatures(fd, _ioctl=fcntl.ioctl)

source code 

Retrieves supported TUN features from file descriptor.

See Also: _ProbeTapVnetHdr

_ProbeTapVnetHdr(fd, _features_fn=_GetTunFeatures)

source code 

Check whether to enable the IFF_VNET_HDR flag.

To do this, _all_ of the following conditions must be met:

  1. TUNGETFEATURES ioctl() *must* be implemented
  2. TUNGETFEATURES ioctl() result *must* contain the IFF_VNET_HDR flag
  3. TUNGETIFF ioctl() *must* be implemented; reading the kernel code in drivers/net/tun.c there is no way to test this until after the tap device has been created using TUNSETIFF, and there is no way to change the IFF_VNET_HDR flag after creating the interface, catch-22! However both TUNGETIFF and TUNGETFEATURES were introduced in kernel version 2.6.27, thus we can expect TUNGETIFF to be present if TUNGETFEATURES is.
Parameters:
  • fd (int) - the file descriptor of /dev/net/tun

_OpenTap(vnet_hdr=True)

source code 

Open a new tap device and return its file descriptor.

This is intended to be used by a qemu-type hypervisor together with the -net tap,fd=<fd> command line parameter.

Parameters:
  • vnet_hdr (boolean) - Enable the VNET Header
Returns: tuple
(ifname, tapfd)

Variables Details [hide private]

_SPICE_ADDITIONAL_PARAMS

SPICE parameters which depend on constants.HV_KVM_SPICE_BIND

Value:
frozenset([constants.HV_KVM_SPICE_IP_VERSION, constants.HV_KVM_SPICE_P\
ASSWORD_FILE, constants.HV_KVM_SPICE_LOSSLESS_IMG_COMPR, constants.HV_\
KVM_SPICE_JPEG_IMG_COMPR, constants.HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR, c\
onstants.HV_KVM_SPICE_STREAMING_VIDEO_DETECTION, constants.HV_KVM_SPIC\
E_USE_TLS,])