[libvirt] [PATCH 13/24] tests: qemu: Unify iscsi disk source testing

Peter Krempa pkrempa at redhat.com
Thu Jul 19 15:51:05 UTC 2018


Move various different iSCSI configuration into one test file.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 .../qemuxml2argvdata/disk-network-iscsi-auth.args  | 34 ----------------
 tests/qemuxml2argvdata/disk-network-iscsi-auth.xml | 43 --------------------
 tests/qemuxml2argvdata/disk-network-iscsi-lun.args | 29 -------------
 tests/qemuxml2argvdata/disk-network-iscsi-lun.xml  | 28 -------------
 tests/qemuxml2argvdata/disk-network-iscsi.args     | 21 ++++++++--
 tests/qemuxml2argvdata/disk-network-iscsi.xml      | 28 +++++++++++++
 tests/qemuxml2argvtest.c                           |  6 +--
 .../qemuxml2xmloutdata/disk-network-iscsi-auth.xml | 47 ----------------------
 tests/qemuxml2xmloutdata/disk-network-iscsi.xml    | 37 ++++++++++++++++-
 tests/qemuxml2xmltest.c                            |  3 +-
 10 files changed, 83 insertions(+), 193 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/disk-network-iscsi-auth.args
 delete mode 100644 tests/qemuxml2argvdata/disk-network-iscsi-auth.xml
 delete mode 100644 tests/qemuxml2argvdata/disk-network-iscsi-lun.args
 delete mode 100644 tests/qemuxml2argvdata/disk-network-iscsi-lun.xml
 delete mode 100644 tests/qemuxml2xmloutdata/disk-network-iscsi-auth.xml

diff --git a/tests/qemuxml2argvdata/disk-network-iscsi-auth.args b/tests/qemuxml2argvdata/disk-network-iscsi-auth.args
deleted file mode 100644
index 423b6b2a8f..0000000000
--- a/tests/qemuxml2argvdata/disk-network-iscsi-auth.args
+++ /dev/null
@@ -1,34 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/home/test \
-USER=test \
-LOGNAME=test \
-QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-i686 \
--name QEMUGuest1 \
--S \
--machine pc,accel=tcg,usb=off,dump-guest-core=off \
--m 214 \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
-server,nowait \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--no-acpi \
--boot c \
--usb \
--drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org:\
-6000/iqn.1992-01.com.example%3Astorage/1,format=raw,if=none,\
-id=drive-virtio-disk0 \
--device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
-id=virtio-disk0 \
--drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org:\
-6000/iqn.1992-01.com.example%3Astorage/2,format=raw,if=none,\
-id=drive-virtio-disk1 \
--device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,\
-id=virtio-disk1
diff --git a/tests/qemuxml2argvdata/disk-network-iscsi-auth.xml b/tests/qemuxml2argvdata/disk-network-iscsi-auth.xml
deleted file mode 100644
index 63919f1000..0000000000
--- a/tests/qemuxml2argvdata/disk-network-iscsi-auth.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</currentMemory>
-  <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>hvm</type>
-    <boot dev='hd'/>
-  </os>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/bin/qemu-system-i686</emulator>
-    <disk type='network' device='disk'>
-      <driver name='qemu' type='raw'/>
-      <auth username='myname'>
-        <secret type='iscsi' usage='mycluster_myname'/>
-      </auth>
-      <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1'>
-        <host name='example.org' port='6000'/>
-      </source>
-      <target dev='vda' bus='virtio'/>
-    </disk>
-    <disk type='network' device='disk'>
-      <driver name='qemu' type='raw'/>
-      <auth username='myname'>
-        <secret type='iscsi' usage='mycluster_myname'/>
-      </auth>
-      <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
-        <host name='example.org' port='6000'/>
-      </source>
-      <target dev='vdb' bus='virtio'/>
-    </disk>
-    <controller type='usb' index='0'/>
-    <controller type='pci' index='0' model='pci-root'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <memballoon model='none'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvdata/disk-network-iscsi-lun.args b/tests/qemuxml2argvdata/disk-network-iscsi-lun.args
deleted file mode 100644
index 96601ae29e..0000000000
--- a/tests/qemuxml2argvdata/disk-network-iscsi-lun.args
+++ /dev/null
@@ -1,29 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/home/test \
-USER=test \
-LOGNAME=test \
-QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-i686 \
--name QEMUGuest1 \
--S \
--machine pc,accel=tcg,usb=off,dump-guest-core=off \
--m 214 \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
-server,nowait \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--no-acpi \
--boot c \
--device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 \
--usb \
--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
diff --git a/tests/qemuxml2argvdata/disk-network-iscsi-lun.xml b/tests/qemuxml2argvdata/disk-network-iscsi-lun.xml
deleted file mode 100644
index 3e8408044b..0000000000
--- a/tests/qemuxml2argvdata/disk-network-iscsi-lun.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</currentMemory>
-  <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>hvm</type>
-    <boot dev='hd'/>
-  </os>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/bin/qemu-system-i686</emulator>
-    <disk type='network' device='lun'>
-      <driver name='qemu' type='raw'/>
-      <source protocol='iscsi' name='iqn.1992-01.com.example'>
-        <host name='example.org' port='3260'/>
-      </source>
-      <target dev='sda' bus='scsi'/>
-    </disk>
-    <controller type='usb' index='0'/>
-    <controller type='scsi' index='0' model='virtio-scsi'/>
-    <memballoon model='none'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvdata/disk-network-iscsi.args b/tests/qemuxml2argvdata/disk-network-iscsi.args
index 8cf2810b7f..f68296586d 100644
--- a/tests/qemuxml2argvdata/disk-network-iscsi.args
+++ b/tests/qemuxml2argvdata/disk-network-iscsi.args
@@ -21,12 +21,27 @@ server,nowait \
 -no-shutdown \
 -no-acpi \
 -boot c \
