<div class="content" name="Extend" uuid="88b622c8-0473-44a6-a50c-a95c75b5b5af"><p>The Extend method expands the size of the current <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_9a876829-33a1-4f0b-8b81-8552b7e5561c" data-linktype="relative-path">volume</a> by adding <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_7bdb0d0a-b0eb-4312-b663-3bb24fdd35e0" data-linktype="relative-path">disk extents</a> to each member
of each <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_d864e01b-9fb1-4beb-9864-8221d293445a" data-linktype="relative-path">plex</a>. </p><dl>
<dd>
<div><pre> HRESULT Extend(
   [in, unique, size_is(lNumberOfDisks)] 
     VDS_INPUT_DISK* pInputDiskArray,
   [in] long lNumberOfDisks,
   [out] IVdsAsync** ppAsync
 );
</pre></div>
</dd></dl><p><b>pInputDiskArray: </b>A pointer to an array of <a href="2ec3b542-a7d7-4927-bdd6-b0dc8a8881ae" data-linktype="relative-path">VDS_INPUT_DISK</a> structures
that describe the disk extents to add to the volume--one structure for each <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_c4133b2a-a990-4042-ba44-7fda3090f118" data-linktype="relative-path">disk</a>. 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.</p><p><b>lNumberOfDisks: </b>The number of elements in <i>pInputDiskArrray</i>.<a id="Appendix_A_Target_111"></a><a aria-label="Product behavior note 111" href="6b2552ee-ba27-409f-99a8-18841573327a#Appendix_A_111" data-linktype="relative-path">&lt;111&gt;</a></p><p><b>ppAsync: </b>A pointer to an <a href="97ea9c0f-5c8a-43e9-a9ee-deda29e2a09e" data-linktype="relative-path">IVdsAsync</a> interface that,
if the operation is successfully completed, receives the IVdsAsync interface to
monitor and control this operation. Callers MUST release the <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_95913fbd-3262-47ae-b5eb-18e6806824b9" data-linktype="relative-path">interface</a> when they are
done with it.</p><p><b>Return Values: </b>The method MUST return zero or
a non-error <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_799103ab-b3cb-4eab-8c55-322821b2b235" data-linktype="relative-path">HRESULT</a> (as
specified in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>)
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 <a href="5102cc53-3143-4268-ba4c-6ea39e999ab4" data-linktype="relative-path">2.2.3</a>.</p><p>When the server receives this message, it MUST validate the
following parameters:</p><ul><li><p><span><span> 
</span></span>Verify that <i>pInputDiskArray</i> is not NULL.</p>
</li><li><p><span><span> 
</span></span>Verify that <i>ppAsync</i> is not NULL.</p>
</li></ul><p>The server MUST perform the following:</p><ul><li><p><span><span> 
</span></span>If the volume&#39;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 <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_ea22e521-1a4e-4ceb-8d64-f65fa6d0e63b" data-linktype="relative-path">formatted</a> with the <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_86f79a17-c0be-4937-8660-0cf6ce5ddc1a" data-linktype="relative-path">NTFS</a> file system, volumes
that have no file system formatting will return this error.</p>
</li><li><p><span><span> 
</span></span>For each VDS_INPUT_DISK structure in the <i>pInputDiskArray</i>
parameter, verify that the value of the <b>ullSize</b> field does not exceed
the amount of <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_4932fda9-4823-4a72-b4e7-629f89d8fd90" data-linktype="relative-path">free space</a>
on the given disk. If the volume is being created within a <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_b11172af-9369-448d-9722-444eb52b21cb" data-linktype="relative-path">dynamic disk</a> <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_890bb28d-df68-420f-a8bc-83899d34ad5c" data-linktype="relative-path">pack</a> 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 <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_425be2e8-ca0d-45db-afba-d9daee040d07" data-linktype="relative-path">basic disk</a> pack and if this
requirement is not met, then the server MUST return VDS_E_NOT_ENOUGH_SPACE.</p>
</li><li><p><span><span> 
</span></span>Create a new async object implementing the IVdsAsync interface
with an output type of VDS_ASYNCOUT_EXTENDVOLUME and set the pointer <i>ppAsync</i>
references to the interface.</p>
</li><li><p><span><span> 
</span></span>Return an HRESULT indicating failure or success. Any errors
encountered up through this point in processing the operation are returned in
this HRESULT.</p>
</li></ul><p>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.</p><ul><li><p><span><span> 
</span></span>Extend the volume following the parameters specified to the
method.</p>
</li><li><p><span><span> 
</span></span>If the volume&#39;s size is changed, then for each callback object
registered in the list of callback objects, call the callback object&#39;s <a href="04a70bf6-208d-463a-b0a4-cc96e198ded1" data-linktype="relative-path">IVdsAdviseSink::OnNotify (section 3.3.4.3.1)</a>
method with a <a href="4f29057f-ab32-4a3d-9fcb-00ba3457cb42" data-linktype="relative-path">VDS_NOTIFICATION (section 2.2.1.3.9)</a>
structure with the following attributes:</p>
<ul><li><p><span><span>  </span></span><b>objectType</b>
member is VDS_NTT_VOLUME.</p>
</li><li><p><span><span>  </span></span>Volume
member is a VDS_VOLUME_NOTIFICATION with the following attributes:</p>
<ul><li><p><span><span> 
</span></span><b>ulEvent</b> is VDS_NF_VOLUME_MODIFY.</p>
</li><li><p><span><span> 
</span></span><b>volumeId</b> is the VDS_OBJECT_ID of this volume object.</p>
</li><li><p><span><span> 
</span></span><b>plexId</b> is NULL GUID, but it is not relevant when ulEvent
is VDS_NF_VOLUME_MODIFY.</p>
</li><li><p><span><span> 
</span></span><b>ulPercentCompleted</b> range is 0-100 and is
implementation-specific; however, it is not relevant when ulEvent is
VDS_NF_VOLUME_MODIFY.</p>
</li></ul></li></ul></li><li><p><span><span> 
</span></span>The <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_528b06a4-e67c-43b3-a02d-8738858a691d" data-linktype="relative-path">file
system</a> on the volume MAY<a id="Appendix_A_Target_112"></a><a aria-label="Product behavior note 112" href="6b2552ee-ba27-409f-99a8-18841573327a#Appendix_A_112" data-linktype="relative-path">&lt;112&gt;</a> need
to be extended to fill the newly extended volume.</p>
</li><li><p><span><span> 
</span></span> 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 <b>VDS_VOLUME_MODIFIED</b> notification was sent during
the previous steps because the volume&#39;s size is not changed and if the file
system&#39;s size is changed, then for each callback object registered in the list
of callback objects, call the callback object&#39;s IVdsAdviseSink::OnNotify method
with a VDS_NOTIFICATION structure with the following attributes:</p>
<ul><li><p><span><span>  </span></span><b>objectType</b>
member is VDS_NTT_FILE_SYSTEM.</p>
</li><li><p><span><span>  </span></span>The
<b>Filesystem</b> member is a <a href="e75c0a7b-53f3-439f-ad9c-2473b96998de" data-linktype="relative-path">VDS_FILE_SYSTEM_NOTIFICATION</a>
with the following attributes:</p>
<ul><li><p><span><span> 
</span></span><b>ulEvent</b> is VDS_NF_FILE_SYSTEM_MODIFY.</p>
</li><li><p><span><span> 
</span></span><b>volumeId</b> is the VDS_OBJECT_ID of this volume object.</p>
</li></ul></li></ul></li><li><p><span><span> 
</span></span>Set the return code in the async object to an HRESULT indicating
failure or success.</p>
</li><li><p><span><span> 
</span></span>If the task completed successfully, set the percentage completed
value in the async object to 100.<a id="Appendix_A_Target_113"></a><a aria-label="Product behavior note 113" href="6b2552ee-ba27-409f-99a8-18841573327a#Appendix_A_113" data-linktype="relative-path">&lt;113&gt;</a></p>
</li><li><p><span><span> 
</span></span>Set the signal state in the async object to TRUE.</p>
</li></ul><p>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.</p></div>