Skip to main content

VsanObjectSystem

Struct VsanObjectSystem 

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

This managed object type provides the service interface for setting the storage policy to one vSAN object, querying the vSAN object status information, i.e., its storage profile, its health status.
When the ManagedEntity is accessed with MOID of ‘vsan-cluster-object-system’ through vSAN service at vCenter server and ESXi host side, it acts as cluster-level APIs.

When it accessed with MOID of ‘vsan-object-system’ through vSAN service at ESXi host side, its scope is only limited to that host.

Implementations§

Source§

impl VsanObjectSystem

Source

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

Source

pub async fn vsan_delete_objects_task( &self, cluster: Option<&ManagedObjectReference>, obj_uuids: &[String], force: Option<bool>, ) -> Result<ManagedObjectReference>

Delete vSAN Objects on vSAN cluster.

When the ‘cluster’ parameter is specified, this is a cluster level asynchronous API. The delete operation will return a task result which tracks progress, please check the task state when use. When it’s called against host, it’s a host level asynchronous API, which deprecates the ‘DeleteVsanObjects’ in HostVsanInternalSystem. WARNING: This API can be slow because we do IOs to all the objects. This API can be used to delete vSAN objects. vSAN won’t allow access to objects which have lost quorum. Such objects can be deleted with the optional “force” flag.

§Parameters:
§cluster

vSAN cluster. Ignored if called against host.

Required privileges: Host.Config.Storage

Refers instance of ComputeResource.

§obj_uuids

The vSAN object UUIDs to delete.

§force

The force flag, inaccessible objects can’t be deleted without this flag. WARNING: it’s at your own risk.

§Returns:

Refers instance of Task.

§Errors:

Failure

Source

pub async fn vsan_query_inaccessible_vm_swap_objects( &self, cluster: Option<&ManagedObjectReference>, ) -> Result<Option<Vec<String>>>

Query all inaccessible vmswap objects on a vSAN cluster.

It works on both cluster level and host level.

§Parameters:
§cluster

vSAN cluster. Ignored if called against host.

Required privileges: System.Read

Refers instance of ComputeResource.

§Returns:

list of inaccessible vmswap objects.

§Errors:

Failure

Source

pub async fn vsan_query_object_identities( &self, cluster: Option<&ManagedObjectReference>, obj_uuids: Option<&[String]>, obj_types: Option<&[String]>, include_health: Option<bool>, include_obj_identity: Option<bool>, include_space_summary: Option<bool>, extra_query_spec: Option<&VsanObjIdentityQuerySpec>, ) -> Result<Option<VsanObjectIdentityAndHealth>>

Map from vSAN object UUIDs to their identities.

The results contain the identities of all objects that could be resolved. The identity includes things like the object type, references to the VM the object belongs to and such. If called against a host with MOID ‘vsan-object-system’, the cluster argument is ignored and, only those objects are resolved which can be resolved by that host. For VM related objects a host can only resolve the objects if the VM they belong to is registered on that host. If called against a host with MOID ‘vsan-cluster-object-system’, the cluster argument is ignored and cluster wide object identities would be returned except template VM, and in identities, the VM property would be left unset. If called against vCenter, all connected hosts will be contacted for this information and the results will be aggregated. Any VMs registered with hosts which are disconnected will hence not be resolved. It’s not recommended to use this API to get all of vSAN object identities at once to avoid potential performance issue due to large response in large scale cluster. Instead, we should limit the output by specifying various filter parameters like the objects UUID, object type, only including health or identity result etc.

§Parameters:
§cluster

vSAN cluster. Ignored if called against host.

Required privileges: System.Read

Refers instance of ComputeResource.

§obj_uuids

The vSAN object UUIDs for querying. Unset to query all of vSAN objects

§obj_types

Querying the vSAN objects with given types, only the object whose type in this list will be returned. All of available object types include ‘vmswap’, ‘vdisk’, ‘namespace’, ‘vmem’, ‘stats’, ‘other’, ‘iscsiHome’, ‘iscsiLun’, ‘iscsiTarget’ and ‘fileShare’. Unset to query all of vSAN objects with any type

§include_health

If the result includes the object health status. Default is False

§include_obj_identity

If the result includes all of the object identity. Default is True if it’s unset

§include_space_summary

If the result includes the vSAN space consumption summarizing by object type. Currently, it’s not supported to include both of space summary and object identity in the result. Default is false.

§extra_query_spec

This parameter only takes effect for host level API. The vSAN object identity query spec to specify detailed query specification like remote vSAN or VMFS datastores. If no extraQquerySpec is specified, the original logic to return all identities of local vSAN datastores will be applied. Note for any nonlocal vsan datastores provided, all the specified filter like objUuids, objTypes, include* won’t take affect.

§Returns:

Object information structure

§Errors:

Failure

Source

