< QEMU < Devices

VirtIO is a platform for IO virtualization, common to several hypervisors (and QEMU).

The guest operating system needs specialized drivers to handle these devices.

Supported devices list

FunctionBusTypeDeviceUsage example
NetworkingPCI10Gb/svirtio-net-pci-net nic,model=virtio ...
StoragePCISCSIvirtio-scsi-pci-device virtio-scsi-pci -drive file=disk.img,if=none,id=hd0 -device scsi-hd,drive=hd0 ...
StoragePCICustomvirtio-blk-drive file=disk.img,if=virtio ...
MemoryPCIRAMvirtio-balloon-pci
SerialPCISerialvirtio-serial-pci
Random Number GeneratorPCIRNGvirtio-rng-pcivirtio-rng-pci

virtio-rng-pci

Entropy sources

To set up a VirtIO RNG, you first need to provide a source of entropy for it.

For devices exported by the kernel on UNIX-like systems, you can do so like this:
-object rng-random,filename=/dev/random,id=rng0

It is obviously not limited to the kernel RNG, you can choose a hardware RNG too in the very same way.

It also supports EGD, though it is not recommended because of its poor performance.
Example: -chardev socket,host=10.199.13.151,port=9000,id=chr0 -object rng-egd,chardev=chr0,id=rng0

Adding the actual device

Then you can add the actual device, like this: -device virtio-rng-pci,rng=rng0

There's also an option to limit the amount of data the guest received, to avoid starving the host.
Example: max-bytes=512,period=1000 for 512 bytes/s.

Supported Guest Systems

OSDrivers
Microsoft Windowshttp://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers
Linux-based2.6.x, 3.x, 4.x
FreeBSD9.x (available), 10.x (in GENERIC kernel) https://www.freebsd.org/cgi/man.cgi?query=virtio&sektion=4
NetBSD6.0+
OpenBSD5.9+
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.