3.4.5.1.9 Handling Asynchronous Tasks

When the client calls a method that initiates a task that returns an async object, the server MUST create an async object that implements the IVdsAsync interface and return the interface pointer to the client to allow it to monitor the task's status. For examples of how async objects can be used, see section 4.5.

If the task has completed successfully and the client calls the IVdsAsync::Wait method on the async object, the server MUST return the following task-specific return values to the client by means of the VDS_ASYNC_OUTPUT structure returned by the method. The return values are determined by the async output type:

  • VDS_ASYNCOUT_CREATEPARTITION:

    • The byte offset at which the partition was created (returned in the cp.ullOffset member).

    • The VDS_OBJECT_ID of the associated volume if the partition is a volume (returned in the cp.volumeId member).

  • VDS_ASYNCOUT_CREATEVOLUME:

    • The IUnknown pointer of the volume object created (returned in the cv.pVolumeUnk member).

  • VDS_ASYNCOUT_BREAKVOLUMEPLEX:

    • The IUnknown pointer of the volume object that resulted when the volume plex was broken from the original volume (returned in the bvp.pVolumeUnk member).

  • VDS_ASYNCOUT_SHRINKVOLUME:

    • The number of bytes reclaimed by the shrink operation (returned in the sv.ullReclaimedBytes member).

  • VDS_ASYNCOUT_CREATE_VDISK:

    • The IUnknown pointer of the virtual disk object created (returned in the cvd.pVDiskUnk member).

If the async output type is none of the preceding or if the task did not complete successfully, no data other than the return code of the operation MAY be returned. This means that if the task fails before the method call returns to the client, the method will return an error code and MAY not return the IVdsAsync interface.

If the task fails after the method call has returned to the client but before the task has completed, the IVdsAsync interface will return an error code and MAY not contain any other information.