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

Class Converter

source code


Converter class for OVF packages.

Converter is a class above both ImporterOVF and ExporterOVF. It's purpose is to provide a common interface for the two.

Instance Methods [hide private]
 
__init__(self, input_path, options)
Initialize the converter.
source code
 
_ReadInputData(self, input_path)
Reads the data on which the conversion will take place.
source code
string
_CompressDisk(self, disk_path, compression, action)
Performs (de)compression on the disk and returns the new path
source code
string @return path to the output disk
_ConvertDisk(self, disk_format, disk_path)
Performes conversion to specified format.
source code
 
Parse(self)
Parses the data and creates a structure containing all required info.
source code
 
Save(self)
Saves the gathered configuration in an apropriate format.
source code
 
Cleanup(self)
Cleans the temporary directory, if one was created.
source code

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

Static Methods [hide private]
string
_GetDiskQemuInfo(disk_path, regexp)
Figures out some information of the disk using qemu-img.
source code
Instance Variables [hide private]
optparse.Values options
options parsed from the command line
string output_dir
directory to which the results of conversion shall be written
string temp_dir
temporary directory created then we deal with OVA
utils.TemporaryFileManager temp_file_manager
container for temporary files created during conversion
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, input_path, options)
(Constructor)

source code 

Initialize the converter.

Parameters:
  • input_path (string) - path to the Converter input file
  • options (optparse.Values) - command line options
Raises:
Overrides: object.__init__

_ReadInputData(self, input_path)

source code 

Reads the data on which the conversion will take place.

Parameters:
  • input_path (string) - absolute path to the Converter input file

_CompressDisk(self, disk_path, compression, action)

source code 

Performs (de)compression on the disk and returns the new path

Parameters:
  • disk_path (string) - path to the disk
  • compression (string) - compression type
  • action (string) - whether the action is compression or decompression
Returns: string
new disk path after (de)compression
Raises:

_ConvertDisk(self, disk_format, disk_path)

source code 

Performes conversion to specified format.

Parameters:
  • disk_format (string) - format to which the disk should be converted
  • disk_path (string) - path to the disk that should be converted
Returns: string @return path to the output disk
Raises:

_GetDiskQemuInfo(disk_path, regexp)
Static Method

source code 

Figures out some information of the disk using qemu-img.

Parameters:
  • disk_path (string) - path to the disk we want to know the format of
  • regexp (string) - string that has to be matched, it has to contain one group
Returns: string
disk format
Raises: