com.vmware.snapservice package

Subpackages

Submodules

com.vmware.snapservice.clusters_client module

The com.vmware.snapservice.clusters_client module provides classes for managing protection groups and snapshots in a vSAN cluster.

class com.vmware.snapservice.clusters_client.ProtectionGroups(config)

Bases: VapiInterface

The ProtectionGroups class provides methods for managing protection groups created for a cluster.

Parameters:

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class DeleteSpec(force=None)

Bases: VapiStruct

The ProtectionGroups.DeleteSpec class contains attributes used to specify the parameters for deleting a protection group See ProtectionGroups.delete().

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:

force (bool or None) – Indicates if force delete to be performed. If set to True protection group and all associated snapshots will be deleted immediately If None, All the snapshots associated with the protection group will be retained till expiry.

class FilterSpec(pgs=None, names=None, states=None, vms=None)

Bases: VapiStruct

The ProtectionGroups.FilterSpec class contains attributes used to filter the results when listing protection groups for a cluster If multiple attributes are specified, only protection groups matching all of the attributes match the filter. See ProtectionGroups.list().

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • pgs (set of str or None) – Identifiers of protection groups that can match the filter. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: com.vmware.snapservice.protection_group. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: com.vmware.snapservice.protection_group. If None or empty, protection groups with any identifier match the filter.

  • names (set of str or None) – Names of protection groups that can match the filter. If None or empty, protection groups with any name match the filter.

  • states (set of com.vmware.snapservice_client.ProtectionGroupStatus or None) – States of protection groups that can match the filter. If None or empty, protection groups with any state match the filter.

  • vms (set of str or None) – Identifiers of the virtual machines which belong to the protection groups that can match the filter. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: com.vmware.snapservice.protection_group. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: com.vmware.snapservice.protection_group. If None or empty, protection groups with any virtual machines match the filter.

class ListItem(pg=None, info=None)

Bases: VapiStruct

The ProtectionGroups.ListItem class contains information about a protection group returned by ProtectionGroups.list() method

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • pg (str) – Identifier of the protection group. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.protection_group. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.protection_group.

  • info (com.vmware.snapservice_client.ProtectionGroupInfo) – Information regarding the protection group.

class ListResult(items=None)

Bases: VapiStruct

The ProtectionGroups.ListResult class represents the result of ProtectionGroups.list() method.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:

items (list of ProtectionGroups.ListItem) – List of items

create_task(cluster, spec)

Create a protection group for the given cluster.

Parameters:
Return type:

class:

vmware.vapi.stdlib.client.task.Task

Returns:

Task instance

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState If there is another operation in progress.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster in the system.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument If validation of the spec fails.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

delete_task(cluster, pg, spec=None)

Delete the specified protection group. Default bahaviour:

Parameters:
  • cluster (str) – Identifier of the cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • pg (str) – Identifier of the protection group. The parameter must be an identifier for the resource type: com.vmware.snapservice.protection_group.

  • spec (ProtectionGroups.DeleteSpec or None) – Specifies the additional parameters for the delete operation. If None, protection group status is set to marked as deleted and will be be deleted permanently once all its associated snapshots are deleted.

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState If there is another operation in progress.

Raise:

com.vmware.vapi.std.errors_client.NotFound If no cluster associated with cluster or protection group associated with pg is found in the system.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument If validation of the spec fails.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

Raise:

com.vmware.vapi.std.errors_client.Unsupported If the specified protection group is locked.

get(cluster, pg)

Get the detailed information regarding the specified protection group.

Parameters:
  • cluster (str) – Identifier of the cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • pg (str) – Identifier of the protection group. The parameter must be an identifier for the resource type: com.vmware.snapservice.protection_group.

Return type:

com.vmware.snapservice_client.ProtectionGroupInfo

Returns:

Information about the specified protection group.

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotFound If no cluster associated with cluster or protection group associated with pg is found in the system.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument If any input is invalid.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

list(cluster, filter=None)

List the protection groups for the given cluster.

Parameters:
  • cluster (str) – Identifier of the cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • filter (ProtectionGroups.FilterSpec or None) – Specification of matching protection groups for which information should be returned. If None, the behavior is equivalent to a ProtectionGroups.FilterSpec with all attributes None which means all protection groups match the filter.

Return type:

ProtectionGroups.ListResult

Returns:

Information about the protection groups matching the ProtectionGroups.FilterSpec for the given cluster.

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster in the system.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument If validation of the filter fails.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

pause_task(cluster, pg)

Pause the specified proteciton group. This action pauses all periodic snapshot operations and deletion of expired snapshots. Any ongoing snapshot creation or deletion operations will not be paused.

