<div class="content" name="AddPlex" uuid="e09ed5be-7bf9-4b77-93fc-6187de619f1a"><p>The AddPlex method adds a <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_9a876829-33a1-4f0b-8b81-8552b7e5561c" data-linktype="relative-path">volume</a> as a <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_d864e01b-9fb1-4beb-9864-8221d293445a" data-linktype="relative-path">plex</a> to the current volume.</p><dl>
<dd>
<div><pre> HRESULT AddPlex(
   [in] VDS_OBJECT_ID VolumeId,
   [out] IVdsAsync** ppAsync
 );
</pre></div>
</dd></dl><p><b>VolumeId: </b>The <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_27e6393b-d035-40c5-8503-d7affe7bd27b" data-linktype="relative-path">VDS object</a> ID of the volume
object to add as a plex.</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 interface 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 the volume corresponding to the <a href="9186f1ce-04de-4df2-a8cf-3925a02fcd47" data-linktype="relative-path">VDS_OBJECT_ID</a> that
VolumeId specifies has only one volume plex.</p>
</li><li><p><span><span> 
</span></span>Verify that <b>ppAsync</b> is not NULL.</p>
</li></ul><p>If the volume resides on a basic disk, the server MUST
return VDS_E_NOT_SUPPORTED (HRESULT of 0x80042400).</p><p>The server MUST perform the following:</p><ul><li><p><span><span> 
</span></span>Verify that the size of the volume specified using the <i>VolumeId</i>
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
<i>VolumeId</i> 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.</p>
</li><li><p><span><span> 
</span></span>Verify that the volume specified using the <i>VolumeId</i>
parameter has no extents located on <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_c4133b2a-a990-4042-ba44-7fda3090f118" data-linktype="relative-path">disks</a> that contain extents
belonging to the volume to which the plex is being added. If the volume
specified using the <i>VolumeId</i> parameter fails this requirement, then the
server MUST return VDS_E_DISK_IN_USE_BY_VOLUME.</p>
</li><li><p><span><span> 
</span></span>Create a new async object implementing the IVdsAsync interface
with an output type of VDS_ASYNCOUT_ADDVOLUMEPLEX and set the pointer that <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>Add the <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_7d1df68a-9ec5-4f84-a64f-67888f39405d" data-linktype="relative-path">volume
plex</a> of the volume corresponding to the VDS_OBJECT_ID that VolumeId
specifies as a volume plex to this volume.</p>
</li><li><p><span><span> 
</span></span>Set the volume plex&#39;s volume pointer to this volume object.</p>
</li><li><p><span><span> 
</span></span>Remove the volume object corresponding to the VDS_OBJECT_ID that
VolumeId specifies from the list of storage management objects. </p>
</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.</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>