# Managed Object - VirtualMachineSnapshot(vim.vm.Snapshot)

Property of
  OvfCreateDescriptorParams, VirtualMachine, VirtualMachineCloneSpec, VirtualMachineFileLayoutExSnapshotLayout, VirtualMachineFileLayoutSnapshotLayout, VirtualMachineSnapshot, VirtualMachineSnapshotInfo, VirtualMachineSnapshotTree
Parameter to
  QueryChangedDiskAreas, StartReplaying_Task
Returned by
  CreateSnapshot_Task, CreateSnapshotEx_Task, StartRecording_Task
Extends
  ExtensibleManagedObject
See also
  HostSystem, HttpNfcLease, VirtualMachine, VirtualMachineConfigInfo,
Since
  2.0

## Managed Object Description

The Snapshot managed object type specifies the interface to individual snapshots of a virtual machine. Although these are managed objects, they are subordinate to their virtual machine.

Properties

Name | Type | Description
--- | --- | ---
childSnapshot* | ManagedObjectReference[] to a VirtualMachineSnapshot[] | All snapshots for which this snapshot is the parent. Since vSphere API 4.1
config | VirtualMachineConfigInfo | Information about the configuration of this virtual machine when this snapshot was taken. The datastore paths for the virtual machine disks point to the head of the disk chain that represents the disk at this given snapshot. The fileInfo.fileLayout field is not set.
vm | ManagedObjectReference to a VirtualMachine | The virtual machine for which the snapshot was taken. Since vSphere API 6.0
Properties inherited from ExtensibleManagedObject
availableField, value

*May not be present

Methods

Methods defined in this Managed Object
ExportSnapshot, RemoveSnapshot_Task, RenameSnapshot, RevertToSnapshot_Task
Methods inherited from ExtensibleManagedObject
setCustomValue

# ExportSnapshot(exportSnapshot)

Obtains an export lease on this snapshot. The export lease contains a list of URLs for the virtual disks for this snapshot, as well as a ticket giving access to the URLs.

See HttpNfcLease for information on how to use the lease.

Required Privileges
  VApp.Export
Since
  vSphere API 5.5

Parameters

Name | Type | Description
--- | --- | ---
_this | ManagedObjectReference | A reference to the VirtualMachineSnapshot used to make the method call.

Return Value

Type | Description
--- | ---
ManagedObjectReference to a HttpNfcLease | The export lease on this VirtualMachineSnapshot. The export task continues running until the lease is completed by the caller.

Faults

Type | Description
--- | ---
FileFault | Thrown if there is an error accessing the virtual machine files.
InvalidState | Thrown if the operation cannot be performed because of the virtual machine's current state. For example, if the virtual machine configuration information is not available.
RuntimeFault | Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgress | Thrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition
<element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="ExportSnapshot" type="vsan:ExportSnapshotRequestType"/> <element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="ExportSnapshotResponse"> <complexType> <sequence> <element name="returnval" type="vsan:ManagedObjectReference"/> </sequence> </complexType> </element>

# RemoveSnapshot_Task(remove)

Removes this snapshot and deletes any associated storage.

Required Privileges
  VirtualMachine.State.RemoveSnapshot

Parameters

Name | Type | Description
--- | --- | ---
_this | ManagedObjectReference | A reference to the VirtualMachineSnapshot used to make the method call.
removeChildren P | xsd:boolean | Flag to specify removal of the entire snapshot subtree. Since 2.0
consolidate* P | xsd:boolean | (optional) If set to true, the virtual disk associated with this snapshot will be merged with other disk if possible. Defaults to true. Since 2.0

*Need not be set PRequired privilege - see tooltip for details

Return Value

Type | Description
--- | ---
ManagedObjectReference to a Task | This method returns a Task object with which to monitor the operation.

Faults

Type | Description
--- | ---
RuntimeFault | Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgress | Thrown if the virtual machine is busy.

Events

Type
None

# RenameSnapshot(rename)

Rename this snapshot with either a new name or a new description or both. At least one of these must be specified when calling the rename method.

Required Privileges
  VirtualMachine.State.RenameSnapshot

Parameters

Name | Type | Description
--- | --- | ---
_this | ManagedObjectReference | A reference to the VirtualMachineSnapshot used to make the method call.
name* P | xsd:string | New name for the snapshot. Since 2.0
description* P | xsd:string | New description for the snapshot. Since 2.0

*Need not be set PRequired privilege - see tooltip for details

Return Value

Type | Description
--- | ---
None

Faults

Type | Description
--- | ---
InvalidName | Thrown if the specified snapshot name is not valid.
InvalidPowerState | Thrown if the operation cannot be performed in the current power state of the virtual machine.
InvalidState | Thrown if the operation cannot be performed in the current state of the virtual machine. For example, the virtual machine's configuration is not available.
RuntimeFault | Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgress | Thrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition
<element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="RenameSnapshot" type="vsan:RenameSnapshotRequestType"/> <element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="RenameSnapshotResponse"> <complexType/> </element>

# RevertToSnapshot_Task(revert)

Change the execution state of the virtual machine to the state of this snapshot.

Required Privileges
  VirtualMachine.State.RevertToSnapshot

Parameters

Name | Type | Description
--- | --- | ---
_this | ManagedObjectReference | A reference to the VirtualMachineSnapshot used to make the method call.
host* P | ManagedObjectReference to a HostSystem | (optional) Choice of host for the virtual machine, in case this operation causes the virtual machine to power on. If a snapshot was taken while a virtual machine was powered on, and this operation is invoked after the virtual machine was powered off, the operation causes the virtual machine to power on to reach the snapshot state. This parameter can be used to specify a choice of host where the virtual machine should power on. If this parameter is not set and the vBalance feature is configured for automatic load balancing, a host is automatically selected. Otherwise, the virtual machine keeps its existing host affiliation. Since 2.0
suppressPowerOn* P | xsd:boolean | (optional) If set to true, the virtual machine will not be powered on regardless of the power state when the snapshot was created. Default to false. Since 2.0

*Need not be set PRequired privilege - see tooltip for details

Return Value

Type | Description
--- | ---
ManagedObjectReference to a Task | This method returns a Task object with which to monitor the operation.

Faults

Type | Description
--- | ---
FileFault | Thrown if there is a problem accessing the virtual machine on the filesystem.
InsufficientResourcesFault | Thrown if this operation would violate a resource usage policy.
InvalidPowerState | Thrown if the operation cannot be performed in the current power state of the virtual machine.
InvalidState | Thrown if the operation cannot be performed in the current state of the virtual machine. For example, the virtual machine's configuration is not available.
RuntimeFault | Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgress | Thrown if the virtual machine is busy.
VmConfigFault | Thrown if a configuration issue prevents the power-on. Typically, a more specific fault, such as UnsupportedVmxLocation, is thrown.

Events

Type
None