3.4.5.2.32.6 IVdsVolume::AddPlex (Opnum 8)

The AddPlex method adds a volume as a plex to the current volume.

 HRESULT AddPlex(
   [in] VDS_OBJECT_ID VolumeId,
   [out] IVdsAsync** ppAsync
 );

VolumeId: The VDS object ID of the volume object to add as a plex.

ppAsync: A pointer to an IVdsAsync interface that, if the operation is successfully completed, receives the IVdsAsync interface to monitor and control this operation. Callers MUST release the interface when they are done with it.

Return Values: The method MUST return zero or a non-error HRESULT (as specified in [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service Remote Protocol, see section 2.2.3.

When the server receives this message, it MUST validate the following parameters:

  • Verify that the volume corresponding to the VDS_OBJECT_ID that VolumeId specifies has only one volume plex.

  • Verify that ppAsync is not NULL.

If the volume resides on a basic disk, the server MUST return VDS_E_NOT_SUPPORTED (HRESULT of 0x80042400).

The server MUST perform the following:

  • Verify that the size of the volume specified using the VolumeId parameter has a size that is greater than, or equal to, the size of the volume to which the plex is being added. If the size of the volume specified using the VolumeId parameter is less than the size of the volume to which a plex is being added, then the server MUST return VDS_E_VOLUME_TOO_SMALL.

  • Verify that the volume specified using the VolumeId parameter has no extents located on disks that contain extents belonging to the volume to which the plex is being added. If the volume specified using the VolumeId parameter fails this requirement, then the server MUST return VDS_E_DISK_IN_USE_BY_VOLUME.

  • Create a new async object implementing the IVdsAsync interface with an output type of VDS_ASYNCOUT_ADDVOLUMEPLEX and set the pointer that ppAsync references to the interface.

  • Return an HRESULT indicating failure or success. Any errors encountered up through this point in processing the operation are returned in this HRESULT.

The server MUST then perform the following in sequence. Errors generated in this sequence of steps are returned in the pHrResult parameter to the IVdsAsync::Wait or IVdsAsyncQueryStatus methods.

  • Add the volume plex of the volume corresponding to the VDS_OBJECT_ID that VolumeId specifies as a volume plex to this volume.

  • Set the volume plex's volume pointer to this volume object.

  • Remove the volume object corresponding to the VDS_OBJECT_ID that VolumeId specifies from the list of storage management objects.

  • Set the return code in the async object to an HRESULT indicating failure or success.

  • If the task completed successfully, set the percentage completed value in the async object to 100.

  • Set the signal state in the async object to TRUE.

The server MUST update the percentage completed value periodically during the preceding sequence. How often the percentage completed is updated, and at what point in the sequence, is implementation-specific.