+-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 \
 -usb \
 -drive file=iscsi://example.org:6000/iqn.1992-01.com.example/0,format=raw,\
 if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
+-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
 id=virtio-disk0 \
 -drive file=iscsi://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=0x4,drive=drive-virtio-disk1,\
-id=virtio-disk1
+-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,\
+id=virtio-disk1 \
+-drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org:\
+6000/iqn.1992-01.com.example%3Astorage/1,format=raw,if=none,\
+id=drive-virtio-disk2 \
+-device virtio-blk-pci,bus=pci.0,addr=0x6,drive=drive-virtio-disk2,\
+id=virtio-disk2 \
+-drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org:\
+6000/iqn.1992-01.com.example%3Astorage/2,format=raw,if=none,\
+id=drive-virtio-disk3 \
+-device virtio-blk-pci,bus=pci.0,addr=0x7,drive=drive-virtio-disk3,\
+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
diff --git a/tests/qemuxml2argvdata/disk-network-iscsi.xml b/tests/qemuxml2argvdata/disk-network-iscsi.xml
index be1b4f9d81..fa2a889b54 100644
--- a/tests/qemuxml2argvdata/disk-network-iscsi.xml
+++ b/tests/qemuxml2argvdata/disk-network-iscsi.xml
@@ -28,8 +28,36 @@
       </source>
       <target dev='vdb' bus='virtio'/>
     </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <auth username='myname'>
+        <secret type='iscsi' usage='mycluster_myname'/>
+      </auth>
+      <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vdc' bus='virtio'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <auth username='myname'>
+        <secret type='iscsi' usage='mycluster_myname'/>
+      </auth>
+      <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vdd' bus='virtio'/>
+    </disk>
+    <disk type='network' device='lun'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='iscsi' name='iqn.1992-01.com.example'>
+        <host name='example.org' port='3260'/>
+      </source>
+      <target dev='sda' bus='scsi'/>
+    </disk>
     <controller type='usb' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='scsi' index='0' model='virtio-scsi'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 03430c2324..31e992b989 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1041,14 +1041,10 @@ mymain(void)
     DO_TEST("disk-network-nbd-ipv6", NONE);
     DO_TEST("disk-network-nbd-ipv6-export", NONE);
     DO_TEST("disk-network-nbd-unix", NONE);
