3.4.5.2.32.4 IVdsVolume::Extend (Opnum 6)

The Extend method expands the size of the current volume by adding disk extents to each member of each plex.

 HRESULT Extend(
   [in, unique, size_is(lNumberOfDisks)] 
     VDS_INPUT_DISK* pInputDiskArray,
   [in] long lNumberOfDisks,
   [out] IVdsAsync** ppAsync
 );

pInputDiskArray: A pointer to an array of VDS_INPUT_DISK structures that describe the disk extents to add to the volume--one structure for each disk. Callers SHOULD specify the member index for all the disk extents together with the Extend method, unless the volume has only one plex with only one member.

lNumberOfDisks: The number of elements in pInputDiskArrray.<111>

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 pInputDiskArray is not NULL.

  • Verify that ppAsync is not NULL.

The server MUST perform the following:

  • If the volume's file system does not support extend operations, then this method MUST return VDS_E_CANNOT_EXTEND. For example, on operating systems where both volumes are formatted with the NTFS file system, volumes that have no file system formatting will return this error.

  • For each VDS_INPUT_DISK structure in the pInputDiskArray parameter, verify that the value of the ullSize field does not exceed the amount of free space on the given disk. If the volume is being created within a dynamic disk pack and if this requirement is not met, then the server MUST return VDS_E_EXTENT_EXCEEDS_DISK_FREE_SPACE. If the volume is being created within a basic disk pack and if this requirement is not met, then the server MUST return VDS_E_NOT_ENOUGH_SPACE.

  • Create a new async object implementing the IVdsAsync interface with an output type of VDS_ASYNCOUT_EXTENDVOLUME and set the pointer 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.

  • Extend the volume following the parameters specified to the method.

  • If the volume's size is changed, then for each callback object registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify (section 3.3.4.3.1) method with a VDS_NOTIFICATION (section 2.2.1.3.9) structure with the following attributes:

    • objectType member is VDS_NTT_VOLUME.

    • Volume member is a VDS_VOLUME_NOTIFICATION with the following attributes:

      • ulEvent is VDS_NF_VOLUME_MODIFY.

      • volumeId is the VDS_OBJECT_ID of this volume object.

      • plexId is NULL GUID, but it is not relevant when ulEvent is VDS_NF_VOLUME_MODIFY.

      • ulPercentCompleted range is 0-100 and is implementation-specific; however, it is not relevant when ulEvent is VDS_NF_VOLUME_MODIFY.

  • The file system on the volume MAY<112> need to be extended to fill the newly extended volume.

  •  If the file system on the volume supports extension, for example, the NTFS or RAW file system, extend the file system to fill the newly extended volume. If no VDS_VOLUME_MODIFIED notification was sent during the previous steps because the volume's size is not changed and if the file system's size is changed, then for each callback object registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify method with a VDS_NOTIFICATION structure with the following attributes:

    • objectType member is VDS_NTT_FILE_SYSTEM.

    • The Filesystem member is a VDS_FILE_SYSTEM_NOTIFICATION with the following attributes:

      • ulEvent is VDS_NF_FILE_SYSTEM_MODIFY.

      • volumeId is the VDS_OBJECT_ID of this volume object.

  • 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.<113>

  • 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.