class OVFReader(object):
Reader class for OVF files.
Method | __init__ |
Initialiaze the reader - load the .ovf file to XML parser. |
Method |
|
Provides backend information - vcpus, memory, auto balancing options. |
Method |
|
Provides list of file names for the disks used by the instance. |
Method |
|
Returns disk template from .ovf file |
Method |
|
Provides hypervisor information - hypervisor name and options. |
Method |
|
Provides information about instance name. |
Method |
|
Provides data about the network in the OVF instance. |
Method |
|
Provides operating system information - os name and options. |
Method |
|
Provides tags information for instance. |
Method |
|
Provides version number read from .ovf file |
Method |
|
Verifies manifest for the OVF package, if one is given. |
Instance Variable | files |
list of files in the OVF package |
Instance Variable | input |
directory in which the .ovf file resides |
Instance Variable | schema |
name of the .ovf file |
Instance Variable | tree |
XML tree of the .ovf file |
Static Method | _ |
Reads text in all children and creates the dictionary from the contents. |
Method | _ |
Get specified attribute from all nodes accessible using given path. |
Method | _ |
Searches for element on a path that matches certain attribute value. |
Method | _ |
Searches for element on a path that matches certain text value. |
Initialiaze the reader - load the .ovf file to XML parser.
It is assumed that names of manifesto (.mf), certificate (.cert) and ovf files are the same. In order to account any other files as part of the ovf package, they have to be explicitly mentioned in the Resources section of the .ovf file.
Parameters | |
input | absolute path to the .ovf file |
Raises | |
errors.OpPrereqError | when .ovf file is not a proper XML file or some of the files mentioned in Resources section do not exist |
Provides backend information - vcpus, memory, auto balancing options.
Returns | |
dict | dictionary containing options for vcpus, memory and auto balance settings |
Provides list of file names for the disks used by the instance.
Returns | |
list | list of file names, as referenced in .ovf file |
Provides hypervisor information - hypervisor name and options.
Returns | |
dict | dictionary containing name of the used hypervisor and all the specified options |
Provides data about the network in the OVF instance.
The method gathers the data about networks used by OVF instance. It assumes that 'name' tag means something - in essence, if it contains one of the words 'bridged' or 'routed' then that will be the mode of this network in Ganeti. The information about the network can be either in GanetiSection or VirtualHardwareSection.
Returns | |
dict | dictionary containing all the network information |
Provides operating system information - os name and options.
Returns | |
dict | dictionary containing name and options for the chosen OS |
Provides tags information for instance.
Returns | |
string or None | string of comma-separated tags for the instance |
Verifies manifest for the OVF package, if one is given.
Raises | |
errors.OpPrereqError | if SHA1 checksums do not match |
Reads text in all children and creates the dictionary from the contents.
Parameters | |
root:ET.ElementTree or None | father of the nodes we want to collect data about |
schema:string | schema name to be removed from the tag |
Returns | |
dict | dictionary containing tags and their text contents, tags have their schema fragment removed or empty dictionary, when root is None |
Get specified attribute from all nodes accessible using given path.
Function follows the path from root node to the desired tags using path, then reads the apropriate attribute values.
Parameters | |
path:string | path of nodes to visit |
attribute:string | attribute for which we gather the information |
Returns | |
list | for each accessible tag with the attribute value set, value of the attribute |
Searches for element on a path that matches certain attribute value.
Function follows the path from root node to the desired tags using path, then searches for the first one matching the attribute value.
Parameters | |
path:string | path of nodes to visit |
match | pair (attribute, value) for which we search |
Returns | |
ET.ElementTree or None | first element matching match_attr or None if nothing matches |
Searches for element on a path that matches certain text value.
Function follows the path from root node to the desired tags using path, then searches for the first one matching the text value.
Parameters | |
path:string | path of nodes to visit |
match | pair (node, text) for which we search |
Returns | |
ET.ElementTree or None | first element matching match_text or None if nothing matches |