IVMHardDisk::Convert method

The Convert method converts a disk image to either a dynamically expanding disk image or a fixed-size disk image.

Syntax

HRESULT Convert(
  [in]  BSTR           convertedDiskImagePath,
  [in]  VMHardDiskType convertedDiskImageType,
  [out] IVMTask        **convertTask
);

Parameters

convertedDiskImagePath [in]

The path to the target disk image file.

convertedDiskImageType [in]

The type of the target disk image. This parameter must be either vmDiskType_Dynamic or vmDiskType_FixedSize. See VMHardDiskType.

convertTask [out]

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

Return value

This method supports standard return values, as well as the following. For information on Virtual Server specific return values not listed below, see HRESULT Codes Specific to the Virtual Server.

Return code Description
S_OK
The operation was successful.
E_POINTER
The convertedDiskImagePath or convertTask parameter is NULL.
E_PATH_NOT_FOUND
The system cannot find the path specified by the convertedDiskImagePath parameter.
E_INVALID_NAME
The convertedDiskImagePath parameter contains an invalid character (one of "*?<>/|":").
E_BAD_PATHNAME
The convertedDiskImagePath parameter specifies an empty or relative path. An absolute path is required.
E_BUFFER_OVERFLOW
The path specified by the convertedDiskImagePath 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.
E_DISK_FULL
The host volume does not have enough space to convert this virtual hard disk.
E_ALREADY_EXISTS
The file referenced by the convertedDiskImagePath parameter already exists.
VM_E_WRONG_HD_IMAGE_TYPE
The convertedDiskImageType parameter must be either vmDiskType_Dynamic or vmDiskType_FixedSize.
VM_E_INVALID_HD_FILE
The virtual hard disk image referenced by this IVMHardDisk object does not seem to be a valid image.
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 converted because the application is shutting down.
DISP_E_EXCEPTION
An unexpected error occurred.

Remarks

The source file is left intact after the conversion process.

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