[PATCH v1 0/5] qemu: Support iSER transport of iscsi

The iSER(iSCSI Extensions for RDMA) transport is introduced since QEMU 2.9 [1]. It is only valid in iscsi network disk. Note that for the legacy uri of iscsi iser transport, it will start with 'iser' instead of 'iscsi'. [1]: https://github.com/qemu/qemu/blob/ee573f5326046223b6eef4ae7fbfec31d274e093/q... git branch: https://gitlab.com/hhan2/libvirt/-/tree/iser Han Han (5): qemu_capabilities: Introduce iSER transport flag qemu: Support iser transport in iscsi docs: Support iser transport of iscsi tests: unit tests for iser transport news: qemu: Support iSER transport of iscsi docs/formatdomain.html.in | 10 +++-- docs/news.xml | 10 +++++ docs/schemas/domaincommon.rng | 1 + src/qemu/qemu_backup.c | 1 + src/qemu/qemu_block.c | 16 +++++-- src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 17 +++++++ src/qemu/qemu_monitor_json.c | 1 + src/storage/storage_file_gluster.c | 7 +++ src/util/virstoragefile.c | 26 +++++++---- src/util/virstoragefile.h | 1 + .../caps_2.10.0.aarch64.xml | 1 + .../caps_2.10.0.ppc64.xml | 1 + .../caps_2.10.0.s390x.xml | 1 + .../caps_2.10.0.x86_64.xml | 1 + .../caps_2.11.0.s390x.xml | 1 + .../caps_2.11.0.x86_64.xml | 1 + .../caps_2.12.0.aarch64.xml | 1 + .../caps_2.12.0.ppc64.xml | 1 + .../caps_2.12.0.s390x.xml | 1 + .../caps_2.12.0.x86_64.xml | 1 + .../qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 + .../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 + .../caps_2.9.0.x86_64.xml | 1 + .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1 + .../caps_3.0.0.riscv32.xml | 1 + .../caps_3.0.0.riscv64.xml | 1 + .../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 1 + .../caps_3.0.0.x86_64.xml | 1 + .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1 + .../caps_3.1.0.x86_64.xml | 1 + .../caps_4.0.0.aarch64.xml | 1 + .../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 + .../caps_4.0.0.riscv32.xml | 1 + .../caps_4.0.0.riscv64.xml | 1 + .../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 1 + .../caps_4.0.0.x86_64.xml | 1 + .../caps_4.1.0.x86_64.xml | 1 + .../caps_4.2.0.aarch64.xml | 1 + .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 + .../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 + .../caps_4.2.0.x86_64.xml | 1 + .../caps_5.0.0.aarch64.xml | 1 + .../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + .../caps_5.0.0.x86_64.xml | 1 + .../qemuxml2argvdata/disk-network-iscsi.args | 8 +++- .../disk-network-iscsi.x86_64-2.12.0.args | 7 ++- .../disk-network-iscsi.x86_64-latest.args | 45 +++++++++++-------- tests/qemuxml2argvdata/disk-network-iscsi.xml | 9 +++- tests/qemuxml2argvtest.c | 5 ++- .../qemuxml2xmloutdata/disk-network-iscsi.xml | 10 ++++- tests/qemuxml2xmltest.c | 4 +- tests/virstoragetest.c | 14 ++++++ 54 files changed, 188 insertions(+), 41 deletions(-) -- 2.25.0