-    DO_TEST("disk-network-iscsi", NONE);
-    DO_TEST("disk-network-iscsi-auth", NONE);
+    DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_BLOCK);
     DO_TEST_PARSE_ERROR("disk-network-iscsi-auth-secrettype-invalid", NONE);
     DO_TEST_PARSE_ERROR("disk-network-iscsi-auth-wrong-secrettype", NONE);
     DO_TEST_PARSE_ERROR("disk-network-source-auth-both", NONE);
-    DO_TEST("disk-network-iscsi-lun",
-            QEMU_CAPS_VIRTIO_SCSI,
-            QEMU_CAPS_SCSI_BLOCK);
     DO_TEST("disk-network-gluster",
             QEMU_CAPS_GLUSTER_DEBUG_LEVEL);
     DO_TEST("disk-network-rbd", NONE);
diff --git a/tests/qemuxml2xmloutdata/disk-network-iscsi-auth.xml b/tests/qemuxml2xmloutdata/disk-network-iscsi-auth.xml
deleted file mode 100644
index 543b26e457..0000000000
--- a/tests/qemuxml2xmloutdata/disk-network-iscsi-auth.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</currentMemory>
-  <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>hvm</type>
-    <boot dev='hd'/>
-  </os>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/bin/qemu-system-i686</emulator>
-    <disk type='network' device='disk'>
-      <driver name='qemu' type='raw'/>
-      <auth username='myname'>
-        <secret type='iscsi' usage='mycluster_myname'/>
-      </auth>
-      <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1'>
-        <host name='example.org' port='6000'/>
-      </source>
-      <target dev='vda' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
-    </disk>
-    <disk type='network' device='disk'>
-      <driver name='qemu' type='raw'/>
-      <auth username='myname'>
-        <secret type='iscsi' usage='mycluster_myname'/>
-      </auth>
-      <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
-        <host name='example.org' port='6000'/>
-      </source>
-      <target dev='vdb' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
-    </disk>
-    <controller type='usb' index='0'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
-    </controller>
-    <controller type='pci' index='0' model='pci-root'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <memballoon model='none'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/disk-network-iscsi.xml b/tests/qemuxml2xmloutdata/disk-network-iscsi.xml
index 694412b5c7..f1348d583e 100644
--- a/tests/qemuxml2xmloutdata/disk-network-iscsi.xml
+++ b/tests/qemuxml2xmloutdata/disk-network-iscsi.xml
@@ -20,7 +20,7 @@
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vda' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </disk>
     <disk type='network' device='disk'>
       <driver name='qemu' type='raw'/>
@@ -28,12 +28,45 @@
         <host name='example.org' port='6000'/>
       </source>
       <target dev='vdb' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <auth username='myname'>
+        <secret type='iscsi' usage='mycluster_myname'/>
+      </auth>
+      <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vdc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </disk>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <auth username='myname'>
+        <secret type='iscsi' usage='mycluster_myname'/>
+      </auth>
+      <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vdd' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </disk>
+    <disk type='network' device='lun'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='iscsi' name='iqn.1992-01.com.example/0'>
+        <host name='example.org' port='3260'/>
+      </source>
+      <target dev='sda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2ba55f3a92..edba1ca99d 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -363,8 +363,7 @@ mymain(void)
     DO_TEST("disk-network-nbd-ipv6", NONE);
     DO_TEST("disk-network-nbd-ipv6-export", NONE);
     DO_TEST("disk-network-nbd-unix", NONE);
-    DO_TEST("disk-network-iscsi", NONE);
-    DO_TEST("disk-network-iscsi-auth", NONE);
+    DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI);
     DO_TEST("disk-network-gluster", NONE);
     DO_TEST("disk-network-rbd", NONE);
     DO_TEST("disk-network-rbd-auth", NONE);
-- 
2.16.2




More information about the libvir-list mailing list