共用方式為


IVMHardDisk::MergeTo method

The MergeTo method merges a differencing hard disk image with all of its parents (up to and including the root parent hard disk image) to a new hard disk file.

Syntax

HRESULT MergeTo(
  [in]  BSTR           newDiskImagePath,
  [in]  VMHardDiskType newDiskImageType,
  [out] IVMTask        **mergeTask
);

Parameters

newDiskImagePath [in]

The path to the new target disk image where the selected disk images will be merged.

newDiskImageType [in]

The type of new target disk image. The image types allowed for the new target disk image are vmDiskType_Dynamic and vmDiskType_FixedSize. See VMHardDiskType.

mergeTask [out]

The task which is used to track the completion of the merging process.

Return value

Return code Description
S_OK
The operation was successful.
E_POINTER
The newDiskImagePath or mergeTask parameter is NULL.
E_INVALIDARG
The newDiskImagePath parameter is empty.
E_FILE_NOT_FOUND
The system cannot find the file specified by the newDiskImagePath parameter.
E_PATH_NOT_FOUND
The system cannot find the path specified by the newDiskImagePath parameter.
E_INVALID_NAME
The newDiskImagePath parameter contains an invalid character (one of the following: *?<>/|":).
E_BAD_PATHNAME
The newDiskImagePath parameter specifies an empty or relative path. An absolute path is required.
E_BUFFER_OVERFLOW
The path specified by the newDiskImagePath parameter is too long. The path must be less than 260 characters.
E_SHARING_VIOLATION
Either the virtual hard disk referenced by this object is in use or the parent of this virtual hard disk is in use.
VM_E_WRONG_HD_IMAGE_TYPE
This error is caused either because the virtual hard disk image referenced by this IVMHardDisk object is not a differencing disk image or because the parameter newDiskImageType is not one of the accepted values, vmDiskType_Dynamic or vmDiskType_FixedSize.
E_ALREADY_EXISTS
The file referenced by the newDiskImagePath parameter already exists.
E_DISK_FULL
The host volume does not have enough space to merge this virtual hard disk.
VM_E_PARENT_PATH_NOT_FOUND
The parent of the virtual hard disk referenced by this object does not exist.
VM_E_APP_SHUTTING_DOWN
The virtual hard disk image cannot be merged because the application is shutting down.
DISP_E_EXCEPTION
An unexpected error occurred.

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IVMHardDisk