Parameters:
  • cluster (str) – Identifier of the cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • pg (str) – Identifier of the protection group The parameter must be an identifier for the resource type: com.vmware.snapservice.protection_group.

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.AlreadyInDesiredState If the protection group is already paused.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState If there is another operation in progress.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster or protection group associated with pg in the system.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

Raise:

com.vmware.vapi.std.errors_client.Unsupported If the specified protection group is locked.

resume_task(cluster, pg)

Resume the specified proteciton group. This action resumes all periodic snapshot operations and deletion of expired snapshots.

Parameters:
  • cluster (str) – Identifier of the cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • pg (str) – Identifier of the protection group The parameter must be an identifier for the resource type: com.vmware.snapservice.protection_group.

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.AlreadyInDesiredState If the protection group is already active.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState If there is another operation in progress.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster or protection group associated with pg in the system.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

Raise:

com.vmware.vapi.std.errors_client.Unsupported If the specified protection group is locked.

update_task(cluster, pg, spec)

Update a protection group for the given cluster.

Parameters:
  • cluster (str) – Identifier of the cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • pg (str) – Identifier of the protection group The parameter must be an identifier for the resource type: com.vmware.snapservice.protection_group.

  • spec (com.vmware.snapservice_client.ProtectionGroupUpdateSpec) – specification for updting the protection group.

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState If there is another operation in progress.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster or protection group associated with pg in the system.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument If validation of the spec fails.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

Raise:

com.vmware.vapi.std.errors_client.Unsupported If the specified protection group is locked.

class com.vmware.snapservice.clusters_client.StubFactory(stub_config)

Bases: StubFactoryBase

Initialize StubFactoryBase

Parameters:

stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance

class com.vmware.snapservice.clusters_client.VirtualMachines(config)

Bases: VapiInterface

The VirtualMachines class provides methods to manage virtual machines.

Parameters:

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class FilterSpec(vms=None, name_patterns=None, local_protection_enabled=None)

Bases: VapiStruct

The VirtualMachines.FilterSpec class contains attributes used to filter the results when listing virtual machines for a cluster If multiple attributes are specified, only virtual machines matching all of the attributes match the filter. See VirtualMachines.list().

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • vms (set of str or None) – Identifiers of virtual machines that can match the filter. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: VirtualMachine. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: VirtualMachine. If None or empty, virtual machines with any identifier match the filter.

  • name_patterns (list of str or None) – One or more match patterns for virtual machine name that can match the filter. Uses standard POSIX Shell globbing pattern. If None or empty virtual machines with any name match the filter.

  • local_protection_enabled (bool or None) – Status of the local protection that must match the filter. If None or empty, virtual machines with any local protection status can match the filter.

class Info(name=None, local_protection_enabled=None, protection_groups=None, last_snapshot_time=None, oldest_snapshot_time=None, snapshot_count=None, in_cluster=None)

Bases: VapiStruct

The VirtualMachines.Info class contains attributes that provide information regarding a virtual machine.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • name (str) – Name of the virtual machine.

  • local_protection_enabled (bool) – Whether or not local protection is enabled. Local protection is considered to be enabled when the virtual machine belongs to at least one active protection group.

  • protection_groups (set of str) – List of protection groups that this virtual machine belongs to. Empty list when the virtual machine is not part of any protection group. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: com.vmware.snapservice.protection_group. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: com.vmware.snapservice.protection_group.

  • last_snapshot_time (datetime.datetime or None) – Time of the last snapshot for the virtual machine. None if there are no snapshots taken for the virtual machine.

  • oldest_snapshot_time (datetime.datetime or None) – Time of the oldest snapshot for the virtual machine. None if there are no snapshots taken for the virtual machine.

  • snapshot_count (long) – Number of snapshots available for the virtual machine.

  • in_cluster (bool) – Indicates whether or not the virtual mahcine is currently part of the cluster. This can be set to false when there is atleast one snapshot for the virtual machine on the target cluster, but the virtual machine is not part of the cluster.

class LinkedClonePlacementSpec(folder=None, resource_pool=None, host=None)

Bases: VapiStruct

