3.4.5.2.19.9 IVdsPack::Recover (Opnum 12)

The Recover method restores a disk pack to a healthy state. This method is not supported on basic disk packs or the INVALID dynamic disk pack (the value of VDS_PACK_PROP::pwszName is INVALID for this pack). The INVALID dynamic disk pack contains dynamic disks that have failed to be joined to the owning pack because there are errors or data corruption has occurred.

 HRESULT Recover(
   [out] IVdsAsync** ppAsync
 );

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 parameter:

  • Verify that ppAsync is not NULL.

The server MUST perform the following:

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

  • For all disks in the pack, attempt to bring the disk back to a healthy state.  For all disks in the invalid pack, attempt to bring the disk back to a healthy state and rejoin it to its proper pack.  Attempt to resync any mirrored volumes, and regenerate any RAID-5 volumes that are in the online pack.

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

  • If changes are made to the pack as a result of the call to recover, then for each callback object that is registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify (section 3.3.4.3.1) method by using a VDS_NOTIFICATION (section 2.2.1.3.9) structure that has the following attributes:

  • If the method call results in RAID-5 or mirrored volumes being regenerated or resynchronized, the server MUST send progress notifications to the client as follows.

    For each callback object that is registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify method by using a VDS_NOTIFICATION structure that has the following attributes:

    • objectType member is VDS_NTT_VOLUME.

    • Volume member is a VDS_VOLUME_NOTIFICATION (section 2.2.1.3.4) structure that has the following attributes:

      • ulEvent is the value VDS_NF_VOLUME_REBUILDING_PROGRESS.

      • volumeId is the VDS_OBJECT_ID value of this volume object being regenerated or resynchronized.

      • plexId is the VDS_OBJECT_ID value of the plex object being regenerated or resynchronized.

      • ulPercentCompleted is a number between 0 and 100 indicating regeneration or resynchronization progress.

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.