3.2.4.4.3.32 IVolumeClient3::CreatePartitionsForVolume (Opnum 35)

The CreatePartitionsForVolume method creates a partition underneath a volume. This is a synchronous task.

 HRESULT CreatePartitionsForVolume(
   [in] LdmObjectId volumeId,
   [in] boolean active,
   [in] hyper volumeLastKnownState,
   [out] TASK_INFO* tinfo
 );

volumeId: Specifies the OID of the volume under which to create a partition.

active: Boolean value that indicates whether the new partition is to be set to active, which would make it an active partition. On x86, and possibly other BIOSes, this is needed by the BIOS to start the machine from the volume.

Value

Meaning

FALSE

0

New partition is not set to active.

TRUE

1

New partition is set to active.

volumeLastKnownState: Last known modification sequence number of the volume.

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:

  1. Verify that the dynamic volume specified by volumeId is in the list of storage objects, and check whether the field volumeSpec.lastKnownState matches the field LastKnownState of the object.

  2. 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:

  1. Enumerate all disk regions that correspond to the dynamic volume specified by volumeId from the list of storage objects.

  2. For each disk region, create an entry in the partition table of its disk. The partition MUST have the same offset and length as the disk region. If the active flag is set to TRUE, set the active bit in the partition table to 1. If the active flag is set to FALSE, set the active bit in the partition table to 0.

  3. Wait for the partition creations to succeed or fail.

  4. Fill in the tinfo output parameter.

    TASK_INFO member

    Required for this operation

    TASK_INFO::id

    Required.

    TASK_INFO::storageId

    Not required.

    TASK_INFO::createTime

    Not required.<202>

    TASK_INFO::clientID

    Not required.<203>

    TASK_INFO::percentComplete

    Required for any task that returns REQ_IN_PROGRESS.

    TASK_INFO::status

    Required.

    TASK_INFO::type

    Required if PercentageComplete is being used.

    TASK_INFO::error

    Required.

    TASK_INFO::tflag

    Not required.<204>

  5. Return a response to the client containing tinfo and the status of the operation.

  6. Send the task completion notification.<205>

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 of status.

  • Modify the disk objects where the partitions were created to account for the change in region allocation.<206>