共用方式為


IVMDVDDrive::SetBusLocation method

The SetBusLocation method attaches the DVD drive to the specified bus location in the virtual machine.

Syntax

HRESULT SetBusLocation(
  [in] VMDriveBusType busType,
  [in] long           busNumber,
  [in] long           deviceNumber
);

Parameters

busType [in]

Enumerated value designating the type of bus (IDE or SCSI) to which this drive is to be attached.

busNumber [in]

The bus number to which this drive is to be attached. For example, on an IDE bus, this number would represent whether to use the primary or secondary bus number.

deviceNumber [in]

The device number to which this drive is to be attached. For example, on an IDE bus, this number would represent whether to use the primary or secondary device location.

Return value

This method can return one of these values.

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_INVALIDARG
The bus location specified is not valid.
VM_E_VM_RUNNING
The bus location cannot be set while the virtual machine is running or in a saved state.
VM_E_DRIVE_BUS_LOC_IN_USE
Another device is already attached to the specified bus location.
VM_E_DRIVE_INVALID
The current drive could not be initialized.
VM_E_VM_UNKNOWN
The changes could not be written to the preferences file because the virtual machine for this drive could not be determined.
DISP_E_EXCEPTION
An unexpected error occurred.

Remarks

Virtual Server does not support attaching a DVD drive to a SCSI bus. A E_INVALIDARG error will be returned if the busType argument is set to vmDriveBusType_SCSI.

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

IVMDVDDrive

VMDriveBusType