mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2025-12-27 23:48:55 +00:00
vsock: rename the package to vhost-device-vsock
All other devices follow the "vhost-device-*" pattern, while for vsock we used "vhost-user-vsock". Let's rename this as well to be consistent. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
parent
540cc8758c
commit
df9094d94d
32
Cargo.lock
generated
32
Cargo.lock
generated
@ -1306,22 +1306,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vhost-user-backend"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3ea9d5e8ec847cde4df1c04e586698a479706fd6beca37323f9d425b24b4c2f"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"vhost",
|
||||
"virtio-bindings",
|
||||
"virtio-queue",
|
||||
"vm-memory",
|
||||
"vmm-sys-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vhost-user-vsock"
|
||||
name = "vhost-device-vsock"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
@ -1344,6 +1329,21 @@ dependencies = [
|
||||
"vmm-sys-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vhost-user-backend"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3ea9d5e8ec847cde4df1c04e586698a479706fd6beca37323f9d425b24b4c2f"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"vhost",
|
||||
"virtio-bindings",
|
||||
"virtio-queue",
|
||||
"vm-memory",
|
||||
"vmm-sys-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "virtio-bindings"
|
||||
version = "0.2.1"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "vhost-user-vsock"
|
||||
name = "vhost-device-vsock"
|
||||
version = "0.1.0"
|
||||
authors = ["Harshavardhan Unnibhavi <harshanavkis@gmail.com>", "Stefano Garzarella <sgarzare@redhat.com>"]
|
||||
description = "A virtio-vsock device using the vhost-user protocol."
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
# vhost-user-vsock
|
||||
# vhost-device-vsock
|
||||
|
||||
## Design
|
||||
|
||||
The crate introduces a vhost-user-vsock device that enables communication between an
|
||||
The crate introduces a vhost-device-vsock device that enables communication between an
|
||||
application running in the guest i.e inside a VM and an application running on the
|
||||
host i.e outside the VM. The application running in the guest communicates over VM
|
||||
sockets i.e over AF_VSOCK sockets. The application running on the host connects to a
|
||||
@ -38,28 +38,28 @@ the crate are split into various files as described below:
|
||||
|
||||
## Usage
|
||||
|
||||
Run the vhost-user-vsock device:
|
||||
Run the vhost-device-vsock device:
|
||||
```
|
||||
vhost-user-vsock --guest-cid=<CID assigned to the guest> \
|
||||
vhost-device-vsock --guest-cid=<CID assigned to the guest> \
|
||||
--socket=<path to the Unix socket to be created to communicate with the VMM via the vhost-user protocol> \
|
||||
--uds-path=<path to the Unix socket to communicate with the guest via the virtio-vsock device> \
|
||||
[--tx-buffer-size=<size of the buffer used for the TX virtqueue (guest->host packets)>]
|
||||
```
|
||||
or
|
||||
```
|
||||
vhost-user-vsock --vm guest_cid=<CID assigned to the guest>,socket=<path to the Unix socket to be created to communicate with the VMM via the vhost-user protocol>,uds-path=<path to the Unix socket to communicate with the guest via the virtio-vsock device>[,tx-buffer-size=<size of the buffer used for the TX virtqueue (guest->host packets)>]
|
||||
vhost-device-vsock --vm guest_cid=<CID assigned to the guest>,socket=<path to the Unix socket to be created to communicate with the VMM via the vhost-user protocol>,uds-path=<path to the Unix socket to communicate with the guest via the virtio-vsock device>[,tx-buffer-size=<size of the buffer used for the TX virtqueue (guest->host packets)>]
|
||||
```
|
||||
|
||||
Specify the `--vm` argument multiple times to specify multiple devices like this:
|
||||
```
|
||||
vhost-user-vsock \
|
||||
vhost-device-vsock \
|
||||
--vm guest-cid=3,socket=/tmp/vhost3.socket,uds-path=/tmp/vm3.vsock \
|
||||
--vm guest-cid=4,socket=/tmp/vhost4.socket,uds-path=/tmp/vm4.vsock,tx-buffer-size=32768
|
||||
```
|
||||
|
||||
Or use a configuration file:
|
||||
```
|
||||
vhost-user-vsock --config=<path to the local yaml configuration file>
|
||||
vhost-device-vsock --config=<path to the local yaml configuration file>
|
||||
```
|
||||
|
||||
Configuration file example:
|
||||
@ -89,11 +89,11 @@ qemu-system-x86_64 \
|
||||
## Working example
|
||||
|
||||
```sh
|
||||
shell1$ vhost-user-vsock --vm guest-cid=4,uds-path=/tmp/vm4.vsock,socket=/tmp/vhost4.socket
|
||||
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
|
||||
```sh
|
||||
shell1$ vhost-user-vsock --vm guest-cid=4,uds-path=/tmp/vm4.vsock,socket=/tmp/vhost4.socket,tx-buffer-size=65536
|
||||
shell1$ vhost-device-vsock --vm guest-cid=4,uds-path=/tmp/vm4.vsock,socket=/tmp/vhost4.socket,tx-buffer-size=65536
|
||||
```
|
||||
|
||||
```sh
|
||||
@ -148,7 +148,7 @@ If you add multiple VMs, they can communicate with each other. For example, if y
|
||||
CID 3 and 4, you can run the following commands to make them communicate:
|
||||
|
||||
```sh
|
||||
shell1$ vhost-user-vsock --vm guest-cid=3,uds-path=/tmp/vm3.vsock,socket=/tmp/vhost3.socket \
|
||||
shell1$ vhost-device-vsock --vm guest-cid=3,uds-path=/tmp/vm3.vsock,socket=/tmp/vhost3.socket \
|
||||
--vm guest-cid=4,uds-path=/tmp/vm4.vsock,socket=/tmp/vhost4.socket
|
||||
shell2$ qemu-system-x86_64 \
|
||||
-drive file=vm1.qcow2,format=qcow2,if=virtio -smp 2 -m 512M -mem-prealloc \
|
||||
|
||||
@ -185,7 +185,7 @@ impl TryFrom<VsockArgs> for Vec<VsockConfig> {
|
||||
}
|
||||
|
||||
/// This is the public API through which an external program starts the
|
||||
/// vhost-user-vsock backend server.
|
||||
/// vhost-device-vsock backend server.
|
||||
pub(crate) fn start_backend_server(
|
||||
config: VsockConfig,
|
||||
cid_map: Arc<RwLock<CidMap>>,
|
||||
@ -199,7 +199,7 @@ pub(crate) fn start_backend_server(
|
||||
let listener = Listener::new(config.get_socket_path(), true).unwrap();
|
||||
|
||||
let mut daemon = VhostUserDaemon::new(
|
||||
String::from("vhost-user-vsock"),
|
||||
String::from("vhost-device-vsock"),
|
||||
backend.clone(),
|
||||
GuestMemoryAtomic::new(GuestMemoryMmap::new()),
|
||||
)
|
||||
@ -453,7 +453,7 @@ mod tests {
|
||||
let backend = Arc::new(VhostUserVsockBackend::new(config, cid_map).unwrap());
|
||||
|
||||
let daemon = VhostUserDaemon::new(
|
||||
String::from("vhost-user-vsock"),
|
||||
String::from("vhost-device-vsock"),
|
||||
backend.clone(),
|
||||
GuestMemoryAtomic::new(GuestMemoryMmap::new()),
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user