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

Class OVFImporter

source code


Converter from OVF to Ganeti config file.

Instance Methods [hide private]
 
_ReadInputData(self, input_path)
Reads the data on which the conversion will take place.
source code
 
_UnpackOVA(self, input_path)
Unpacks the .ova package into temporary directory.
source code
 
Parse(self)
Parses the data and creates a structure containing all required info.
source code
string
_ParseNameOptions(self)
Returns name if one was given in command line.
source code
string
_ParseTemplateOptions(self)
Returns disk template if one was given in command line.
source code
dict
_ParseHypervisorOptions(self)
Parses hypervisor options given in a command line.
source code
dict
_ParseOSOptions(self)
Parses OS options given in command line.
source code
dict
_ParseBackendOptions(self)
Parses backend options given in command line.
source code
string
_ParseTags(self)
Returns tags list given in command line.
source code
dict
_ParseNicOptions(self)
Parses network options given in a command line or as a dictionary.
source code
dict
_ParseDiskOptions(self)
Parses disk options given in a command line.
source code
dict
_GetDiskInfo(self)
Gathers information about disks used by instance, perfomes conversion.
source code
 
Save(self)
Saves all the gathered information in a constant.EXPORT_CONF_FILE file.
source code

Inherited from Converter: Cleanup, __init__

Inherited from Converter (private): _CompressDisk, _ConvertDisk

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
_GetInfo(name, cmd_arg, cmd_function, nocmd_function, ignore_test=False)
Get information about some section - e.g.
source code

Inherited from Converter (private): _GetDiskQemuInfo

Instance Variables [hide private]
string input_dir
directory in which the .ovf file resides
string input_path
complete path to the .ovf file
string output_dir
directory to which the results of conversion shall be written
OVFReader ovf_reader
OVF reader instance collects data from .ovf file
dict results_backend
backend information gathered from .ovf file or command line arguments
dict results_disk
disk information gathered from .ovf file or command line arguments
dict results_hypervisor
hypervisor information gathered from .ovf file or command line arguments
string results_name
name of imported instance
dict results_network
network information gathered from .ovf file or command line arguments
dict results_os
operating system information gathered from .ovf file or command line arguments
string results_tags
string containing instance-specific tags
string results_template
disk template read from .ovf file or command line arguments
string results_version
version as required by Ganeti import

Inherited from Converter: options, temp_dir, temp_file_manager

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_ReadInputData(self, input_path)

source code 

Reads the data on which the conversion will take place.

Parameters:
  • input_path (string) - absolute path to the .ovf or .ova input file
Raises:
Overrides: Converter._ReadInputData

_UnpackOVA(self, input_path)

source code 

Unpacks the .ova package into temporary directory.

Parameters:
  • input_path (string) - path to the .ova package file
Raises:
  • errors.OpPrereqError - if file is not a proper tarball, one of the files in the archive seem malicious (e.g. path starts with '../') or .ova package does not contain .ovf file

Parse(self)

source code 

Parses the data and creates a structure containing all required info.

The method reads the information given either as a command line option or as a part of the OVF description.

Raises:
  • errors.OpPrereqError - if some required part of the description of virtual instance is missing or unable to create output directory
Overrides: Converter.Parse

_GetInfo(name, cmd_arg, cmd_function, nocmd_function, ignore_test=False)
Static Method

source code 

Get information about some section - e.g. disk, network, hypervisor.

Parameters:
  • name (string) - name of the section
  • cmd_arg (dict) - command line argument specific for section 'name'
  • cmd_function (callable) - function to call if 'cmd_args' exists
  • nocmd_function (callable) - function to call if 'cmd_args' is not there

_ParseNameOptions(self)

source code 

Returns name if one was given in command line.

Returns: string
name of an instance

_ParseTemplateOptions(self)

source code 

Returns disk template if one was given in command line.

Returns: string
disk template name

_ParseHypervisorOptions(self)

source code 

Parses hypervisor options given in a command line.

Returns: dict
dictionary containing name of the chosen hypervisor and all the options

_ParseOSOptions(self)

source code 

Parses OS options given in command line.

Returns: dict
dictionary containing name of chosen OS and all its options

_ParseBackendOptions(self)

source code 

Parses backend options given in command line.

Returns: dict
dictionary containing vcpus, memory and auto-balance options

_ParseTags(self)

source code 

Returns tags list given in command line.

Returns: string
string containing comma-separated tags

_ParseNicOptions(self)

source code 

Parses network options given in a command line or as a dictionary.

Returns: dict
dictionary of network-related options

_ParseDiskOptions(self)

source code 

Parses disk options given in a command line.

Returns: dict
dictionary of disk-related options
Raises:
  • errors.OpPrereqError - disk description does not contain size information or size information is invalid or creation failed

_GetDiskInfo(self)

source code 

Gathers information about disks used by instance, perfomes conversion.

Returns: dict
dictionary of disk-related options
Raises:

Save(self)

source code 

Saves all the gathered information in a constant.EXPORT_CONF_FILE file.

Raises:
Overrides: Converter.Save