class documentation

class OVFImporter(Converter):

View In Hierarchy

Converter from OVF to Ganeti config file.

Method Parse Parses the data and creates a structure containing all required info.
Method Save Saves all the gathered information in a constant.EXPORT_CONF_FILE file.
Instance Variable input_dir directory in which the .ovf file resides
Instance Variable input_path complete path to the .ovf file
Instance Variable output_dir directory to which the results of conversion shall be written
Instance Variable ovf_reader OVF reader instance collects data from .ovf file
Instance Variable results_backend backend information gathered from .ovf file or command line arguments
Instance Variable results_disk disk information gathered from .ovf file or command line arguments
Instance Variable results_hypervisor hypervisor information gathered from .ovf file or command line arguments
Instance Variable results_name name of imported instance
Instance Variable results_network network information gathered from .ovf file or command line arguments
Instance Variable results_os operating system information gathered from .ovf file or command line arguments
Instance Variable results_tags string containing instance-specific tags
Instance Variable results_template disk template read from .ovf file or command line arguments
Instance Variable results_version version as required by Ganeti import
Instance Variable temp_dir Undocumented
Static Method _GetInfo Get information about some section - e.g. disk, network, hypervisor.
Method _GetDiskInfo Gathers information about disks used by instance, perfomes conversion.
Method _ParseBackendOptions Parses backend options given in command line.
Method _ParseDiskOptions Parses disk options given in a command line.
Method _ParseHypervisorOptions Parses hypervisor options given in a command line.
Method _ParseNameOptions Returns name if one was given in command line.
Method _ParseNicOptions Parses network options given in a command line or as a dictionary.
Method _ParseOSOptions Parses OS options given in command line.
Method _ParseTags Returns tags list given in command line.
Method _ParseTemplateOptions Returns disk template if one was given in command line.
Method _ReadInputData Reads the data on which the conversion will take place.
Method _UnpackOVA Unpacks the .ova package into temporary directory.

Inherited from Converter:

Method __init__ Initialize the converter.
Method Cleanup Cleans the temporary directory, if one was created.
Instance Variable options options parsed from the command line
Instance Variable temp_file_manager container for temporary files created during conversion
Static Method _GetDiskQemuInfo Figures out some information of the disk using qemu-img.
Method _CompressDisk Performs (de)compression on the disk and returns the new path
Method _ConvertDisk Performes conversion to specified format.
def Parse(self):

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.OpPrereqErrorif some required part of the description of virtual instance is missing or unable to create output directory
def Save(self):

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

Raises
errors.OpPrereqErrorwhen saving to config file failed
input_dir: string =

directory in which the .ovf file resides

input_path: string =

complete path to the .ovf file

output_dir: string =

directory to which the results of conversion shall be written

ovf_reader: OVFReader =

OVF reader instance collects data from .ovf file

results_backend: dict =

backend information gathered from .ovf file or command line arguments

results_disk: dict =

disk information gathered from .ovf file or command line arguments

results_hypervisor: dict =

hypervisor information gathered from .ovf file or command line arguments

results_name: string =

name of imported instance

results_network: dict =

network information gathered from .ovf file or command line arguments

results_os: dict =

operating system information gathered from .ovf file or command line arguments

results_tags: string =

string containing instance-specific tags

results_template: string =

disk template read from .ovf file or command line arguments

results_version: string =

version as required by Ganeti import

temp_dir =

Undocumented

@staticmethod
def _GetInfo(name, cmd_arg, cmd_function, nocmd_function, ignore_test=False):

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

Parameters
name:stringname of the section
cmd_arg:dictcommand line argument specific for section 'name'
cmd_function:callablefunction to call if 'cmd_args' exists
nocmd_function:callablefunction to call if 'cmd_args' is not there
ignore_testUndocumented
def _GetDiskInfo(self):

Gathers information about disks used by instance, perfomes conversion.

Returns
dictdictionary of disk-related options
Raises
errors.OpPrereqErrordisk is not in the same directory as .ovf file
def _ParseBackendOptions(self):

Parses backend options given in command line.

Returns
dictdictionary containing vcpus, memory and auto-balance options
def _ParseDiskOptions(self):

Parses disk options given in a command line.

Returns
dictdictionary of disk-related options
Raises
errors.OpPrereqErrordisk description does not contain size information or size information is invalid or creation failed
def _ParseHypervisorOptions(self):

Parses hypervisor options given in a command line.

Returns
dictdictionary containing name of the chosen hypervisor and all the options
def _ParseNameOptions(self):

Returns name if one was given in command line.

Returns
stringname of an instance
def _ParseNicOptions(self):

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

Returns
dictdictionary of network-related options
def _ParseOSOptions(self):

Parses OS options given in command line.

Returns
dictdictionary containing name of chosen OS and all its options
def _ParseTags(self):

Returns tags list given in command line.

Returns
stringstring containing comma-separated tags
def _ParseTemplateOptions(self):

Returns disk template if one was given in command line.

Returns
stringdisk template name
def _ReadInputData(self, input_path):

Reads the data on which the conversion will take place.

Parameters
input_path:stringabsolute path to the .ovf or .ova input file
Raises
errors.OpPrereqErrorif input file is neither .ovf nor .ova
def _UnpackOVA(self, input_path):

Unpacks the .ova package into temporary directory.

Parameters
input_path:stringpath to the .ova package file
Raises
errors.OpPrereqErrorif 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