IVMVirtualMachine::AddHardDiskConnection method
The AddHardDiskConnection method adds a new hard disk connection to the virtual machine.
Syntax
HRESULT AddHardDiskConnection(
[in] BSTR hardDiskPath,
[in] VMDriveBusType busType,
[in] long busNumber,
[in] long deviceNumber,
[out] IVMHardDiskConnection **hardDiskConnection
);
Parameters
-
hardDiskPath [in]
-
Full path specifying the virtual hard disk file to connect
-
busType [in]
-
Bus to attach the hard disk drive to.
-
busNumber [in]
-
Bus number to attach the hard disk to. For IDE, this number can be 0-1. For SCSI, this number is an index from 0 to the number returned by IVMSCSIControllerCollection::Count.
-
deviceNumber [in]
-
Device number to attach the hard disk to. For IDE, this number can be 0-1. For SCSI, this number can be 0-6.
-
hardDiskConnection [out]
-
A new IVMHardDiskConnection object.
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 |
---|---|
|
The operation was successful. |
|
The hardDiskPath parameter is NULL, empty, or not valid; the busType, busNumber, or deviceNumber parameter is not valid. |
|
The hardDiskConnection parameter is NULL. |
|
The system cannot find the file specified by the hardDiskPath parameter. |
|
The system cannot find the path specified by the hardDiskPath parameter. |
|
The hardDiskPath parameter contains an invalid character (one of "*?<>/|":"). |
|
The hardDiskPath parameter specifies an empty or relative path. An absolute path is required. |
|
The path specified by the hardDiskPath parameter is too long. The path must be less than 260 characters. |
|
The configuration is unknown. |
|
Virtual machine is running or saved. |
|
The specified bus location is in use. |
|
The specified hard disk file is already connected to another bus location for this virtual machine. |
|
An unexpected error has occurred. |
Remarks
You can only add a new hard disk connection to a stopped virtual machine.
Requirements
Product |
Microsoft Virtual Server 2005 onWindows Server 2003 |
Download |
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003 |
Header |
|