# IAppliance Interface Reference

Represents a platform-independent appliance in OVF format. More...

List of all members.

## Public Member Functions
void | read (in wstring file)
| Reads an OVF file into the appliance object.
void | interpret ()
| Interprets the OVF data that was read when the appliance was constructed.
void | importMachines ([retval] out IProgress aProgress)
| Imports the appliance into VirtualBox by creating instances of IMachine and other interfaces that match the information contained in the appliance as closely as possible, as represented by the import instructions in the virtualSystemDescriptions array.
void | write (in wstring format, in wstring path,[retval] out IProgress aProgress)
| Writes the contents of the appliance exports into a new OVF file.
void | getWarnings ([retval] out wstring[] aWarnings)
| Returns textual warnings which occured during execution of interpret.
## Public Attributes
readonly attribute wstring | path
| Path to the main file of the OVF appliance, which is either the `.ovf` or the `.ova` file passed to read (for import) or write (for export).
readonly attribute wstring[] | disks
| Array of virtual disk definitions.
readonly attribute IVirtualSystemDescription[] | virtualSystemDescriptions
| Array of virtual system descriptions.

## Detailed Description

Represents a platform-independent appliance in OVF format.

An instance of this is returned by IVirtualBox::createAppliance, which can then be used to import and export appliances with VirtualBox.

The OVF standard suggests two different physical file formats:

1. If the OVF is distributed as a set of files, then file must be a fully qualified path name to an existing OVF descriptor file with an `.ovf` file extension. If this descriptor file references other files, as OVF appliances distributed as a set of files most likely do, those files must be in the same directory as the descriptor file.
2. If the OVF is distributed as a single file, it must be in TAR format and have the `.ova` file extension. This TAR file must then contain at least the OVF descriptor files and optionally other files.

   At this time, VirtualBox does not not yet support the packed (TAR) variant; support will be added with a later version.

Importing an OVF appliance into VirtualBox as instances of IMachine involves the following sequence of API calls:

1. Call IVirtualBox::createAppliance. This will create an empty IAppliance object.
2. On the new object, call read with the full path of the OVF file you would like to import. So long as this file is syntactically valid, this will succeed and return an instance of IAppliance that contains the parsed data from the OVF file.
3. Next, call interpret, which analyzes the OVF data and sets up the contents of the IAppliance attributes accordingly. These can be inspected by a VirtualBox front-end such as the GUI, and the suggestions can be displayed to the user. In particular, the virtualSystemDescriptions array contains instances of IVirtualSystemDescription which represent the virtual systems in the OVF, which in turn describe the virtual hardware prescribed by the OVF (network and hardware adapters, virtual disk images, memory size and so on). The GUI can then give the user the option to confirm and/or change these suggestions.
4. If desired, call IVirtualSystemDescription::setFinalValues for each virtual system to override the suggestions made by the interpret() routine.
5. Finally, call importMachines to create virtual machines in VirtualBox as instances of IMachine that match the information in the virtual system descriptions.

Exporting VirtualBox machines into an OVF appliance involves the following steps:

1. As with importing, first call IVirtualBox::createAppliance to create an empty IAppliance object.
2. For each machine you would like to export, call IMachine::export with the IAppliance object you just created. This creates an instance of IVirtualSystemDescription inside the appliance.
3. If desired, call IVirtualSystemDescription::setFinalValues for each virtual system to override the suggestions made by the export() routine.
4. Finally, call write with a path specification to have the OVF file written.

Interface ID:
  `{30BFA6B8-9EDA-4B0A-B218-A86813248CCD}`

## Member Function Documentation

void IAppliance::read | ( | in wstring | file | ) |

Reads an OVF file into the appliance object.

This method succeeds if the OVF is syntactically valid and, by itself, without errors. The mere fact that this method returns successfully does not mean that VirtualBox supports all features requested by the appliance; this can only be examined after a call to interpret.

Parameters:

  | file | Name of appliance file to open (either with an `.ovf` or `.ova` extension, depending on whether the appliance is distributed as a set of files or as a single file, respectively).

void IAppliance::interpret | ( |  | ) |

Interprets the OVF data that was read when the appliance was constructed.

After calling this method, one can inspect the virtualSystemDescriptions array attribute, which will then contain one IVirtualSystemDescription for each virtual machine found in the appliance.

Calling this method is the second step of importing an appliance into VirtualBox; see IAppliance for an overview.

After calling this method, one should call getWarnings to find out if problems were encountered during the processing which might later lead to errors.

void IAppliance::importMachines | ( | [retval] out IProgress | aProgress | ) |

Imports the appliance into VirtualBox by creating instances of IMachine and other interfaces that match the information contained in the appliance as closely as possible, as represented by the import instructions in the virtualSystemDescriptions array.

Calling this method is the final step of importing an appliance into VirtualBox; see IAppliance for an overview.

Since importing the appliance will most probably involve copying and converting disk images, which can take a long time, this method operates asynchronously and returns an IProgress object to allow the caller to monitor the progress.

Parameters:

  | aProgress |

void IAppliance::write | ( | in wstring | format,
|  | in wstring | path,
|  | [retval] out IProgress | aProgress |
| ) |  |  |

Writes the contents of the appliance exports into a new OVF file.

Calling this method is the final step of exporting an appliance from VirtualBox; see IAppliance for an overview.

Since exporting the appliance will most probably involve copying and converting disk images, which can take a long time, this method operates asynchronously and returns an IProgress object to allow the caller to monitor the progress.

Parameters:

  | format | Output format, as a string. Currently supported formats are "ovf-0.9" and "ovf-1.0"; future versions of VirtualBox may support additional formats.
  | path | Name of appliance file to open (either with an `.ovf` or `.ova` extension, depending on whether the appliance is distributed as a set of files or as a single file, respectively).
  | aProgress |

void IAppliance::getWarnings | ( | [retval] out wstring[] | aWarnings | ) |

Returns textual warnings which occured during execution of interpret.

Parameters:

  | aWarnings |

## Member Data Documentation

readonly attribute wstring IAppliance::path

Path to the main file of the OVF appliance, which is either the `.ovf` or the `.ova` file passed to read (for import) or write (for export).

This attribute is empty until one of these methods has been called.

readonly attribute wstring [] IAppliance::disks

Array of virtual disk definitions.

One such description exists for each disk definition in the OVF; each string array item represents one such piece of disk information, with the information fields separated by tab (\t) characters.

The caller should be prepared for additional fields being appended to this string in future versions of VirtualBox and therefore check for the number of tabs in the strings returned.

In the current version, the following eight fields are returned per string in the array:

1. Disk ID (unique string identifier given to disk)
2. Capacity (unsigned integer indicating the maximum capacity of the disk)
3. Populated size (optional unsigned integer indicating the current size of the disk; can be approximate; -1 if unspecified)
4. Format (string identifying the disk format, typically "http://www.vmware.com/specifications/vmdk.html#sparse")
5. Reference (where to find the disk image, typically a file name; if empty, then the disk should be created on import)
6. Image size (optional unsigned integer indicating the size of the image, which need not necessarily be the same as the values specified above, since the image may be compressed or sparse; -1 if not specified)
7. Chunk size (optional unsigned integer if the image is split into chunks; presently unsupported and always -1)
8. Compression (optional string equalling "gzip" if the image is gzip-compressed)

readonly attribute IVirtualSystemDescription [] IAppliance::virtualSystemDescriptions

Array of virtual system descriptions.

One such description is created for each virtual system found in the OVF. This array is empty until either interpret (for import) or IMachine::export (for export) has been called.