diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b184cb24..522e673be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,6 +115,17 @@ Two additional parameters were added to spdk_sock_get_addr() for the server port and client port. These parameters are named "sport" and "cport" respectively. +### Virtio + +The following RPC commands have been deprecated: + - construct_virtio_user_scsi_bdev + - construct_virtio_pci_scsi_bdev + - construct_virtio_user_blk_bdev + - construct_virtio_pci_blk_bdev + +They're replaced with a single `construct_virtio_dev` command that can create +any type of Virtio bdev(s). + ## v18.07: ### bdev diff --git a/doc/bdev.md b/doc/bdev.md index cdddc3af7..5c9114675 100644 --- a/doc/bdev.md +++ b/doc/bdev.md @@ -388,15 +388,22 @@ To remove a block device representation use the delete_pmem_bdev command. # Virtio Block {#bdev_config_virtio_blk} -The Virtio-Block driver can expose an SPDK bdev from a Virtio-Block device. +The Virtio-Block driver allows creating SPDK bdevs from Virtio-Block devices. -Virtio-Block bdevs are constructed the same way as Virtio-SCSI ones. +The following command creates a Virtio-Block device named `VirtioBlk0` from a vhost-user +socket `/tmp/vhost.0` exposed directly by SPDK @ref vhost. Optional `vq-count` and +`vq-size` params specify number of request queues and queue depth to be used. -`rpc.py construct_virtio_user_blk_bdev /tmp/virtio.0 VirtioBlk0 --vq-count 2 --vq-size 512` +`rpc.py construct_virtio_dev --dev-type blk --trtype user --traddr /tmp/vhost.0 --vq-count 2 --vq-size 512 VirtioBlk0` -`rpc.py construct_virtio_pci_blk_bdev 0000:01:00.0 VirtioBlk1` +The driver can be also used inside QEMU-based VMs. The following command creates a Virtio +Block device named `VirtioBlk0` from a Virtio PCI device at address `0000:00:01.0`. +The entire configuration will be read automatically from PCI Configuration Space. It will +reflect all parameters passed to QEMU's vhost-user-scsi-pci device. -Virtio-BLK devices can be removed with the following command +`rpc.py construct_virtio_dev --dev-type blk --trtype pci --traddr 0000:01:00.0 VirtioBlk1` + +Virtio-Block devices can be removed with the following command `rpc.py remove_virtio_bdev VirtioBlk0` @@ -404,18 +411,11 @@ Virtio-BLK devices can be removed with the following command The Virtio-SCSI driver allows creating SPDK block devices from Virtio-SCSI LUNs. -The following command creates a Virtio-SCSI device named `VirtioScsi0` from a vhost-user -socket `/tmp/vhost.0` exposed directly by SPDK @ref vhost. Optional `vq-count` and -`vq-size` params specify number of request queues and queue depth to be used. +Virtio-SCSI bdevs are constructed the same way as Virtio-Block ones. -`rpc.py construct_virtio_user_scsi_bdev /tmp/vhost.0 VirtioScsi0 --vq-count 2 --vq-size 512` +`rpc.py construct_virtio_dev --dev-type scsi --trtype user --traddr /tmp/vhost.0 --vq-count 2 --vq-size 512 VirtioScsi0` -The driver can be also used inside QEMU-based VMs. The following command creates a Virtio -SCSI device named `VirtioScsi0` from a Virtio PCI device at address `0000:00:01.0`. -The entire configuration will be read automatically from PCI Configuration Space. It will -reflect all parameters passed to QEMU's vhost-user-scsi-pci device. - -`rpc.py construct_virtio_pci_scsi_bdev 0000:00:01.0 VirtioScsi0` +`rpc.py construct_virtio_dev --dev-type scsi --trtype pci --traddr 0000:01:00.0 VirtioScsi0` Each Virtio-SCSI device may export up to 64 block devices named VirtioScsi0t0 ~ VirtioScsi0t63, one LUN (LUN0) per SCSI device. The above 2 commands will output names of all exposed bdevs. diff --git a/lib/bdev/virtio/bdev_virtio_rpc.c b/lib/bdev/virtio/bdev_virtio_rpc.c index 587eeedf9..96f6d795f 100644 --- a/lib/bdev/virtio/bdev_virtio_rpc.c +++ b/lib/bdev/virtio/bdev_virtio_rpc.c @@ -109,6 +109,9 @@ spdk_rpc_create_virtio_user_scsi_bdev(struct spdk_jsonrpc_request *request, struct rpc_construct_virtio_scsi_dev *req; int rc; + SPDK_WARNLOG("construct_virtio_user_scsi_bdev command has been deprecated and will be removed " + "in the subsequent release. Please use construct_virtio_dev instead.\n"); + req = calloc(1, sizeof(*req)); if (!req) { rc = -ENOMEM; @@ -156,6 +159,9 @@ spdk_rpc_construct_virtio_pci_scsi_dev(struct spdk_jsonrpc_request *request, struct spdk_pci_addr pci_addr; int rc; + SPDK_WARNLOG("construct_virtio_pci_scsi_bdev command has been deprecated and will be removed " + "in the subsequent release. Please use construct_virtio_dev instead.\n"); + req = calloc(1, sizeof(*req)); if (!req) { rc = -ENOMEM; @@ -366,6 +372,9 @@ spdk_rpc_create_virtio_user_blk_bdev(struct spdk_jsonrpc_request *request, req.vq_count = SPDK_VIRTIO_USER_DEFAULT_VQ_COUNT; req.vq_size = SPDK_VIRTIO_USER_DEFAULT_QUEUE_SIZE; + SPDK_WARNLOG("construct_virtio_user_blk_bdev command has been deprecated and will be removed " + "in the subsequent release. Please use construct_virtio_dev instead.\n"); + if (spdk_json_decode_object(params, rpc_construct_virtio_user_blk_dev, SPDK_COUNTOF(rpc_construct_virtio_user_blk_dev), &req)) { @@ -414,6 +423,9 @@ spdk_rpc_create_virtio_pci_blk_bdev(struct spdk_jsonrpc_request *request, req.pci_address = NULL; + SPDK_WARNLOG("construct_virtio_pci_blk_bdev command has been deprecated and will be removed " + "in the subsequent release. Please use construct_virtio_dev instead.\n"); + if (spdk_json_decode_object(params, rpc_construct_virtio_pci_blk_dev, SPDK_COUNTOF(rpc_construct_virtio_pci_blk_dev), &req)) {