VHOST-DEVICE-VSOCK(1)
β¨ NAME β¨
okay so bestie, say hi to vhost-device-vsock β a virtio-vsock device that speaks the vhost-user protocol π
it lives in section 1 of the General Commands Manual, so it's a real grown-up command, not some library situation.
π¦ SYNOPSIS π¦
vhost-device-vsock --socket SOCKET --uds-path UDS_PATH
πΈ DESCRIPTION πΈ
The vhost-device-vsock utility launches a daemon that sits there listening on SOCKET for incoming connections from vhost-user front-ends. Obsessed. The moment a connection lands and protocol negotiation finishes, it spins up a vhost-user backend instance. All the VIRTIO vsock device functionality is served up through the unix socket you name as UDS_PATH, and that's the socket a host-side application connects to. π«Ά
--help,-hβ prints the help information, bestie. the classic.--version,-Vβ prints version information β¨--guest-cid GUEST_CIDβ the context identifier of the guest, which uniquely identifies the device for its entire lifetime. default is3.--socket SOCKETβ the unix socket a hypervisor connects to so it can set up the control path with the device π₯--uds-path UDS_PATHβ the unix socket a host-side application connects to π--tx-buffer-size TX_BUFFER_SIZEβ how big the buffer used for the TX virtqueue is. default:65536.--queue-size QUEUE_SIZEβ the size of the vring queue. default:1024.--groups GROUPSβ the list of group names this device belongs to. a group is a set of devices that let sibling guests talk to each other π― default:"default".--config CONFIGβ load everything from a given configuration file.
NOTE: this conflicts with --vm. pick one, bestie, you can't have both π
--vm VMβ device parameters for a VM, written as comma separatedkey=valuepairs. you can pass this option multiple times to configure devices for multiple guests. the allowed keys are:guest_cidsocketuds_pathtx_buffer_sizequeue_sizegroup
NOTE: this conflicts with --config. yeah, same deal. one or the other π
π EXIT STATUS π
The vhost-device-vsock utility exits 0 when it succeeds, and >0 if an error occurs. no in-between, it's giving binary π
π EXAMPLES π
π Run the vhost-device-vsock device
vhost-device-vsock \
--vm \
guest_cid=<GUEST_CID>,\
socket=<SOCKET_PATH>,\
uds-path=<UDS_PATH>\
[,tx-buffer-size=<TX_SIZE>][,queue-size=<QUEUE_SIZE>][,groups=<GROUPS_LIST>]
Specify the --vm argument multiple times to specify multiple devices like this:
vhost-device-vsock \
--vm guest-cid=3,socket=/tmp/vhost3.socket,uds-path=/tmp/vm3.vsock,groups=group1+groupA \
--vm guest-cid=4,socket=/tmp/vhost4.socket,uds-path=/tmp/vm4.vsock,tx-buffer-size=32768,queue-size=256
Or use a configuration file:
vhost-device-vsock --config=<path to the local yaml configuration file>
Configuration file example in yaml format:
vms:
- guest_cid: 3
socket: /tmp/vhost3.socket
uds_path: /tmp/vm3.sock
tx_buffer_size: 65536
queue_size: 1024
groups: group1+groupA
- guest_cid: 4
socket: /tmp/vhost4.socket
uds_path: /tmp/vm4.sock
tx_buffer_size: 32768
queue_size: 256
groups: group2+groupB
π Run VMM (e.g. QEMU)
qemu-system-x86_64 \
<normal QEMU options> \
-object memory-backend-memfd,id=mem0,size=<Guest RAM size> \ # size == -m size
-machine <machine options>,memory-backend=mem0 \
-chardev socket,id=char0,reconnect=0,path=<vhost-user socket path> \
-device vhost-user-vsock-pci,chardev=char0
NOTE: With QEMU you have to use a shareable memory-backend such as memory-backend-memfd. no cap, it will not work otherwise.
π§ Working example
shell1$ vhost-device-vsock --vm guest-cid=4,uds-path=/tmp/vm4.vsock,socket=/tmp/vhost4.socket
or if you want to configure the TX buffer size and vring queue size
shell1$ vhost-device-vsock --vm guest-cid=4,uds-path=/tmp/vm4.vsock,socket=/tmp/vhost4.socket,tx-buffer-size=65536,queue-size=1024
shell2$ qemu-system-x86_64 \
-drive file=vm.qcow2,format=qcow2,if=virtio -smp 2 \
-object memory-backend-memfd,id=mem0,size=512M \
-machine q35,accel=kvm,memory-backend=mem0 \
-chardev socket,id=char0,reconnect=0,path=/tmp/vhost4.socket \
-device vhost-user-vsock-pci,chardev=char0
β STANDARDS β
- OASIS, Virtual I/O Device (VIRTIO), https://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html, July 01, 2022, Version 1.2.
- QEMU Project, Vhost-user Protocol, https://qemu.readthedocs.io/en/v9.0.0/interop/vhost-user.html, Undated, Unversioned.
π AUTHORS π
Copyright 2023β2024 π
Harshavardhan Unnibhavi <harshanavkis@gmail.com>>
Stefano Garzarella <sgarzare@redhat.com>
Released under Apache-2.0 OR BSD-3-Clause. (See files LICENSE-APACHE, LICENSE-BSD-3-Clause for full copyright and warranty notices.)
π Links
- Main repository: https://github.com/rust-vmm/vhost-device
- on crates.io: https://crates.io/crates/vhost-device-vsock
and that's the whole page, bestie π©· this one came from the Debian folks, dated July 24, 2024, and yeah it's the VHOST-DEVICE-VSOCK(1) manual β go configure some vsock devices, you're literally the main character now ππ
β¨
π¦ where this page comes from
- fedora 43: vhost-device-vsock 0.3.0-5.fc43 Β· Apache-2.0 AND (Apache-2.0 OR BSD-2-Clause OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT OR Zlib) AND BSD-3-Clause AND MIT AND (MIT OR Unlicense) AND MPL-2.0 AND Unicode-DFS-2016
- fedora 44: vhost-device-vsock 0.3.0-7.fc44 Β· Apache-2.0 AND (Apache-2.0 OR BSD-2-Clause OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT OR Zlib) AND BSD-3-Clause AND MIT AND (MIT OR Unlicense) AND MPL-2.0 AND Unicode-DFS-2016
- nixpkgs unstable: vhost-device-vsock 0.3.0
- ubuntu stonking: vhost-device-vsock 0.3.0-2 Β· Apache-2.0 AND BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms