Skip to main content

OvfManager

Struct OvfManager 

Source
pub struct OvfManager { /* private fields */ }
Expand description

Service interface to parse and generate OVF descriptors.

The purpose of this interface is to make it easier for callers to import VMs and vApps from OVF packages and to export VI packages to OVF. In the following description, the term “client” is used to mean any caller of the interface.

This interface only converts between OVF and VI types. To actually import and export entities, use ResourcePool.importVApp, VirtualMachine.exportVm and VirtualApp.exportVApp.

Import

For the import scenario, the typical sequence of events is as follows:

The client calls parseDescriptor to obtain information about the OVF descriptor. This typically includes information (such as a list of networks) that must be mapped to VI infrastructure entities.

The OVF descriptor is validated against the OVF Specification, and any errors or warnings are returned as part of the ParseResult. For example, the parser might encounter a section marked required that it does not understand, or the XML descriptor might be malformed.

The client decides on network mappings, datastore, properties etc. It then calls createImportSpec to obtain the parameters needed to call ResourcePool.importVApp.

If any warnings are present, the client will review these and decide whether to proceed or not. If errors are present, the ImportSpec will be missing, so the client is forced to give up or fix the problems and then try again.

The client now calls ResourcePool.importVApp, passing the ImportSpec as a parameter. This will create the virtual machines and VirtualApp objects in VI and return locations to which the files of the entity can be uploaded. It also returns a lease that controls the duration of the lock taken on the newly created inventory objects. When all files have been uploaded, the client must release this lease.

Export

Creating the OVF descriptor is the last part of exporting an entity to OVF. At this point, the client has already downloaded all files for the entity, optionally compressing and/or chunking them (however, the client may do a “dry run” of creating the descriptor before downloading the files. See OvfManager.createDescriptor).

In addition to the entity reference itself, information about the choices made on these files is passed to createDescriptor as a list of OvfFile instances.

The client must inspect and act upon warnings and errors as previously described.

No matter if the export succeeds or fails, the client is responsible for releasing the shared state lock taken on the entity (by VirtualMaching.exportVm or VirtualApp.exportVApp) during the export.

Error handling

All result types contain warning and error lists. Warnings do not cause processing to fail, but the caller (typically, the user of a GUI client) may choose to reject the result based on the warnings issued.

Errors cause processing to abort by definition.

Implementations§

Source§

impl OvfManager

Source

pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self

Source

pub async fn create_descriptor( &self, obj: &ManagedObjectReference, cdp: &OvfCreateDescriptorParams, ) -> Result<OvfCreateDescriptorResult>

Create an OVF descriptor for the specified ManagedEntity, which may be a VirtualMachine or a VirtualApp.

To create the complete OVF descriptor, the client must already have downloaded the files that are part of the entity, because information about these files (compression, chunking, filename etc.) is part of the descriptor.

However, these downloads can be quite time-consuming, so if the descriptor for some reason cannot be generated, the client will want to know this before downloading the files.

For this reason, the client may do an initial “dry run” with the ovfFiles parameter unset. Default filenames will then be used in the descriptor, and the client can examine any warnings and/or errors before downloading the files.

After the final call to this method, client must release the lock on the entity given to it by VirtualMachine.exportVm or VirtualApp.exportVApp.

Required privileges: System.View

§Parameters:
§obj

The entity to export. Supported types are VirtualMachine and VirtualApp.

Required privileges: VApp.Export

Refers instance of ManagedEntity.

§cdp

Parameters to the method, bundled in an instance of CreateDescriptorParams.

§Returns:

An instance of CreateDescriptorResult

§Errors:

TaskInProgress: if a required managed entity is busy.

VmConfigFault: if a configuration issue prevents the operation from succeeding. Typically, a more specific subclass is thrown.

ConcurrentAccess: if a concurrency issue prevents the operation from succeeding.

FileFault: if there is a generic file error

InvalidState: if the operation failed due to the current state of the system.

Source

pub async fn create_import_spec( &self, ovf_descriptor: &str, resource_pool: &ManagedObjectReference, datastore: &ManagedObjectReference, cisp: &dyn OvfCreateImportSpecParamsTrait, ) -> Result<OvfCreateImportSpecResult>

Validate the OVF descriptor against the hardware supported by the host system.

If the validation succeeds, return a result containing:

  • An ImportSpec to use when importing the entity.
  • A list of items to upload (for example disk backing files, ISO images etc.)

