class documentation

class OVFWriter(object):

View In Hierarchy

Writer class for OVF files.

Method __init__ Initialize the writer - set the top element.
Method PrettyXmlDump Formatter of the XML file.
Method SaveDisksData Convert disk information to certain OVF sections.
Method SaveGanetiData Convert Ganeti-specific information to GanetiSection.
Method SaveNetworksData Convert network information to NetworkSection.
Method SaveVirtualSystemData Convert virtual system information to OVF sections.
Instance Variable hardware_list list of items prepared for VirtualHardwareSection
Instance Variable next_instance_id next instance id to be used when creating elements on hardware_list
Instance Variable tree XML tree that we are constructing
Instance Variable virtual_system_type value of vssd:VirtualSystemType, for external usage in VMWare this requires to be vmx
Static Method _SaveNameAndParams Save name and parameters information under root using data.
def __init__(self, has_gnt_section):

Initialize the writer - set the top element.

Parameters
has_gnt_section:boolif the Ganeti schema should be added - i.e. this means that Ganeti section will be present
def PrettyXmlDump(self):

Formatter of the XML file.

Returns
stringXML tree in the form of nicely-formatted string
def SaveDisksData(self, disks):

Convert disk information to certain OVF sections.

Parameters
disks:listlist of dictionaries of disk options from config.ini
def SaveGanetiData(self, ganeti, networks):

Convert Ganeti-specific information to GanetiSection.

Parameters
ganeti:dictdictionary of Ganeti-specific options from config.ini
networks:listlist of dictionaries of network options form config.ini
def SaveNetworksData(self, networks):

Convert network information to NetworkSection.

Parameters
networks:listlist of dictionaries of network options form config.ini
def SaveVirtualSystemData(self, name, vcpus, memory):

Convert virtual system information to OVF sections.

Parameters
name:stringname of the instance
vcpus:intnumber of VCPUs
memory:intRAM memory in MB
hardware_list: list =

list of items prepared for VirtualHardwareSection

next_instance_id: int =

next instance id to be used when creating elements on hardware_list

tree: ET.ElementTree =

XML tree that we are constructing

virtual_system_type: string =

value of vssd:VirtualSystemType, for external usage in VMWare this requires to be vmx

@staticmethod
def _SaveNameAndParams(root, data):

Save name and parameters information under root using data.

Parameters
root:ET.Elementroot element for the Name and Parameters
data:dictdata from which we gather the values