The `exit_consumer` and `exit_notifier` fields are only used internally by the exit_event() method implementation or by send_exit_event() in the sound device. So, they do not need to be exposed in the public API of backend structures. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| LICENSE-APACHE | ||
| LICENSE-BSD-3-Clause | ||
| README.md | ||
vhost-device-rng - RNG emulation backend daemon
Description
This program is a vhost-user backend that emulates a VirtIO random number generator (RNG). It uses the host's random number generator pool, /dev/urandom by default but configurable at will, to satisfy requests from guests.
The daemon is designed to respect limitation on possible random generator hardware using the --max-bytes and --period options. As such 5 kilobyte per second would translate to "--max-bytes 5000 --period 1000". If an application requests more bytes than the allowed limit the thread will block until the start of a new period. The daemon will automatically split the available bandwidth equally between the guest when several threads are requested.
Though developed and tested with QEMU, the implementation is based on the vhost-user protocol and as such should be interoperable with other virtual machine managers. Please see below for working examples.
Synopsis
vhost-device-rng [OPTIONS] --socket-path <SOCKET>
Options
vhost-device-rng
-h, --help
Print help.
-s, --socket-path=PATH
Location of vhost-user Unix domain sockets, this path will be suffixed with
0,1,2..socket_count-1.
-f, --filename
Random number generator source file, defaults to /dev/urandom.
-c, --socket-count=INT
Number of guests (sockets) to attach to, default set to 1.
-p, --period
Rate, in milliseconds, at which the RNG hardware can generate random data.
Used in conjunction with the --max-bytes option.
-m, --max-bytes
In conjunction with the --period parameter, provides the maximum number of byte
per milliseconds a RNG device can generate.
Examples
The daemon should be started first:
::
host# vhost-device-rng --socket-path=/some/path/rng.sock -c 1 -m 512 -p 1000
Note that from the above command the socket path "/some/path/rng.sock0" will be created. This in turn needs to be communicated as a chardev socket to QEMU in order for the backend RNG device to communicate with the vhost RNG daemon:
::
host# qemu-system -M virt
-object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on
-chardev socket,path=/some/path/rng.sock0,id=rng0
-device vhost-user-rng-pci,chardev=rng0
-numa node,memdev=mem
...
License
This project is licensed under either of
- Apache License, Version 2.0
- BSD-3-Clause License