2.2.2.19.1.1 VDS_VDISK_STATE

The VDS_VDISK_STATE enumeration describes the state of a virtual disk.

 typedef enum _VDS_VDISK_STATE
 {
   VDS_VST_UNKNOWN = 0,
   VDS_VST_ADDED,
   VDS_VST_OPEN,
   VDS_VST_ATTACH_PENDING,
   VDS_VST_ATTACHED_NOT_OPEN,
   VDS_VST_ATTACHED,
   VDS_VST_DETACH_PENDING,
   VDS_VST_COMPACTING,
   VDS_VST_MERGING,
   VDS_VST_EXPANDING,
   VDS_VST_DELETED,
   VDS_VST_MAX
 } VDS_VDISK_STATE;

VDS_VST_UNKNOWN:  VDS was not able to identify the disk's current status.

VDS_VST_ADDED:  The virtual disk is added to the service's list of objects.

VDS_VST_OPEN:  The virtual disk has been added to the service's list of objects, and the virtual disk file has been opened using IVdsVDisk::Open.

VDS_VST_ATTACH_PENDING:  The virtual disk has been added to the service's list of objects, the virtual disk file has been opened using IVdsVDisk::Open, and the virtual disk is in the process of being attached.

VDS_VST_ATTACHED_NOT_OPEN:  The virtual disk has been added to the service's list of objects and the virtual disk is attached, but the virtual disk file is not open.

VDS_VST_ATTACHED:  The virtual disk has been added to the service's list of objects, the virtual disk file has been opened using IVdsVDisk::Open, and the virtual disk is attached.

VDS_VST_DETACH_PENDING:  The virtual disk has been added to the service's list of objects, the virtual disk file has been opened using IVdsVDisk::Open, and the virtual disk is in the process of being detached.

VDS_VST_COMPACTING:  The virtual disk has been added to the service's list of objects, the virtual disk file has been opened using IVdsVDisk::Open, and the virtual disk is being compacted.

VDS_VST_MERGING:  The virtual disk has been added to the service's list of objects, the virtual disk file has been opened using IVdsVDisk::Open, and the virtual disk is being merged.

VDS_VST_EXPANDING:  The virtual disk has been added to the service's list of objects, the virtual disk file has been opened using IVdsVDisk::Open, and the virtual disk is being expanded.

VDS_VST_DELETED:  The virtual disk has been deleted.

VDS_VST_MAX:  Denotes the maximum acceptable value for this type. VDS_VST_MAX - 1 is the maximum acceptable value.

When the service has been made aware of a virtual disk, the state is set to VDS_VST_ADDED. In order to perform any operations on the virtual disk such as attaching it, detaching it, merging, compacting, or expanding, the virtual disk file is opened using IVdsVDisk::Open. Once the virtual disk is opened, its state transitions to VDS_VST_OPEN.

Attach: To attach a virtual disk, the virtual disk object is first added to the service's list of objects and its state is set to VDS_VS_ADDED. Next IVdsVDisk::Open MUST be called against the virtual disk, and the state transitions to VDS_VST_OPEN. When the attach operation is initiated against the virtual disk, the state of the virtual disk transitions to VDS_VST_ATTACH_PENDING. The virtual disk remains in this state until the operating system disk object corresponding to the virtual disk has been instantiated. Once this object is instantiated, the virtual disk object's state transitions to VDS_VST_ATTACHED. The IVdsOpenVDisk interface is then released, the OpenVirtualDisk object is removed, and the state transitions to VDS_VST_ATTACHED_NOT_OPEN.

Detach: To detach a virtual disk, the virtual disk object is first added to the service's list of objects and its state is set to VDS_VST_ADDED. Next IVdsVDisk::Open MUST be called against the virtual disk, and the state transitions to VDS_VST_OPEN. When the detach operation is initiated against the virtual disk, the state of the virtual disk transitions to VDS_VST_DETACH_PENDING. The virtual disk remains in this state until the operating system disk object corresponding to the virtual disk has been removed. Once this object is removed, the virtual disk object's state transitions to VDS_VST_OPEN. The IVdsOpenVDisk interface is then released, the OpenVirtualDisk object is removed, and the state transitions to VDS_VST_ADDED.

Compact: A compact operation is performed against either an attached virtual disk or a detached virtual disk. To compact a virtual disk, the virtual disk object is first added to the service's list of objects and its state is set to VDS_VST_ADDED.

To compact a detached virtual disk, IVdsVDisk::Open MUST be called against the virtual disk, and the state transitions to VDS_VST_OPEN. When the compact operation is initiated against the virtual disk, the state transitions to VDS_VST_COMPACTING. Once the compact operation has completed, the state then transitions back to VDS_VST_OPEN. The IVdsOpenVDisk interface is then released, the OpenVirtualDisk object is removed, and the new state is VDS_VST_ADDED.

An attached virtual disk for which there is no OpenVirtualDisk object will have the state VDS_VST_ATTACHED_NOT_OPEN. To compact an attached virtual disk, IVdsVDisk::Open MUST be called against the virtual disk, and the state transitions to VDS_VST_ATTACHED. When the compact operation is initiated against the virtual disk, the state transitions to VDS_VST_COMPACTING. Once the compact operation has completed, the state then transitions back to VDS_VST_ATTACHED. The IVdsOpenVDisk interface is then released, the OpenVirtualDisk object is removed, and the new state is VDS_VST_ATTACHED_NOT_OPEN.

Merge or Expand: Merge and expand operate on detached virtual disks. To merge or expand a virtual disk, the virtual disk object is first added to the service's list of objects and its state is set to VDS_VS_ADDED. Next IVdsVDisk::Open MUST be called against the virtual disk, and the state transitions to VDS_VST_OPEN. When the merge or expand operation is initiated against the virtual disk, the state of the virtual disk transitions to VDS_VST_MERGING or VDS_VST_EXPANDING. Once the merge or expand operation has completed, the state then transitions back to VDS_VST_OPEN. The IVdsOpenVDisk interface is then released, the OpenVirtualDisk object is removed, and the new state is VDS_VST_ADDED.