Required privileges: System.View

§Parameters:
§ovf_descriptor

The OVF descriptor of the entity.

§resource_pool

The resource pool to import the entity to. May be a vApp.

Required privileges: VApp.Import

Refers instance of ResourcePool.

§datastore

The datastore on which to create the inventory objects of the entity, for example “storage1”. The privilege Datastore.AllocateSpace is required on the datastore.

Required privileges: Datastore.AllocateSpace

Refers instance of Datastore.

§cisp

Additional parameters to the method, bundled in an instance of CreateImportSpecParams.

§Errors:

TaskInProgress: if a required managed entity is busy.

VmConfigFault: if a configuration issue prevents the operation from succeeding. Typically, a more specific subclass is thrown.

ConcurrentAccess: if a concurrency issue prevents the operation from succeeding.

FileFault: if there is a generic file error

InvalidState: if the operation failed due to the current state of the system.

Source

pub async fn parse_descriptor( &self, ovf_descriptor: &str, pdp: &OvfParseDescriptorParams, ) -> Result<OvfParseDescriptorResult>

Parse the OVF descriptor and return as much information about it as possible without knowing the host on which it will be imported.

Typically, this method is called once without a deploymentOption parameter to obtain the values for the default deployment option. Part of the result is the list of possible deployment options. To obtain the values for a particular deployment option, call this method again, specifying that option.

Required privileges: System.View

§Parameters:
§ovf_descriptor

The OVF descriptor to examine.

§pdp

Additional parameters for parseDescriptor, wrapped in an instance of ParseDescriptorParams.

§Returns:

The information about the descriptor

§Errors:

TaskInProgress: if a required managed entity is busy.

VmConfigFault: if a configuration issue prevents the operation from succeeding. Typically, a more specific subclass is thrown.

ConcurrentAccess: if a concurrency issue prevents the operation from succeeding.

FileFault: if there is a generic file error

InvalidState: if the operation failed due to the current state of the system.

Source

pub async fn validate_host( &self, ovf_descriptor: &str, host: &ManagedObjectReference, vhp: &OvfValidateHostParams, ) -> Result<OvfValidateHostResult>

Validate that the given OVF can be imported on the host.

More specifically, this means whether or not the host supports the virtual hardware required by the OVF descriptor.

Required privileges: System.View

§Parameters:
§ovf_descriptor

The OVF descriptor to examine.

§host

The host to validate against.

Refers instance of HostSystem.

§vhp

Additional parameters for validateHost, wrapped in a ValidateHostParams instance.

§Returns:

A ValidateResult instance containing any warnings and/or errors from the validation.

§Errors:

TaskInProgress: if a required managed entity is busy.

ConcurrentAccess: if a concurrency issue prevents the operation from succeeding.

FileFault: if there is a generic file error

InvalidState: if the operation failed due to the current state of the system.

Source

pub async fn ovf_export_option(&self) -> Result<Option<Vec<OvfOptionInfo>>>

Returns an array of OvfOptionInfo object that specifies what options the server support for exporting an OVF descriptor.

Required privileges: System.View

§Returns:

An instance of OvfOptionInfo

Source

pub async fn ovf_import_option(&self) -> Result<Option<Vec<OvfOptionInfo>>>

Returns an array of OvfOptionInfo object that specifies what options the server support for modifing/relaxing the OVF import process.

Required privileges: System.View

§Returns:

An instance of OvfOptionInfo

Trait Implementations§

Source§

impl Clone for OvfManager

Source§

fn clone(&self) -> OvfManager

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any_ref<'a>(&'a self) -> &'a (dyn Any + 'static)

Cast a reference to Any trait.

Source§

fn as_any_box(self: Box<T>) -> Box<dyn Any>

Cast to a boxed reference to Any trait.

Source§

fn type_id(&self) -> TypeId

Get the underlying type identifier.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<To, T> CastInto<To> for T
where To: CastFrom<T> + ?Sized, T: 'static + ?Sized,

Source§

fn into_ref<'a>(&'a self) -> Option<&'a To>

Casts a reference to a trait object. If the cast fails, std::option::Option::None is returned.
Source§

fn into_box(self: Box<T>) -> Result<Box<To>, Box<dyn Any>>

Casts a boxed trait object to another trait object. If the cast fails, the original boxed trait object is returned in std::result::Result::Err.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,