The VirtualMachines.LinkedClonePlacementSpec class contains attributes used to place cloned virtual machine on to resources within the vcenter inventory.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • folder (str or None) – Virtual machine folder into which the cloned virtual machine should be placed. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: Folder. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: Folder. If attribute is None, the system will use the default virtual machine folder of the datacenter. If this results in a conflict due to other placement parameters, the virtual machine clone operation will fail.

  • resource_pool (str or None) – Resource pool into which the cloned virtual machine should be placed. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ResourcePool. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ResourcePool. If attribute is None, the system will use the other placement parameters to create virtual machine. If this results in a conflict due to other placement parameters, the virtual machine clone operation will fail.

  • host (str or None) –

    Host onto which the cloned virtual machine should be placed.

    If host and resourcePool are both specified, resourcePool must belong to host.

    If host is specified, host must be a member of cluster. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: HostSystem. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: HostSystem. If this attribute is unset, if resourcePool is set, and the target is a DRS cluster, a host will be picked by DRS. if resourcePool is unset, and the target is a DRS cluster, a host will be picked by DRS. if resourcePool is set, and the target is a cluster without DRS, InvalidArgument will be thrown.

class LinkedCloneSpec(snapshot=None, name=None, placement=None)

Bases: VapiStruct

The VirtualMachines.LinkedCloneSpec class contains attributes to create linked clone virtual machine from the given snapshot.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • snapshot (str) – Identifier of the virtual machine snapshot using which the virtual machine shall be cloned. snapshot must be a snapshot of a virtual machine on the same cluster where virtual machine being cloned. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.vm.snapshot. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.vm.snapshot.

  • name (str) – Name of the cloned virtual machine.

  • placement (VirtualMachines.LinkedClonePlacementSpec or None) –

    Virtual machine placement information.

    Each field in the spec will be used for placement. If the fields result in disjoint placement the operation will fail. If None, and the cluster is DRS enabled the system will create the virtual machine under the default vitual machine folder. If the DRS is not enabled on the cluster the operation will fail.

class ListItem(vm=None, info=None)

Bases: VapiStruct

The VirtualMachines.ListItem class contains information about a virtual machine returned by VirtualMachines.list() method

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • vm (str) – Identifier of the virtual machine. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: VirtualMachine. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: VirtualMachine.

  • info (VirtualMachines.Info) – Information regarding the virtual machine.

class ListResult(items=None)

Bases: VapiStruct

The VirtualMachines.ListResult class represents the result of VirtualMachines.list() method.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:

items (list of VirtualMachines.ListItem) – List of items

class RestorePlacementSpec(folder=None, resource_pool=None, host=None)

Bases: VapiStruct

The VirtualMachines.RestorePlacementSpec class contains attributes used to place restored virtual machine on to resources within the vcenter inventory.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • folder (str or None) – Virtual machine folder into which the restored virtual machine should be placed. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: Folder. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: Folder. If attribute is None, the system will use the default virtual machine folder of the datacenter. If this results in a conflict due to other placement parameters, the virtual machine restore operation will fail.

  • resource_pool (str or None) – Resource pool into which the restored virtual machine should be placed. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ResourcePool. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ResourcePool. If attribute is None, the system will use the other placement parameters to create virtual machine. If this results in a conflict due to other placement parameters, the virtual machine restore operation will fail.

  • host (str or None) –

    Host onto which the restored virtual machine should be placed.

    If host and resourcePool are both specified, resourcePool must belong to host.

    If host is specified, host must be a member of cluster. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: HostSystem. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: HostSystem. If this attribute is unset, if resourcePool is set, and the target is a DRS cluster, a host will be picked by DRS. if resourcePool is unset, and the target is a DRS cluster, a host will be picked by DRS. if resourcePool is set, and the target is a cluster without DRS, InvalidArgument will be thrown.

class RestoreSpec(snapshot=None, name=None, placement=None)

Bases: VapiStruct

The VirtualMachines.RestoreSpec class contains attributes to restore deleted virtual machine to a given snapshot point.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • snapshot (str) – Identifier of the virtual machine snapshot using which the virtual machine shall be restored. snapshot must be a snapshot of a virtual machine on the same cluster where virtual machine being restored. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.vm.snapshot. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.vm.snapshot.

  • name (str or None) – New name for the virtual machine being restored. If None, will use the name of the virtual machine when the snapshot was taken.

  • placement (VirtualMachines.RestorePlacementSpec or None) –

    Virtual machine placement information.

    Each field in the spec will be used for placement. If the fields result in disjoint placement the operation will fail. If None, and the cluster is DRS enabled the system will create the virtual machine under the default vitual machine folder. If the DRS is not enabled on the cluster the operation will fail.

class RevertSpec(snapshot=None)

Bases: VapiStruct

The VirtualMachines.RevertSpec class contains attributes to revert the virtual machine to a given snapshot point.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:

snapshot (str) – Identifier of the virtual machine snapshot to which the virtual machine shall be reverted. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.vm.snapshot. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.vm.snapshot.

get(cluster, vm)

Get the detailed information regarding the specified virtual machine and it’s snapshots in the given cluster.

