Package ganeti :: Module ovf
[hide private]
[frames] | no frames]

Module ovf

source code

Converter tools between ovf and ganeti config file

Classes [hide private]
  OVFReader
Reader class for OVF files.
  OVFWriter
Writer class for OVF files.
  Converter
Converter class for OVF packages.
  OVFImporter
Converter from OVF to Ganeti config file.
  ConfigParserWithDefaults
This is just a wrapper on SafeConfigParser, that uses default values
  OVFExporter
Converter from Ganeti config file to OVF
Functions [hide private]
 
CheckQemuImg()
Make sure that qemu-img is present before performing operations.
source code
 
LinkFile(old_path, prefix=None, suffix=None, directory=None)
Create link with a given prefix and suffix.
source code
 
SubElementText(parent, tag, text, attrib={}, **extra)
This is just a wrapper on ET.SubElement that always has text content.
source code
Variables [hide private]
  ParseError = None
hash(x)
  GANETI_SCHEMA = "http://ganeti"
  OVF_SCHEMA = "http://schemas.dmtf.org/ovf/envelope/1"
  RASD_SCHEMA = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema...
  VSSD_SCHEMA = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema...
  XML_SCHEMA = "http://www.w3.org/2001/XMLSchema-instance"
  OVA_EXT = ".ova"
  OVF_EXT = ".ovf"
  MF_EXT = ".mf"
  CERT_EXT = ".cert"
  COMPRESSION_EXT = ".gz"
  FILE_EXTENSIONS = [OVF_EXT, MF_EXT, CERT_EXT,]
  COMPRESSION_TYPE = "gzip"
  NO_COMPRESSION = [None, "identity"]
  COMPRESS = "compression"
  DECOMPRESS = "decompression"
  ALLOWED_ACTIONS = [COMPRESS, DECOMPRESS]
  VMDK = "vmdk"
  RAW = "raw"
  COW = "cow"
  ALLOWED_FORMATS = [RAW, COW, VMDK]
  RASD_TYPE = {"vcpus": "3", "memory": "4", "scsi-controller": "...
  SCSI_SUBTYPE = "lsilogic"
  VS_TYPE = {"ganeti": "ganeti-ovf", "external": "vmx-04",}
  ALLOCATION_UNITS = {"b": ["bytes", "b"], "kb": ["kilobytes", "...
  CONVERT_UNITS_TO_MB = {"b": lambda x: x/(1024* 1024), "kb": la...
  NAME = "name"
  OS = "os"
  HYPERV = "hypervisor"
  VCPUS = "vcpus"
  MEMORY = "memory"
  AUTO_BALANCE = "auto_balance"
  DISK_TEMPLATE = "disk_template"
  TAGS = "tags"
  VERSION = "version"
  INSTANCE_ID = {"system": 0, "vcpus": 1, "memory": 2, "scsi": 3,}
  DISK_FORMAT = {RAW: "http://en.wikipedia.org/wiki/Byte", VMDK:...

Imports: ConfigParser, errno, logging, os, re, shutil, tarfile, tempfile, xml, ET, constants, errors, utils, pathutils


Function Details [hide private]

CheckQemuImg()

source code 

Make sure that qemu-img is present before performing operations.

Raises:

LinkFile(old_path, prefix=None, suffix=None, directory=None)

source code 

Create link with a given prefix and suffix.

This is a wrapper over os.link. It tries to create a hard link for given file, but instead of rising error when file exists, the function changes the name a little bit.

Parameters:
  • old_path (string) - path to the file that is to be linked
  • prefix (string) - prefix of filename for the link
  • suffix (string) - suffix of the filename for the link
  • directory (string) - directory of the link
Raises:

Variables Details [hide private]

RASD_SCHEMA

Value:
"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/" "CIM_ResourceAllo\
cationSettingData"

VSSD_SCHEMA

Value:
"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/" "CIM_VirtualSyste\
mSettingData"

RASD_TYPE

Value:
{"vcpus": "3", "memory": "4", "scsi-controller": "6", "ethernet-adapte\
r": "10", "disk": "17",}

ALLOCATION_UNITS

Value:
{"b": ["bytes", "b"], "kb": ["kilobytes", "kb", "byte * 2^10", "kibiby\
tes", "kib"], "mb": ["megabytes", "mb", "byte * 2^20", "mebibytes", "m\
ib"], "gb": ["gigabytes", "gb", "byte * 2^30", "gibibytes", "gib"],}

CONVERT_UNITS_TO_MB

Value:
{"b": lambda x: x/(1024* 1024), "kb": lambda x: x/ 1024, "mb": lambda \
x: x, "gb": lambda x: x* 1024,}

DISK_FORMAT

Value:
{RAW: "http://en.wikipedia.org/wiki/Byte", VMDK: "http://www.vmware.co\
m/interfaces/specifications/vmdk.html" "#monolithicSparse", COW: "http\
://www.gnome.org/~markmc/qcow-image-format.html",}