pub async fn query_syncing_vsan_objects_summary( &self, cluster: &ManagedObjectReference, syncing_object_filter: Option<&VsanSyncingObjectFilter>, ) -> Result<VsanHostVsanObjectSyncQueryResult>

Query summary information about the syncing objects in this cluster.

It will retrieve information about syncing objects based on object filter options.

§Parameters:
§cluster

vSAN cluster.

Required privileges: System.Read

Refers instance of ComputeResource.

§syncing_object_filter

Filter spec for summary.

§Returns:

result VsanSyncingObjectQueryResult.

§Errors:

Failure

Source

pub async fn vos_query_vsan_object_information( &self, cluster: Option<&ManagedObjectReference>, vsan_object_query_specs: &[VsanObjectQuerySpec], ) -> Result<Option<Vec<VsanObjectInformation>>>

Get information about the vSAN object/directory.

If it’s called in VC, the spbmProfileGenerationId can be safely ignored in vim.cluster.VsanObjectQuerySpec, it will be automatically set to the correct value by using SPBM service. If it’s called in host with MOID ‘vsan-object-system’, both fields in VsanObjectQuerySpec should be provided, if spbmProfileGenerationId is not provided, the one from vSAN CMMDS will be used here, as a result, the mismatch field for storage compliance result is not reliable in some cases, e.g. profile is updated or deleted in vCenter after the vSAN object creation. If it’s called in host with MOID ‘vsan-cluster-object-system’, the spbmProfileGenerationId in VsanObjectQuerySpec would be ignored and mismatch field is not reliable. Note this API can query maximum 500 vSAN objects at once when it’s called from ESXi host for performance consideration, otherwise, the InvalidArgument exception will be thrown.

If the vSAN object can not be found, FileNotFound exception will be raised. If the vSAN object failed to read the policy, e.g. because it is not accessible, FileNotReadable exception will be raised.

§Parameters:
§cluster

vSAN cluster. Ignored if called against host.

Required privileges: System.Read

Refers instance of ComputeResource.

§vsan_object_query_specs

vSAN object query spec list.

§Returns:

Object information list.

§Errors:

Failure

Source

pub async fn relayout_objects( &self, cluster: &ManagedObjectReference, ) -> Result<ManagedObjectReference>

The re-layout task for the objects which need change in object format.

This may involve physical on-disk re-layout of objects which will cause data movement in the cluster. Objects in the old format might not be able to use some of the new features.

§Parameters:
§cluster

Required privileges: Host.Config.Storage

Refers instance of ComputeResource.

§Returns:

The task object which represents the vSan RelayoutObjects task.

Refers instance of Task.

§Errors:

NotSupported: if run directly on an ESX Server host.

Source

pub async fn vos_set_vsan_object_policy( &self, cluster: Option<&ManagedObjectReference>, vsan_object_uuid: &str, profile: Option<&dyn VirtualMachineProfileSpecTrait>, ) -> Result<bool>

Set the policy of the vSAN object.

The cluster parameters is ignored if called on ESX.
Profile can be 3 formats:
1. VirtualMachineEmptyProfileSpec means to use the empty vSAN policy. This is not the default policy, but a policy where all fields have default values.
2. VirtualMachineDefinedProfileSpec where profileId is set, in which case this profileId will be looked up in SPBM for the detailed policy information.
3. VirtualMachineDefinedProfileSpec where profileId is an empty string and instead the profileData is set for extensionKey ‘com.vmware.vim.sps’. In this case the objectData field can be either the vSAN expression format, or a SPBM XML string. If no profile is supplied, and the call is executed against vCenter, then SPBM will be consulted for the vSAN datastore’s default profile.
When this method returns successfully, the profile has been applied, but vSAN may still be remediating in order to implement the new policy. The health state of the object and resync information should be monitored to check on the progress.
Only the third option for profile is available when called on ESXi, other formats will raise InvalidArgument exception. If SPBM needs to be contacted, but SPBM is not available, RuntimeFault exception will be raised. If the profileId can not be resolved with SPBM, InvalidArgument exception will be raised. If objectData was provided but is neither of the two supported formats, InvalidArgument exception will be raised. If the vSAN object can not be found, FileNotFound exception will be raised. If the vSAN object failed to set the policy, e.g. because it is not accessible, FileNotWritable exception will be raised. If called against vCenter, but no ESXi host could be contacted to perform the operation, the exception is logged and the False is returned by this method. NOTE: This API requires additional Global.Settings privilege if called against vSphere 65P02 release.

§Parameters:
§cluster

vSAN cluster. Ignored if called against host.

Required privileges: Global.Settings

Refers instance of ComputeResource.

§vsan_object_uuid

vSAN object UUID.

§profile

See above description for all possible options.

§Returns:

True when the operation successfully, False when it is failed and there is no exception raised.

§Errors:

Failure

Trait Implementations§

Source§

impl Clone for VsanObjectSystem

Source§

fn clone(&self) -> VsanObjectSystem

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,