Parameters:
  • cluster (str) – Identifier of the cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • vm (str) – Identifier of the virtual machine. The parameter must be an identifier for the resource type: VirtualMachine.

Return type:

VirtualMachines.Info

Returns:

Info detailed information for the specified virtual machine.

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster or no virtual machine associated with vm in the system.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

linked_clone_task(cluster, vm, spec)

Creates a linked clone virtual machine from the given snapshot. The virtual machine will be left in a powered off state after the clone operation.

Parameters:
  • cluster (str) – Identifier of the Cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • vm (str) – Identifier of the virtual machine. The parameter must be an identifier for the resource type: VirtualMachine.

  • spec (VirtualMachines.LinkedCloneSpec) – specification for the clone operation.

Return type:

class:

vmware.vapi.stdlib.client.task.Task

Returns:

Task instance

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster or no virtual machine associated with vm is found in the system.

Raise:

com.vmware.vapi.std.errors_client.AlreadyExists If a virtual machine with the specified name already exists.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument If validation of the spec fails.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState If there are more than max allowed clone operations in-progress.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

list(cluster, filter=None)

List the virtual machines for the given cluster.

Parameters:
  • cluster (str) – Identifier of the cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • filter (VirtualMachines.FilterSpec or None) – Specification of matching virtual machines for which information should be returned. If None, the behavior is equivalent to a VirtualMachines.FilterSpec with all attributes None which means all virtual machines match the filter.

Return type:

VirtualMachines.ListResult

Returns:

Information about the virtual machines matching the VirtualMachines.FilterSpec for the given cluster.

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster in the system.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument If validation of the filter fails.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

restore_task(cluster, vm, spec)

Restore deleted virtual machine to a given snapshot point. The virtual machine will be left in a powered off state after the restore operation.

Parameters:
  • cluster (str) – Identifier of the Cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • vm (str) – Identifier of the virtual machine. The parameter must be an identifier for the resource type: VirtualMachine.

  • spec (VirtualMachines.RestoreSpec) – specification for the restore operation.

Return type:

class:

vmware.vapi.stdlib.client.task.Task

Returns:

Task instance

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster or no virtual machine associated with vm is found in the system.

Raise:

com.vmware.vapi.std.errors_client.AlreadyExists If a virtual machine with the specified name already exists.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument If validation of the spec fails.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState If there are more than max allowed restore operations in-progress.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

revert_task(cluster, vm, spec)

Revert the virtual machine to a given snapshot point. The system takes an additional snapshot to preserve the state prior to performing a revert. The system snapshot does not preserve the in-memory state of the virtual machine. The virtual machine will be left in a powered off state after the revert operation.

Parameters:
  • cluster (str) – Identifier of the Cluster. The parameter must be an identifier for the resource type: ClusterComputeResource.

  • vm (str) – Identifier of the virtual machine. The parameter must be an identifier for the resource type: VirtualMachine.

  • spec (VirtualMachines.RevertSpec) – specification for the revert operation.

Raise:

com.vmware.vapi.std.errors_client.Error If there is unknown internal error.

Raise:

com.vmware.vapi.std.errors_client.NotFound If there is no cluster associated with cluster or no virtual machine associated with vm is found in the system.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument If validation of the spec fails.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState If the virtual machine has moved to another cluster or if there are more than max allowed revert operations in-progress.

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable If the service is not available.

Raise:

com.vmware.vapi.std.errors_client.Unauthenticated If the caller is not authenticated.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized If the caller is not authorized to perform the operation.

com.vmware.snapservice.info_client module

The com.vmware.snapservice.info_client module provides classes to fetch general information regarding Snapshot Service.

class com.vmware.snapservice.info_client.About(config)

Bases: VapiInterface

The About class provides methods that fetch details about Snapshot service.

Parameters:

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class Info(version=None)

Bases: VapiStruct

The About.Info class contains information about the snapshot service.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:

version (str) – Snapshot service version

get()

Get information about Snapshot service.

Return type:

About.Info

Returns:

Information about the snapshot service.

class com.vmware.snapservice.info_client.StubFactory(stub_config)

Bases: StubFactoryBase

Initialize StubFactoryBase

Parameters:

stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance

com.vmware.snapservice.tasks_client module

The com.vmware.snapservice.tasks_client module provides classes to fetch general information regarding vSAN snapshot service tasks.

class com.vmware.snapservice.tasks_client.CommonInfo(description=None, service=None, operation=None, parent=None, target=None, status=None, cancelable=None, error=None, start_time=None, end_time=None, user=None)

Bases: VapiStruct

