Compartir a través de


IVMVirtualServer::CreateHostDriveVirtualHardDisk method

The CreateHostDriveVirtualHardDisk method creates a virtual hard disk that is linked to a host drive.

Syntax

HRESULT CreateHostDriveVirtualHardDisk(
  [in]  BSTR         imagePath,
  [in]  BSTR         hostDriveIdentifier,
  [in]  VARIANT_BOOL mountReadOnly,
  [out] IVMTask      **diskTask
);

Parameters

imagePath [in]

The full path to the new disk image file. The containing folder will be created if it does not exist.

hostDriveIdentifier [in]

An identifier used to distinguish between the host drives. Use IVMHostInfo::HostDrives to get valid drive identifiers.

mountReadOnly [in]

This parameter is only valid if the host drive is unmounted. If the host drive is already mounted, then the virtual hard disk image will always mount as read-only.

diskTask [out]

Retrieves the task which is used to track the creation of the image.

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 imagePath, hostDriveIdentifier, or diskTask parameter is NULL.
E_PATH_NOT_FOUND
The system cannot find the path specified by the imagePath parameter.
E_INVALID_NAME
The imagePath parameter contains an invalid character (one of "*?:<>/|"").
E_BAD_PATHNAME
The imagePath parameter specifies an empty or relative path. An absolute path is required.
E_BUFFER_OVERFLOW
The path specified by the imagePath parameter is too long. The length of the path must be less than 260 characters.
E_ALREADY_EXISTS
The file referenced by the parameter imagePath already exists.
E_DISK_FULL
The dynamically expanding virtual hard disk image needs at least 8 MB free on the host volume.
VM_E_IMAGE_SIZE_TOO_LARGE
The parameter size must be less than 2,088,960 MB. If format is "vmDiskFormat_FAT16", then size must be less than 2,000 MB.
VM_E_IMAGE_SIZE_TOO_SMALL
Unformatted and FAT16 formatted virtual hard disk images must be at least 3 MB. FAT32 formatted virtual hard disk images must be at least 514 MB.
VM_E_FILE_TOO_LARGE_FOR_VOLUME
The host volume cannot support a file this size if the dynamically expanding virtual hard disk image expands to its full limit. The maximum file size for a FAT32 volume is 4 GB.
VM_E_APP_SHUTTING_DOWN
The virtual hard disk cannot be created after the application has started 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

IVMVirtualServer