Virtuozzo Virtualization SDK C API Reference
The PrlVmCfg_AddDefaultDevice function automates the task of setting devices in a virtual machine.
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.