diff --git a/docs/use-cases/using-SPDK-vhostuser-and-kata.md b/docs/use-cases/using-SPDK-vhostuser-and-kata.md index 4cef647ea2..ff6905a72d 100644 --- a/docs/use-cases/using-SPDK-vhostuser-and-kata.md +++ b/docs/use-cases/using-SPDK-vhostuser-and-kata.md @@ -1,4 +1,4 @@ -# Setup to run SPDK vhost-user devices with Kata Containers and Docker* +# Setup to run SPDK vhost-user devices with Kata Containers > **Note:** This guide only applies to QEMU, since the vhost-user storage > device is only available for QEMU now. The enablement work on other @@ -222,26 +222,43 @@ minor `0` should be created for it, in order to be recognized by Kata runtime: $ sudo mknod /var/run/kata-containers/vhost-user/block/devices/vhostblk0 b 241 0 ``` -> **Note:** The enablement of vhost-user block device in Kata containers -> is supported by Kata Containers `1.11.0-alpha1` or newer. -> Make sure you have updated your Kata containers before evaluation. - ## Launch a Kata container with SPDK vhost-user block device -To use `vhost-user-blk` device, use Docker to pass a host `vhost-user-blk` -device to the container. In docker, `--device=HOST-DIR:CONTAINER-DIR` is used +To use `vhost-user-blk` device, use `ctr` to pass a host `vhost-user-blk` +device to the container. In your `config.json`, you should use `devices` to pass a host device to the container. -For example: +For example (only `vhost-user-blk` listed): + +```json +{ + "linux": { + "devices": [ + { + "path": "/dev/vda", + "type": "b", + "major": 241, + "minor": 0, + "fileMode": 420, + "uid": 0, + "gid": 0 + } + ] + } +} +``` + +With `rootfs` provisioned under `bundle` directory, you can run your SPDK container: ```bash -$ sudo docker run --runtime kata-runtime --device=/var/run/kata-containers/vhost-user/block/devices/vhostblk0:/dev/vda -it busybox sh +$ sudo ctr run -d --runtime io.containerd.run.kata.v2 --config bundle/config.json spdk_container ``` Example of performing I/O operations on the `vhost-user-blk` device inside container: ``` +$ sudo ctr t exec --exec-id 1 -t spdk_container sh / # ls -l /dev/vda brw-r--r-- 1 root root 254, 0 Jan 20 03:54 /dev/vda / # dd if=/dev/vda of=/tmp/ddtest bs=4k count=20