IVdsPack::MigrateDisks method (vds.h)
[Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage Management API.]
Migrates a set of disks from one pack to another pack.
Syntax
HRESULT MigrateDisks(
[in] VDS_OBJECT_ID *pDiskArray,
[in] LONG lNumberOfDisks,
[in] VDS_OBJECT_ID TargetPack,
[in] BOOL bForce,
[in] BOOL bQueryOnly,
[out] HRESULT *pResults,
[out] BOOL *pbRebootNeeded
);
Parameters
[in] pDiskArray
A pointer to an array of GUIDs; one for each disk.
[in] lNumberOfDisks
The number of disks to migrate.
[in] TargetPack
The GUID of the pack object.
[in] bForce
If this parameter is set to TRUE, VDS ignores all errors from this method and attempts to migrate the disks unconditionally. If it is set to FALSE, the operation does not proceed. In some cases, a forced migration can cause data loss.
[in] bQueryOnly
If this parameter is set to TRUE, the migration does not occur. If it is set to FALSE, the operation proceeds.
[out] pResults
The address of a caller-allocated array of HRESULT values. The number of elements in the array is lNumberOfDisks.
If a disk can be migrated, or was migrated successfully, the corresponding array element receives S_OK; otherwise, it receives the warning code or error code that was returned by the provider. For the list of additional result codes, see Return Values.
[out] pbRebootNeeded
If this parameter is set to TRUE, you must restart the computer to complete the operation. If it is set to FALSE, the operation completes without restarting.
Return value
This method can return standard HRESULT values, such as E_INVALIDARG or E_OUTOFMEMORY, and VDS-specific return values. It can also return converted system error codes using the HRESULT_FROM_WIN32 macro. Errors can originate from VDS itself or from the underlying VDS provider that is being used. Possible return values include the following.
Return code/value | Description |
---|---|
|
The migration completed successfully. |
|
At least one of the disks cannot be converted, or can be converted with warning. |
|
One of the disks is unavailable. |
|
An attempt was made to import a subset of the disks in the foreign pack. |
The following warnings and errors can be returned through pResults:
Return code/value | Description |
---|---|
|
The partition number of the boot partition changed as the result of the migration operation. |
|
The selected disk does not have enough free space to complete the operation. |
|
An active partition was detected on the selected disk, and it is not the active partition used to boot the active operating system. |
|
The partition information cannot be read. |
|
A partition with an unknown type was detected on the selected disk. |
|
The selected GPT disk contains a non-basic data partition, which is both preceded by and followed by one or more basic data partitions. |
|
A volume on the selected disk cannot be opened. |
Remarks
VDS implements this method.
A single pack can have only one basic disk. As such, you can migrate only one disk at a time between a basic and dynamic pack.
You should force this operation when converting a basic disk to dynamic disk format and the end of the disk lacks enough space for the LDM database. Set the bForce parameter to true and force the operation despite the space limitation. Likewise, if an OEM partition is in the middle of a MBR disk with free space or data volumes on either side.
After migrating dynamic disks to a dynamic pack, you should use the IVdsPack::GetProperties method to determine whether the source or destination pack is now the online pack.
For information about using the MigrateDisks method to add foreign disks to a pack, see Adding Foreign Disks to a Pack.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | vds.h |
Library | Uuid.lib |