Collapse All
Virtuozzo Virtualization SDK C API Reference
ContentsIndex
PreviousUpNext
PrlVmCfg_AddDefaultDevice Function
PHT_VM_CONFIGURATION

The PrlVmCfg_AddDefaultDevice function automates the task of setting devices in a virtual machine.

Syntax
PRL_RESULT PrlVmCfg_AddDefaultDevice(
    PRL_HANDLE hVmCfg, 
    PRL_HANDLE hSrvConfig, 
    PRL_DEVICE_TYPE deviceType
);
File

PrlApiVm.h

Parameters

hVmCfg
A handle of type PHT_VM_CONFIGURATION identifying the virtual machine configuration.
hSrvConfig
A handle of type PHT_SERVER_CONFIG containing the host machine configuration information. If this parameter is set to PRL_INVALID_HANDLE, the device of the specified type will be configured as pure virtual (i.e. it will not be mapped to a physical device on the host).
deviceType
The type of the device to set.

Returns

PRL_RESULT. Possible values: 

PRL_ERR_INVALID_ARG - invalid handle or null pointer was passed. 

PRL_ERR_OPERATION_FAILED - unable to set a device of the specified type. 

PRL_ERR_SUCCESS - function completed successfully. 

Remarks

When creating or modifying a virtual machine configuration, one must choose if a device of a particular type will be a pure virtual device or if it will be mapped to a physical device on the host. To make a device pure virtual, set the hSrvConfig parameter value to PRL_INVALID_HANDLE. To map a virtual device to a physical device, obtain an object of type PHT_SERVER_CONFIG and pass it to the function using the hSrvConfig parameter. If multiple physical devices of the specified type exist on the host, the destination physical device will be chosen randomly by the function. 

The virtual devices that can be mapped to physical devices include floppy disk drives, CD drives, serial and parallel ports, and sound devices. The devices that can exist only as pure virtual include hard disk drives, network adapters, and USB devices. To determine if a device of particular type must be added to a virtual machine, use the PrlVmCfg_IsDefaultDeviceNeeded function. 

Before calling this function, you must execute the PrlVm_BeginEdit function. After the PrlVmCfg_AddDefaultDevice function returns, you must call the PrlVm_Commit to save the changes in the virtual machine configuration.

Links
Copyright ©2016-2017 Parallels International GmbH. All rights reserved.