Introduce the flag QEMU_CAPS_ISCSI_TRANSPORT_ISER for iSER(iSCSI Extensions for RDMA) transport of iscsi backend. Signed-off-by: Han Han <hhan@redhat.com> --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + 36 files changed, 37 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f6b3c96a..37dcf7cd 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -574,6 +574,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "virtio.packed", "pcie-root-port.hotplug", "aio.io_uring", + "iscsi.transport.iser", ); @@ -1463,6 +1464,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { { "query-named-block-nodes/arg-type/flat", QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT }, { "blockdev-snapshot/$allow-write-only-overlay", QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY }, { "blockdev-add/arg-type/+file/aio/^io_uring", QEMU_CAPS_AIO_IO_URING }, + { "blockdev-add/arg-type/+iscsi/transport/^iser", QEMU_CAPS_ISCSI_TRANSPORT_ISER }, }; typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 0e9a161f..fc2fad02 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -555,6 +555,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_VIRTIO_PACKED_QUEUES, /* virtio.packed */ QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG, /* pcie-root-port.hotplug */ QEMU_CAPS_AIO_IO_URING, /* -blockdev {...,"aio":"io_uring",...} */ + QEMU_CAPS_ISCSI_TRANSPORT_ISER, /* -blockdev {"driver":"iscsi","transport":"iser",...} */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml index f598b467..f7b67ff5 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml @@ -140,6 +140,7 @@ <flag name='vhost-vsock'/> <flag name='egl-headless'/> <flag name='iothread.poll-max-ns'/> + <flag name='iscsi.transport.iser'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700287</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml index b95a9d42..7b4f2c0d 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -140,6 +140,7 @@ <flag name='egl-headless'/> <flag name='iothread.poll-max-ns'/> <flag name='i8042'/> + <flag name='iscsi.transport.iser'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900287</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml index 04ac8729..6c9a4279 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -107,6 +107,7 @@ <flag name='query-cpu-model-baseline'/> <flag name='query-cpu-model-comparison'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100287</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml index 7ebe97b6..63581f29 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml @@ -183,6 +183,7 @@ <flag name='iothread.poll-max-ns'/> <flag name='x86-max-cpu'/> <flag name='i8042'/> + <flag name='iscsi.transport.iser'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100287</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml index 6d36a6e4..af4cc294 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml @@ -114,6 +114,7 @@ <flag name='query-cpu-model-baseline'/> <flag name='query-cpu-model-comparison'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>2011000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100288</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml index b8eb3abd..55228919 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml @@ -189,6 +189,7 @@ <flag name='iothread.poll-max-ns'/> <flag name='x86-max-cpu'/> <flag name='i8042'/> + <flag name='iscsi.transport.iser'/> <version>2011000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100288</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml index 64d8d495..ce6d8e04 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml @@ -156,6 +156,7 @@ <flag name='memory-backend-file.align'/> <flag name='arm-max-cpu'/> <flag name='drive-nvme'/> + <flag name='iscsi.transport.iser'/> <version>2012000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml index 38a3103c..5e508de6 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml @@ -154,6 +154,7 @@ <flag name='memory-backend-file.align'/> <flag name='drive-nvme'/> <flag name='i8042'/> + <flag name='iscsi.transport.iser'/> <version>2011090</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml index 21a168dd..b3a1dad1 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml @@ -126,6 +126,7 @@ <flag name='query-cpu-model-comparison'/> <flag name='drive-nvme'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>2012000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml index 0c30cc75..e6526ccf 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml @@ -198,6 +198,7 @@ <flag name='x86-max-cpu'/> <flag name='drive-nvme'/> <flag name='i8042'/> + <flag name='iscsi.transport.iser'/> <version>2011090</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml index 3bc6ec8d..49bfe565 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml @@ -132,6 +132,7 @@ <flag name='vhost-vsock'/> <flag name='iothread.poll-max-ns'/> <flag name='i8042'/> + <flag name='iscsi.transport.iser'/> <version>2009000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900247</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml index 9a6d94d3..9603a5e8 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml @@ -101,6 +101,7 @@ <flag name='query-cpu-model-baseline'/> <flag name='query-cpu-model-comparison'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>2009000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100247</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml index 83fc6cde..2d6246f8 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -177,6 +177,7 @@ <flag name='iothread.poll-max-ns'/> <flag name='x86-max-cpu'/> <flag name='i8042'/> + <flag name='iscsi.transport.iser'/> <version>2009000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100247</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml index 9a0b9c05..85b51c5f 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml @@ -156,6 +156,7 @@ <flag name='ramfb'/> <flag name='drive-nvme'/> <flag name='i8042'/> + <flag name='iscsi.transport.iser'/> <version>2012050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900239</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml b/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml index 6814a2f9..9ac4a147 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml @@ -96,6 +96,7 @@ <flag name='ramfb'/> <flag name='drive-nvme'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml index b81f5825..071d6bde 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml @@ -96,6 +96,7 @@ <flag name='ramfb'/> <flag name='drive-nvme'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml index 85cda120..e0e2f0a1 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml @@ -129,6 +129,7 @@ <flag name='ramfb'/> <flag name='drive-nvme'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100239</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml index 517e27d8..264931bc 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml @@ -204,6 +204,7 @@ <flag name='drive-nvme'/> <flag name='i8042'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100239</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml index 68010232..9fdbe3be 100644 --- a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml @@ -161,6 +161,7 @@ <flag name='drive-nvme'/> <flag name='i8042'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>3000091</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml index d901715f..10ceac33 100644 --- a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml @@ -207,6 +207,7 @@ <flag name='drive-nvme'/> <flag name='i8042'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>3000092</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml index 6fd1880a..004fca41 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml @@ -170,6 +170,7 @@ <flag name='arm-max-cpu'/> <flag name='drive-nvme'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml index f7e69fcc..95972054 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml @@ -175,6 +175,7 @@ <flag name='drive-nvme'/> <flag name='i8042'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml index 6a567239..d90ade53 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml @@ -171,6 +171,7 @@ <flag name='migration-file-drop-cache'/> <flag name='drive-nvme'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml index d6686b7c..a1c087eb 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml @@ -171,6 +171,7 @@ <flag name='migration-file-drop-cache'/> <flag name='drive-nvme'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml index 9dc29832..a7739055 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml @@ -137,6 +137,7 @@ <flag name='query-cpu-model-comparison'/> <flag name='drive-nvme'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml index ae4004ad..4dc62a1a 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -212,6 +212,7 @@ <flag name='drive-nvme'/> <flag name='i8042'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml index d9bdeb25..e597c1af 100644 --- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml @@ -218,6 +218,7 @@ <flag name='smp-dies'/> <flag name='i8042'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>4001000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index e994aa79..d92b7fa0 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -182,6 +182,7 @@ <flag name='storage.werror'/> <flag name='fsdev.multidevs'/> <flag name='virtio.packed'/> + <flag name='iscsi.transport.iser'/> <version>4001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 99ec98e8..c4416079 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -180,6 +180,7 @@ <flag name='i8042'/> <flag name='rng-builtin'/> <flag name='storage.werror'/> + <flag name='iscsi.transport.iser'/> <version>4001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index 058326ba..b44d771f 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -147,6 +147,7 @@ <flag name='storage.werror'/> <flag name='fsdev.multidevs'/> <flag name='virtio.packed'/> + <flag name='iscsi.transport.iser'/> <version>4002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index a1994603..c7b58f6f 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -226,6 +226,7 @@ <flag name='storage.werror'/> <flag name='fsdev.multidevs'/> <flag name='virtio.packed'/> + <flag name='iscsi.transport.iser'/> <version>4002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml index 3876d08c..23a12971 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -184,6 +184,7 @@ <flag name='storage.werror'/> <flag name='fsdev.multidevs'/> <flag name='virtio.packed'/> + <flag name='iscsi.transport.iser'/> <version>4002050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml index b0891613..7e4fc28a 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml @@ -192,6 +192,7 @@ <flag name='storage.werror'/> <flag name='fsdev.multidevs'/> <flag name='virtio.packed'/> + <flag name='iscsi.transport.iser'/> <version>4002050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml index 4058efdf..1da44474 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -231,6 +231,7 @@ <flag name='virtio.packed'/> <flag name='pcie-root-port.hotplug'/> <flag name='aio.io_uring'/> + <flag name='iscsi.transport.iser'/> <version>4002093</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100241</microcodeVersion> -- 2.25.0

The iscsi iser transport is introdcued since QEMU 2.9. For iscsi blockdev json, it will be shown at 'transport' field: 'json:{...,{"driver": "iscsi","transport":"iser",...}}' For legacy drive filename as iscsi uri, it will start with 'iser' scheme: iser://[[username][%<password>]@]<host>[:<port>]/<target-iqn-name>/<lun> By default, the iscsi transport is still tcp. Signed-off-by: Han Han <hhan@redhat.com> --- src/qemu/qemu_backup.c | 1 + src/qemu/qemu_block.c | 16 +++++++++++++--- src/qemu/qemu_command.c | 17 +++++++++++++++++ src/qemu/qemu_monitor_json.c | 1 + src/storage/storage_file_gluster.c | 7 +++++++ src/util/virstoragefile.c | 26 ++++++++++++++++++-------- src/util/virstoragefile.h | 1 + 7 files changed, 58 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 80fc5d77..caf0b4ce 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -88,6 +88,7 @@ qemuBackupPrepare(virDomainBackupDefPtr def) /* TODO: Do we need to mess with selinux? */ break; + case VIR_STORAGE_NET_HOST_TRANS_ISER: case VIR_STORAGE_NET_HOST_TRANS_RDMA: case VIR_STORAGE_NET_HOST_TRANS_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index d32277d7..003c18f1 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -418,10 +418,16 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src) if (VIR_ALLOC(uri) < 0) return NULL; - if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) { + if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP || + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_RDMA || + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) uri->port = src->hosts->port; + if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) { uri->scheme = g_strdup(virStorageNetProtocolTypeToString(src->protocol)); + } else if (src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI && + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) { + uri->scheme = g_strdup("iser"); } else { uri->scheme = g_strdup_printf("%s+%s", virStorageNetProtocolTypeToString(src->protocol), @@ -497,6 +503,7 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDefPtr host, return NULL; break; + case VIR_STORAGE_NET_HOST_TRANS_ISER: case VIR_STORAGE_NET_HOST_TRANS_RDMA: case VIR_STORAGE_NET_HOST_TRANS_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -743,6 +750,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src, { qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); g_autofree char *target = NULL; + const char *transport = NULL; char *lunStr = NULL; char *username = NULL; char *objalias = NULL; @@ -762,6 +770,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src, */ target = g_strdup(src->path); + transport = virStorageNetHostTransportTypeToString(src->hosts->transport); /* Separate the target and lun */ if ((lunStr = strchr(target, '/'))) { @@ -791,7 +800,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src, "s:portal", portal, "s:target", target, "u:lun", lun, - "s:transport", "tcp", + "s:transport", transport, "S:user", username, "S:password-secret", objalias, "S:initiator-name", src->initiator.iqn, @@ -2063,7 +2072,8 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src, /* generate simplified URIs for the easy cases */ if (actualType == VIR_STORAGE_TYPE_NETWORK && src->nhosts == 1 && - src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP && + (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP || + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) && src->timeout == 0 && src->ncookies == 0 && src->sslverify == VIR_TRISTATE_BOOL_ABSENT && diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 45dd8307..c5cf9401 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1443,6 +1443,16 @@ qemuCheckDiskConfig(virDomainDiskDefPtr disk, return -1; } } + + if (disk->src && + disk->src->hosts && + disk->src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ISCSI_TRANSPORT_ISER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iSCSI iser transport is not supported by this " + "QEMU binary")); + return -1; + } } if (disk->serial && @@ -4888,6 +4898,13 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev, qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(iscsisrc->src); + if (iscsisrc->src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ISCSI_TRANSPORT_ISER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support iSCSI iser transport")); + return NULL; + } + if (qemuDiskSourceNeedsProps(iscsisrc->src, qemuCaps)) { if (!(srcprops = qemuDiskSourceGetProps(iscsisrc->src))) return NULL; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 619717ea..338f66ef 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7199,6 +7199,7 @@ qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, case VIR_STORAGE_NET_HOST_TRANS_UNIX: addr = qemuMonitorJSONBuildUnixSocketAddress(server->socket); break; + case VIR_STORAGE_NET_HOST_TRANS_ISER: case VIR_STORAGE_NET_HOST_TRANS_RDMA: case VIR_STORAGE_NET_HOST_TRANS_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/storage/storage_file_gluster.c b/src/storage/storage_file_gluster.c index f389a944..73dfef0c 100644 --- a/src/storage/storage_file_gluster.c +++ b/src/storage/storage_file_gluster.c @@ -78,6 +78,13 @@ virStorageFileBackendGlusterInitServer(virStorageFileBackendGlusterPrivPtr priv, hoststr = host->socket; break; + case VIR_STORAGE_NET_HOST_TRANS_ISER: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid transport '%s' for gluster host"), + transport); + return -1; + break; + case VIR_STORAGE_NET_HOST_TRANS_LAST: break; } diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index ffc8bdb3..4f162f10 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -97,6 +97,7 @@ VIR_ENUM_IMPL(virStorageNetHostTransport, "tcp", "unix", "rdma", + "iser", ); VIR_ENUM_IMPL(virStorageSourcePoolMode, @@ -2839,10 +2840,15 @@ virStorageSourceParseBackingURI(virStorageSourcePtr src, if (!scheme[0] || (src->protocol = virStorageNetProtocolTypeFromString(scheme[0])) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid backing protocol '%s'"), - NULLSTR(scheme[0])); - return -1; + if (STRNEQ(scheme[0], "iser")) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid backing protocol '%s'"), + NULLSTR(scheme[0])); + return -1; + } + + src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI; + src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_ISER; } if (scheme[1] && @@ -3523,14 +3529,17 @@ virStorageSourceParseBackingJSONiSCSI(virStorageSourcePtr src, return -1; src->nhosts = 1; + src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_TCP; - if (STRNEQ_NULLABLE(transport, "tcp")) { + if (STRNEQ(transport, "tcp") && STRNEQ(transport, "iser") && transport) { virReportError(VIR_ERR_INVALID_ARG, "%s", - _("only TCP transport is supported for iSCSI volumes")); + _("only TCP or iSER transport is supported for iSCSI " + "volumes")); return -1; } - src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_TCP; + if (transport) + src->hosts->transport = virStorageNetHostTransportTypeFromString(transport); if (!portal) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -4710,7 +4719,8 @@ virStorageSourceNetworkAssignDefaultPorts(virStorageSourcePtr src) size_t i; for (i = 0; i < src->nhosts; i++) { - if (src->hosts[i].transport == VIR_STORAGE_NET_HOST_TRANS_TCP && + if ((src->hosts[i].transport == VIR_STORAGE_NET_HOST_TRANS_TCP || + src->hosts[i].transport == VIR_STORAGE_NET_HOST_TRANS_ISER) && src->hosts[i].port == 0) src->hosts[i].port = virStorageSourceNetworkDefaultPort(src->protocol); } diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 7939c09c..120d6190 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -146,6 +146,7 @@ typedef enum { VIR_STORAGE_NET_HOST_TRANS_TCP, VIR_STORAGE_NET_HOST_TRANS_UNIX, VIR_STORAGE_NET_HOST_TRANS_RDMA, + VIR_STORAGE_NET_HOST_TRANS_ISER, VIR_STORAGE_NET_HOST_TRANS_LAST } virStorageNetHostTransport; -- 2.25.0

On Mon, Apr 27, 2020 at 10:01:07 +0800, Han Han wrote:
The iscsi iser transport is introdcued since QEMU 2.9. For iscsi blockdev json, it will be shown at 'transport' field: 'json:{...,{"driver": "iscsi","transport":"iser",...}}'
For legacy drive filename as iscsi uri, it will start with 'iser' scheme: iser://[[username][%<password>]@]<host>[:<port>]/<target-iqn-name>/<lun>
By default, the iscsi transport is still tcp.
Signed-off-by: Han Han <hhan@redhat.com> --- src/qemu/qemu_backup.c | 1 + src/qemu/qemu_block.c | 16 +++++++++++++--- src/qemu/qemu_command.c | 17 +++++++++++++++++ src/qemu/qemu_monitor_json.c | 1 + src/storage/storage_file_gluster.c | 7 +++++++ src/util/virstoragefile.c | 26 ++++++++++++++++++-------- src/util/virstoragefile.h | 1 + 7 files changed, 58 insertions(+), 11 deletions(-)
[...]
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index d32277d7..003c18f1 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -418,10 +418,16 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src) if (VIR_ALLOC(uri) < 0) return NULL;
- if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) { + if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP || + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_RDMA || + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) uri->port = src->hosts->port;
RDMA is added here along with ISER. Please add it separately with proper justification and a test. Additionally I'm unsure that the design proposed in this patchset is entirely correct. According to the iSER protocol RFC 5046 iSER is meant as an extension to the iSCSI protocol. Specifically it's layered on top of any transport (called RCaP - "RDMA-Capable Protocol" in the RFC). https://tools.ietf.org/html/rfc5046#section-1.7 Trying to handle it as a transport is thus wrong ...
+ if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) { uri->scheme = g_strdup(virStorageNetProtocolTypeToString(src->protocol)); + } else if (src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI && + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) {
... and weird. E.g. this code could end-up formatting nbd+iser if the protocol is not iSCSI in the else branch below. I'm not even sure whether our use of 'rdma' makes sense, but iSER appropriated as a transport seems to be even worse. Unfortunately I don't have any other idea besides changing this to another network storage protocol rather than transport.
+ uri->scheme = g_strdup("iser"); } else { uri->scheme = g_strdup_printf("%s+%s", virStorageNetProtocolTypeToString(src->protocol), @@ -497,6 +503,7 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDefPtr host, return NULL; break;
+ case VIR_STORAGE_NET_HOST_TRANS_ISER: case VIR_STORAGE_NET_HOST_TRANS_RDMA: case VIR_STORAGE_NET_HOST_TRANS_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -743,6 +750,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src, { qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); g_autofree char *target = NULL; + const char *transport = NULL; char *lunStr = NULL; char *username = NULL; char *objalias = NULL; @@ -762,6 +770,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src, */
target = g_strdup(src->path); + transport = virStorageNetHostTransportTypeToString(src->hosts->transport);
/* Separate the target and lun */ if ((lunStr = strchr(target, '/'))) { @@ -791,7 +800,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src, "s:portal", portal, "s:target", target, "u:lun", lun, - "s:transport", "tcp", + "s:transport", transport, "S:user", username, "S:password-secret", objalias, "S:initiator-name", src->initiator.iqn, @@ -2063,7 +2072,8 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src, /* generate simplified URIs for the easy cases */ if (actualType == VIR_STORAGE_TYPE_NETWORK && src->nhosts == 1 && - src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP && + (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP || + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) && src->timeout == 0 && src->ncookies == 0 && src->sslverify == VIR_TRISTATE_BOOL_ABSENT && diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 45dd8307..c5cf9401 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1443,6 +1443,16 @@ qemuCheckDiskConfig(virDomainDiskDefPtr disk, return -1; } } + + if (disk->src && + disk->src->hosts && + disk->src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ISCSI_TRANSPORT_ISER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iSCSI iser transport is not supported by this " + "QEMU binary")); + return -1; + } }
If the design were okay, this would still require interlocking with other protocols.
if (disk->serial && @@ -4888,6 +4898,13 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev, qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(iscsisrc->src);
+ if (iscsisrc->src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ISCSI_TRANSPORT_ISER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support iSCSI iser transport")); + return NULL; + } + if (qemuDiskSourceNeedsProps(iscsisrc->src, qemuCaps)) { if (!(srcprops = qemuDiskSourceGetProps(iscsisrc->src))) return NULL;
[...]
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index ffc8bdb3..4f162f10 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -97,6 +97,7 @@ VIR_ENUM_IMPL(virStorageNetHostTransport, "tcp", "unix", "rdma", + "iser", );
VIR_ENUM_IMPL(virStorageSourcePoolMode, @@ -2839,10 +2840,15 @@ virStorageSourceParseBackingURI(virStorageSourcePtr src,
if (!scheme[0] || (src->protocol = virStorageNetProtocolTypeFromString(scheme[0])) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid backing protocol '%s'"), - NULLSTR(scheme[0])); - return -1; + if (STRNEQ(scheme[0], "iser")) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid backing protocol '%s'"), + NULLSTR(scheme[0])); + return -1; + } + + src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI; + src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_ISER; }
if (scheme[1] && @@ -3523,14 +3529,17 @@ virStorageSourceParseBackingJSONiSCSI(virStorageSourcePtr src, return -1;
src->nhosts = 1; + src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
- if (STRNEQ_NULLABLE(transport, "tcp")) { + if (STRNEQ(transport, "tcp") && STRNEQ(transport, "iser") && transport) {
If 'transport' is NULL, this will crash on the first strneq. You'd have to check it first.
virReportError(VIR_ERR_INVALID_ARG, "%s", - _("only TCP transport is supported for iSCSI volumes")); + _("only TCP or iSER transport is supported for iSCSI " + "volumes")); return -1; }
- src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_TCP; + if (transport) + src->hosts->transport = virStorageNetHostTransportTypeFromString(transport);
if (!portal) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -4710,7 +4719,8 @@ virStorageSourceNetworkAssignDefaultPorts(virStorageSourcePtr src) size_t i;
for (i = 0; i < src->nhosts; i++) { - if (src->hosts[i].transport == VIR_STORAGE_NET_HOST_TRANS_TCP && + if ((src->hosts[i].transport == VIR_STORAGE_NET_HOST_TRANS_TCP || + src->hosts[i].transport == VIR_STORAGE_NET_HOST_TRANS_ISER) &&
This would assume that iSER has addressing equal to TCP, but if layered on top of something else that might not be the case.
src->hosts[i].port == 0) src->hosts[i].port = virStorageSourceNetworkDefaultPort(src->protocol); }

On Mon, May 11, 2020 at 8:02 PM Peter Krempa <pkrempa@redhat.com> wrote:
On Mon, Apr 27, 2020 at 10:01:07 +0800, Han Han wrote:
The iscsi iser transport is introdcued since QEMU 2.9. For iscsi blockdev json, it will be shown at 'transport' field: 'json:{...,{"driver": "iscsi","transport":"iser",...}}'
For legacy drive filename as iscsi uri, it will start with 'iser' scheme: iser://[[username][%<password>]@]<host>[:<port>]/<target-iqn-name>/<lun>
By default, the iscsi transport is still tcp.
Signed-off-by: Han Han <hhan@redhat.com> --- src/qemu/qemu_backup.c | 1 + src/qemu/qemu_block.c | 16 +++++++++++++--- src/qemu/qemu_command.c | 17 +++++++++++++++++ src/qemu/qemu_monitor_json.c | 1 + src/storage/storage_file_gluster.c | 7 +++++++ src/util/virstoragefile.c | 26 ++++++++++++++++++-------- src/util/virstoragefile.h | 1 + 7 files changed, 58 insertions(+), 11 deletions(-)
[...]
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index d32277d7..003c18f1 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -418,10 +418,16 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src) if (VIR_ALLOC(uri) < 0) return NULL;
- if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) { + if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP || + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_RDMA || + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) uri->port = src->hosts->port;
RDMA is added here along with ISER. Please add it separately with proper justification and a test.
Additionally I'm unsure that the design proposed in this patchset is entirely correct. According to the iSER protocol RFC 5046 iSER is meant
I just simply adapted it to the qemu iser transport of iscsi: https://github.com/qemu/qemu/blob/d5c75ec500d96f1d93447f990cd5a4ef5ba27fae/q... Well, iSER is iSCSI specific, it will not be used in multiple protocols like tcp or unix transport. It is better to design that as an iscsi only attrib: <source protocol='iscsi' name='iqn.2013-07.com.example:iscsi-nopool/2' iser='yes'> ...
as an extension to the iSCSI protocol. Specifically it's layered on top of any transport (called RCaP - "RDMA-Capable Protocol" in the RFC).
https://tools.ietf.org/html/rfc5046#section-1.7
Trying to handle it as a transport is thus wrong ...
+ if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) { uri->scheme = g_strdup(virStorageNetProtocolTypeToString(src->protocol)); + } else if (src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI && + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) {
... and weird. E.g. this code could end-up formatting nbd+iser if the protocol is not iSCSI in the else branch below.
I'm not even sure whether our use of 'rdma' makes sense, but iSER appropriated as a transport seems to be even worse.
'rdma' network storage transport doesn't make sense for the qemu driver. It is only used in gluster. However, the struct BlockdevOptionsGluster has no attribs associated with rdma. For the legacy gluster uri scheme gluster+rdma, in fact it is the same as tcp transport: https://github.com/qemu/qemu/blob/762fa6d79aa30e1a713444da0399739423f8d00e/b... For the storage driver, I am not sure if gluster+rdma works.
Unfortunately I don't have any other idea besides changing this to another network storage protocol rather than transport.
+ uri->scheme = g_strdup("iser"); } else { uri->scheme = g_strdup_printf("%s+%s",
virStorageNetProtocolTypeToString(src->protocol),
@@ -497,6 +503,7 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDefPtr host, return NULL; break;
+ case VIR_STORAGE_NET_HOST_TRANS_ISER: case VIR_STORAGE_NET_HOST_TRANS_RDMA: case VIR_STORAGE_NET_HOST_TRANS_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -743,6 +750,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src, { qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); g_autofree char *target = NULL; + const char *transport = NULL; char *lunStr = NULL; char *username = NULL; char *objalias = NULL; @@ -762,6 +770,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src, */
target = g_strdup(src->path); + transport = virStorageNetHostTransportTypeToString(src->hosts->transport);
/* Separate the target and lun */ if ((lunStr = strchr(target, '/'))) { @@ -791,7 +800,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src, "s:portal", portal, "s:target", target, "u:lun", lun, - "s:transport", "tcp", + "s:transport", transport, "S:user", username, "S:password-secret", objalias, "S:initiator-name", src->initiator.iqn, @@ -2063,7 +2072,8 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src, /* generate simplified URIs for the easy cases */ if (actualType == VIR_STORAGE_TYPE_NETWORK && src->nhosts == 1 && - src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP && + (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP || + src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) && src->timeout == 0 && src->ncookies == 0 && src->sslverify == VIR_TRISTATE_BOOL_ABSENT && diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 45dd8307..c5cf9401 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1443,6 +1443,16 @@ qemuCheckDiskConfig(virDomainDiskDefPtr disk, return -1; } } + + if (disk->src && + disk->src->hosts && + disk->src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ISCSI_TRANSPORT_ISER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iSCSI iser transport is not supported by this " + "QEMU binary")); + return -1; + } }
If the design were okay, this would still require interlocking with other protocols.
if (disk->serial && @@ -4888,6 +4898,13 @@
qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(iscsisrc->src);
+ if (iscsisrc->src->hosts->transport ==
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ISCSI_TRANSPORT_ISER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support iSCSI iser
VIR_STORAGE_NET_HOST_TRANS_ISER && transport"));
+ return NULL; + } + if (qemuDiskSourceNeedsProps(iscsisrc->src, qemuCaps)) { if (!(srcprops = qemuDiskSourceGetProps(iscsisrc->src))) return NULL;
[...]
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index ffc8bdb3..4f162f10 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -97,6 +97,7 @@ VIR_ENUM_IMPL(virStorageNetHostTransport, "tcp", "unix", "rdma", + "iser", );
VIR_ENUM_IMPL(virStorageSourcePoolMode, @@ -2839,10 +2840,15 @@ virStorageSourceParseBackingURI(virStorageSourcePtr src,
if (!scheme[0] || (src->protocol = virStorageNetProtocolTypeFromString(scheme[0])) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid backing protocol '%s'"), - NULLSTR(scheme[0])); - return -1; + if (STRNEQ(scheme[0], "iser")) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid backing protocol '%s'"), + NULLSTR(scheme[0])); + return -1; + } + + src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI; + src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_ISER; }
if (scheme[1] && @@ -3523,14 +3529,17 @@ virStorageSourceParseBackingJSONiSCSI(virStorageSourcePtr src, return -1;
src->nhosts = 1; + src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
- if (STRNEQ_NULLABLE(transport, "tcp")) { + if (STRNEQ(transport, "tcp") && STRNEQ(transport, "iser") && transport) {
If 'transport' is NULL, this will crash on the first strneq. You'd have to check it first.
virReportError(VIR_ERR_INVALID_ARG, "%s", - _("only TCP transport is supported for iSCSI
volumes"));
+ _("only TCP or iSER transport is supported for iSCSI " + "volumes")); return -1; }
- src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_TCP; + if (transport) + src->hosts->transport = virStorageNetHostTransportTypeFromString(transport);
if (!portal) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -4710,7 +4719,8 @@ virStorageSourceNetworkAssignDefaultPorts(virStorageSourcePtr src) size_t i;
for (i = 0; i < src->nhosts; i++) { - if (src->hosts[i].transport == VIR_STORAGE_NET_HOST_TRANS_TCP && + if ((src->hosts[i].transport == VIR_STORAGE_NET_HOST_TRANS_TCP || + src->hosts[i].transport == VIR_STORAGE_NET_HOST_TRANS_ISER) &&
This would assume that iSER has addressing equal to TCP, but if layered on top of something else that might not be the case.
src->hosts[i].port == 0) src->hosts[i].port =
virStorageSourceNetworkDefaultPort(src->protocol);
}
-- Best regards, ----------------------------------- Han Han Quality Engineer Redhat. Email: hhan@redhat.com Phone: +861065339333

Signed-off-by: Han Han <hhan@redhat.com> --- docs/formatdomain.html.in | 10 ++++++---- docs/schemas/domaincommon.rng | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c5305739..ae3fcc8d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3327,10 +3327,12 @@ </table> <p> gluster supports "tcp", "rdma", "unix" as valid values for the - transport attribute. nbd supports "tcp" and "unix". Others only - support "tcp". If nothing is specified, "tcp" is assumed. If the - transport is "unix", the socket attribute specifies the path to an - AF_UNIX socket. + transport attribute. nbd supports "tcp" and "unix". iscsi supports + "tcp" and "iser" + <span class="since">Since libvirt 6.3.0(QEMU 2.9)</span>. Others + only support "tcp". If nothing is specified, "tcp" is assumed. + If the transport is "unix", the socket attribute specifies + the path to an AF_UNIX socket. </p> </dd> <dt><code>snapshot</code></dt> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 7f18e5b6..7ae9522e 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1725,6 +1725,7 @@ <choice> <value>tcp</value> <value>rdma</value> + <value>iser</value> </choice> </attribute> </optional> -- 2.25.0

Add xml2argv, xml2xml, backing metadata to xml tests for iscsi transport iser. Signed-off-by: Han Han <hhan@redhat.com> --- .../qemuxml2argvdata/disk-network-iscsi.args | 8 +++- .../disk-network-iscsi.x86_64-2.12.0.args | 7 ++- .../disk-network-iscsi.x86_64-latest.args | 45 +++++++++++-------- tests/qemuxml2argvdata/disk-network-iscsi.xml | 9 +++- tests/qemuxml2argvtest.c | 5 ++- .../qemuxml2xmloutdata/disk-network-iscsi.xml | 10 ++++- tests/qemuxml2xmltest.c | 4 +- tests/virstoragetest.c | 14 ++++++ 8 files changed, 76 insertions(+), 26 deletions(-) diff --git a/tests/qemuxml2argvdata/disk-network-iscsi.args b/tests/qemuxml2argvdata/disk-network-iscsi.args index 53b3821e..23ef32f2 100644 --- a/tests/qemuxml2argvdata/disk-network-iscsi.args +++ b/tests/qemuxml2argvdata/disk-network-iscsi.args @@ -30,7 +30,7 @@ server,nowait \ if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ --drive file=iscsi://example.org:6000/iqn.1992-01.com.example/1,format=raw,\ +-drive file=iser://example.org:6000/iqn.1992-01.com.example/1,format=raw,\ if=none,id=drive-virtio-disk1 \ -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,\ id=virtio-disk1 \ @@ -47,4 +47,8 @@ id=virtio-disk3 \ -drive file=iscsi://example.org:3260/iqn.1992-01.com.example/0,format=raw,\ if=none,id=drive-scsi0-0-0-0 \ -device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\ -drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 +drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \ +-drive file=iser://example.org:3260/iqn.1992-01.com.example/1,format=raw,\ +if=none,id=drive-scsi0-0-0-1 \ +-device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=1,\ +drive=drive-scsi0-0-0-1,id=scsi0-0-0-1 diff --git a/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-2.12.0.args b/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-2.12.0.args index 930d8d5d..b6b89912 100644 --- a/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-2.12.0.args +++ b/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-2.12.0.args @@ -34,7 +34,7 @@ if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ -drive file.driver=iscsi,file.portal=example.org:6000,\ -file.target=iqn.1992-01.com.example,file.lun=1,file.transport=tcp,format=raw,\ +file.target=iqn.1992-01.com.example,file.lun=1,file.transport=iser,format=raw,\ if=none,id=drive-virtio-disk1 \ -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,\ id=virtio-disk1 \ @@ -61,6 +61,11 @@ file.target=iqn.1992-01.com.example,file.lun=0,file.transport=tcp,format=raw,\ if=none,id=drive-scsi0-0-0-0 \ -device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\ drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \ +-drive file.driver=iscsi,file.portal=example.org:3260,\ +file.target=iqn.1992-01.com.example,file.lun=1,file.transport=iser,format=raw,\ +if=none,id=drive-scsi0-0-0-1 \ +-device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=1,\ +drive=drive-scsi0-0-0-1,id=scsi0-0-0-1 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-latest.args b/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-latest.args index 3f61f6dc..984b34dc 100644 --- a/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-latest.args @@ -31,47 +31,54 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x2 \ -blockdev '{"driver":"iscsi","portal":"example.org:6000",\ "target":"iqn.1992-01.com.example","lun":0,"transport":"tcp",\ +"node-name":"libvirt-6-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"raw",\ +"file":"libvirt-6-storage"}' \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=libvirt-6-format,\ +id=virtio-disk0,bootindex=1 \ +-blockdev '{"driver":"iscsi","portal":"example.org:6000",\ +"target":"iqn.1992-01.com.example","lun":1,"transport":"iser",\ "node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-5-format","read-only":false,"driver":"raw",\ "file":"libvirt-5-storage"}' \ --device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=libvirt-5-format,\ -id=virtio-disk0,bootindex=1 \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=libvirt-5-format,\ +id=virtio-disk1 \ +-object secret,id=libvirt-4-storage-auth-secret0,\ +data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ +keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \ -blockdev '{"driver":"iscsi","portal":"example.org:6000",\ -"target":"iqn.1992-01.com.example","lun":1,"transport":"tcp",\ +"target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp",\ +"user":"myname","password-secret":"libvirt-4-storage-auth-secret0",\ "node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"raw",\ "file":"libvirt-4-storage"}' \ --device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=libvirt-4-format,\ -id=virtio-disk1 \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=libvirt-4-format,\ +id=virtio-disk2 \ -object secret,id=libvirt-3-storage-auth-secret0,\ data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \ -blockdev '{"driver":"iscsi","portal":"example.org:6000",\ -"target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp",\ +"target":"iqn.1992-01.com.example:storage","lun":2,"transport":"tcp",\ "user":"myname","password-secret":"libvirt-3-storage-auth-secret0",\ "node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"raw",\ "file":"libvirt-3-storage"}' \ --device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=libvirt-3-format,\ -id=virtio-disk2 \ --object secret,id=libvirt-2-storage-auth-secret0,\ -data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ -keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \ --blockdev '{"driver":"iscsi","portal":"example.org:6000",\ -"target":"iqn.1992-01.com.example:storage","lun":2,"transport":"tcp",\ -"user":"myname","password-secret":"libvirt-2-storage-auth-secret0",\ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=libvirt-3-format,\ +id=virtio-disk3 \ +-blockdev '{"driver":"iscsi","portal":"example.org:3260",\ +"target":"iqn.1992-01.com.example","lun":0,"transport":"tcp",\ "node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"raw",\ "file":"libvirt-2-storage"}' \ --device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=libvirt-2-format,\ -id=virtio-disk3 \ +-device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\ +drive=libvirt-2-format,id=scsi0-0-0-0 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ -"target":"iqn.1992-01.com.example","lun":0,"transport":"tcp",\ +"target":"iqn.1992-01.com.example","lun":1,"transport":"iser",\ "node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw",\ "file":"libvirt-1-storage"}' \ --device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\ -drive=libvirt-1-format,id=scsi0-0-0-0 \ +-device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=1,\ +drive=libvirt-1-format,id=scsi0-0-0-1 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-network-iscsi.xml b/tests/qemuxml2argvdata/disk-network-iscsi.xml index 8a55f1b2..6a5d3b61 100644 --- a/tests/qemuxml2argvdata/disk-network-iscsi.xml +++ b/tests/qemuxml2argvdata/disk-network-iscsi.xml @@ -24,7 +24,7 @@ <disk type='network' device='disk'> <driver name='qemu' type='raw'/> <source protocol='iscsi' name='iqn.1992-01.com.example/1'> - <host name='example.org' port='6000'/> + <host name='example.org' port='6000' transport='iser'/> </source> <target dev='vdb' bus='virtio'/> </disk> @@ -55,6 +55,13 @@ </source> <target dev='sda' bus='scsi'/> </disk> + <disk type='network' device='lun'> + <driver name='qemu' type='raw'/> + <source protocol='iscsi' name='iqn.1992-01.com.example/1'> + <host name='example.org' transport='iser'/> + </source> + <target dev='sdb' bus='scsi'/> + </disk> <controller type='usb' index='0'/> <controller type='pci' index='0' model='pci-root'/> <controller type='scsi' index='0' model='virtio-scsi'/> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1a1b9026..76185f79 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1064,7 +1064,10 @@ mymain(void) DO_TEST("disk-network-nbd", NONE); DO_TEST_CAPS_VER("disk-network-nbd", "2.12.0"); DO_TEST_CAPS_LATEST("disk-network-nbd"); - DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_BLOCK); + DO_TEST("disk-network-iscsi", + QEMU_CAPS_VIRTIO_SCSI, + QEMU_CAPS_SCSI_BLOCK, + QEMU_CAPS_ISCSI_TRANSPORT_ISER); DO_TEST("disk-network-iscsi-modern", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_BLOCK, diff --git a/tests/qemuxml2xmloutdata/disk-network-iscsi.xml b/tests/qemuxml2xmloutdata/disk-network-iscsi.xml index 757b9b7b..2ff00891 100644 --- a/tests/qemuxml2xmloutdata/disk-network-iscsi.xml +++ b/tests/qemuxml2xmloutdata/disk-network-iscsi.xml @@ -25,7 +25,7 @@ <disk type='network' device='disk'> <driver name='qemu' type='raw'/> <source protocol='iscsi' name='iqn.1992-01.com.example/1'> - <host name='example.org' port='6000'/> + <host name='example.org' port='6000' transport='iser'/> </source> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> @@ -60,6 +60,14 @@ <target dev='sda' bus='scsi'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> + <disk type='network' device='lun'> + <driver name='qemu' type='raw'/> + <source protocol='iscsi' name='iqn.1992-01.com.example/1'> + <host name='example.org' port='3260' transport='iser'/> + </source> + <target dev='sdb' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='0' unit='1'/> + </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 4e43fa6f..70176df4 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -331,7 +331,9 @@ mymain(void) DO_TEST_CAPS_VER("disk-cache", "2.12.0"); DO_TEST_CAPS_LATEST("disk-cache"); DO_TEST("disk-network-nbd", NONE); - DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST("disk-network-iscsi", + QEMU_CAPS_VIRTIO_SCSI, + QEMU_CAPS_ISCSI_TRANSPORT_ISER); DO_TEST("disk-network-gluster", NONE); DO_TEST("disk-network-rbd", NONE); DO_TEST("disk-network-source-auth", NONE); diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 6d2b21c2..b5ae86c3 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1297,6 +1297,10 @@ mymain(void) "<source protocol='nbd' name='/exp'>\n" " <host transport='unix' socket='/tmp/sock'/>\n" "</source>\n"); + TEST_BACKING_PARSE("iser://example.org:1234/exportname", + "<source protocol='iscsi' name='exportname'>\n" + " <host name='example.org' port='1234' transport='iser'/>\n" + "</source>\n"); TEST_BACKING_PARSE_FULL("iscsi://testuser:testpass@example.org:1234/exportname", "<source protocol='iscsi' name='exportname'>\n" " <host name='example.org' port='1234'/>\n" @@ -1533,6 +1537,16 @@ mymain(void) "<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-noauth.target/0'>\n" " <host name='test.org' port='3260'/>\n" "</source>\n"); + TEST_BACKING_PARSE("json:{\"file\":{\"driver\":\"iscsi\"," + "\"transport\":\"iser\"," + "\"portal\":\"test.org\"," + "\"target\":\"iqn.2016-12.com.virttest:emulated-iscsi-noauth.target\"," + "\"lun\":\"1\"" + "}" + "}", + "<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-noauth.target/1'>\n" + " <host name='test.org' port='3260' transport='iser'/>\n" + "</source>\n"); TEST_BACKING_PARSE_FULL("json:{\"file\":{\"driver\":\"iscsi\"," "\"transport\":\"tcp\"," "\"portal\":\"test.org\"," -- 2.25.0

Signed-off-by: Han Han <hhan@redhat.com> --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 5835013c..60c1247f 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -44,6 +44,16 @@ <libvirt> <release version="v6.3.0" date="unreleased"> <section title="New features"> + <change> + <summary> + qemu: support iSER transport of iscsi + </summary> + <description> + The iSCSI Extensions for RDMA, also named iSER, is introduce to QEMU + since 2.9. In libvirt, it can be used by + <code>transport='iser'</code> in the host element of iscsi source. + </description> + </change> <change> <summary> qemu: support disabling hotplug/unplug of PCIe devices -- 2.25.0
participants (2)
-
Han Han
-
Peter Krempa