188.8.131.52.1.32 IVolumeClient::AddMirror (Opnum 36)
The AddMirror method adds a mirror to the specified dynamic volume. This is a synchronous task.
HRESULT AddMirror( [in] LdmObjectId volumeId, [in] hyper volumeLastKnownState, [in] DISK_SPEC diskSpec, [in, out] int* diskNumber, [out] int* partitionNumber, [out] TASK_INFO* tinfo );
volumeId: Specifies the OID of the volume to which the mirror is being added.
volumeLastKnownState: Volume's last known modification sequence number.
diskNumber: Unused. This parameter MUST be set to 0 by the client and MUST be ignored by the server.
partitionNumber: Pointer to the partition number of the newly added mirror.
tinfo: Pointer to a TASK_INFO structure that the client can use to track the request's progress.
Return Values: The method MUST return 0 or a nonerror HRESULT on success, or an implementation-specific nonzero error code on failure (as specified in [MS-ERREF]; see also section 2.2.1 for HRESULT values predefined by the Disk Management Remote Protocol).
Upon receiving this message, the server MUST validate parameters:
Verify that the dynamic volume specified by volumeId is in the list of storage objects, and check whether the field volumeLastKnownState matches the field LastKnownState of the object.
Verify that the disk specified by diskSpec.diskId is in the list of storage objects, and check whether diskSpec.lastKnownState matches the LastKnownState field of the object.
Verify that partitionNumber is not NULL.
Verify that tinfo is not NULL.
If parameter validation fails, the server MUST fail the operation immediately, returning an appropriate error as its response to the client.
Otherwise, the server MUST process the message as follows:
Add a mirror to the dynamic volume as follows:
A new member of the volume MUST be created on the disk specified by diskSpec.diskId and added to the volume as a mirror.
The length of the member is determined by the length of the volume field.
If the field diskSpec.needContiguous is set to TRUE, the server MUST allocate a contiguous disk region for the new member. Otherwise, the server MAY allocate several noncontiguous disk regions.
Wait for the mirror addition to either succeed or fail.
Fill the partitionNumber output parameter as follows:
Fill in the tinfo output parameter.
Required for this operation
Required for any task that returns REQ_IN_PROGRESS.
Required if PercentageComplete is being used.
Return a response to the client containing tinfo, partitionNumber, and the status of the operation.
Send the task completion notification.<119>
If the operation is successful, the server MUST make the following changes to the list of storage objects before returning the response:
Modify the dynamic volume object to account for the change in layout and number of members.
Modify the disk object where the new volume member was created to account for the change in region allocation.
Create new disk region objects that correspond to the new volume member.
Modify or delete the free disk region objects where the new volume member was created to account for the allocation of the volume member in those regions.