The CommonInfo class contains information common to all tasks.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • description (com.vmware.vapi.std_client.LocalizableMessage) – Description of the operation associated with the task.

  • service (str) – Identifier of the service containing the operation. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.service. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.service.

  • operation (str) – Identifier of the operation associated with the task. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.operation. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.operation.

  • parent (str or None) – Parent of the current task. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.task. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.task. This attribute will be None if the task has no parent.

  • target (com.vmware.vapi.std_client.DynamicID or None) – Identifier of the target created by the operation or an existing one the operation performed on. This attribute will be None if the operation has no target or multiple targets.

  • status (Status) – Status of the operation associated with the task.

  • cancelable (bool) – Flag to indicate whether or not the operation can be cancelled. The value may change as the operation progresses.

  • error (Exception or None) – Description of the error if the operation status is “FAILED”. If None the description of why the operation failed will be included in the result of the operation (see Info.result).

  • start_time (datetime.datetime) – Time when the operation is started. This attribute is optional and it is only relevant when the value of status is one of Status.RUNNING, Status.BLOCKED, Status.SUCCEEDED, or Status.FAILED.

  • end_time (datetime.datetime) – Time when the operation is completed. This attribute is optional and it is only relevant when the value of status is one of Status.SUCCEEDED or Status.FAILED.

  • user (str or None) – Name of the user who performed the operation. This attribute will be None if the operation is performed by the system.

class com.vmware.snapservice.tasks_client.Info(progress=None, result=None, vc_task=None, description=None, service=None, operation=None, parent=None, target=None, status=None, cancelable=None, error=None, start_time=None, end_time=None, user=None)

Bases: VapiStruct

The Info class contains information about a task.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • progress (Progress) – Progress of the operation. This attribute is optional and it is only relevant when the value of status is one of Status.RUNNING, Status.BLOCKED, Status.SUCCEEDED, or Status.FAILED.

  • result (DataValue or None) – Result of the operation. This attribute will be None if the operation does not return a result or if the result is not available at the current step of the operation.

  • vc_task (str or None) – Associated vCenter task for the given task. This attribute will be None if there is no corresponding VC task created.

  • description (com.vmware.vapi.std_client.LocalizableMessage) – Description of the operation associated with the task.

  • service (str) – Identifier of the service containing the operation. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.service. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.service.

  • operation (str) – Identifier of the operation associated with the task. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.operation. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.operation.

  • parent (str or None) – Parent of the current task. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.snapservice.task. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.snapservice.task. This attribute will be None if the task has no parent.

  • target (com.vmware.vapi.std_client.DynamicID or None) – Identifier of the target created by the operation or an existing one the operation performed on. This attribute will be None if the operation has no target or multiple targets.

  • status (Status) – Status of the operation associated with the task.

  • cancelable (bool) – Flag to indicate whether or not the operation can be cancelled. The value may change as the operation progresses.

  • error (Exception or None) – Description of the error if the operation status is “FAILED”. If None the description of why the operation failed will be included in the result of the operation (see Info.result).

  • start_time (datetime.datetime) – Time when the operation is started. This attribute is optional and it is only relevant when the value of status is one of Status.RUNNING, Status.BLOCKED, Status.SUCCEEDED, or Status.FAILED.

  • end_time (datetime.datetime) – Time when the operation is completed. This attribute is optional and it is only relevant when the value of status is one of Status.SUCCEEDED or Status.FAILED.

  • user (str or None) – Name of the user who performed the operation. This attribute will be None if the operation is performed by the system.

class com.vmware.snapservice.tasks_client.Progress(total=None, completed=None, message=None)

Bases: VapiStruct

The Progress class contains information describe the progress of an operation.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters:
  • total (long) – Total amount of the work for the operation.

  • completed (long) – The amount of work completed for the operation. The value can only be incremented.

  • message (com.vmware.vapi.std_client.LocalizableMessage) – Message about the work progress.

class com.vmware.snapservice.tasks_client.Status(string)

Bases: Enum

The Status class defines the status values that can be reported for an operation.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters:

string (str) – String value for the Status instance.

BLOCKED = Status(string='BLOCKED')

The operation is blocked.

The operation could be blocked if the system is waiting for resources to be available to perform the operation.

FAILED = Status(string='FAILED')

The operation failed.

PENDING = Status(string='PENDING')

The operation is in pending state.

RUNNING = Status(string='RUNNING')

The operation is in progress.

SUCCEEDED = Status(string='SUCCEEDED')

The operation completed successfully.

class com.vmware.snapservice.tasks_client.StubFactory(stub_config)

Bases: StubFactoryBase

Initialize StubFactoryBase

Parameters:

stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance