Add xml2argv, xml2xml, backing metadata to xml tests for iscsi transport
iser.
Signed-off-by: Han Han <hhan(a)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