[PATCH 2/2] qemu: Allow use of iothreads for virtio ccw disk definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Extending the iothread disk support from pci to pci and ccw.

Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
---
 docs/formatdomain.html.in                          |  6 ++--
 src/qemu/qemu_command.c                            |  8 +++--
 .../qemuxml2argv-iothreads-disk-virtio-ccw.args    | 14 +++++++++
 .../qemuxml2argv-iothreads-disk-virtio-ccw.xml     | 34 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  2 ++
 tests/qemuxml2xmltest.c                            |  1 +
 6 files changed, 60 insertions(+), 5 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-disk-virtio-ccw.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-disk-virtio-ccw.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0099ce7..ffc35a2 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -509,9 +509,9 @@
       <dd>
         The content of this optional element defines the number
         of IOThreads to be assigned to the domain for use by
-        virtio-blk-pci target storage devices. There should be
-        only 1 or 2 IOThreads per host CPU. There may be more than
-        supported device assigned to each IOThread.
+        virtio-blk-pci and virtio-blk-ccw target storage devices. There
+        should be only 1 or 2 IOThreads per host CPU. There may be more
+        than one supported device assigned to each IOThread.
       </dd>
     </dl>
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5b773ea..dd4c53d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3738,9 +3738,11 @@ qemuCheckIothreads(virDomainDefPtr def,
 
     /* Right "type" of disk" */
     if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO ||
-        disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
+        (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
+         disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("IOThreads only available for virtio pci disk"));
+                       _("IOThreads only available for virtio pci and "
+                         "virtio ccw disk"));
         return false;
     }
 
@@ -3952,6 +3954,8 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
     case VIR_DOMAIN_DISK_BUS_VIRTIO:
         if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
             virBufferAddLit(&opt, "virtio-blk-ccw");
+            if (disk->iothread)
+                virBufferAsprintf(&opt, ",iothread=iothread%u", disk->iothread);
         } else if (disk->info.type ==
                    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
             virBufferAddLit(&opt, "virtio-blk-s390");
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-iothreads-disk-virtio-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-iothreads-disk-virtio-ccw.args
new file mode 100644
index 0000000..d6c5c15
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-iothreads-disk-virtio-ccw.args
@@ -0,0 +1,14 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S \
+-M s390-ccw -m 214 -smp 1 \
+-object iothread,id=iothread1 \
+-object iothread,id=iothread2 \
+-nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,iothread=iothread1,devno=fe.0.0000,\
+drive=drive-virtio-disk0,id=virtio-disk0 \
+-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-virtio-disk1 \
+-device virtio-blk-ccw,iothread=iothread2,devno=0.0.0007,\
+drive=drive-virtio-disk1,id=virtio-disk1 \
+-device virtio-balloon-ccw,id=balloon0,devno=fe.0.000a
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-iothreads-disk-virtio-ccw.xml b/tests/qemuxml2argvdata/qemuxml2argv-iothreads-disk-virtio-ccw.xml
new file mode 100644
index 0000000..242ea8a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-iothreads-disk-virtio-ccw.xml
@@ -0,0 +1,34 @@
+<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>
+  <iothreads>2</iothreads>
+  <os>
+    <type arch='s390x' machine='s390-ccw'>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</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw' iothread='1'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='virtio'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw' iothread='2'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdb' bus='virtio'/>
+      <address type='ccw' cssid='0x0' ssid='0x0' devno='0x0007'/>
+    </disk>
+    <controller type='usb' index='0' model='none'/>
+    <memballoon model='virtio'>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x000a'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index abdf516..63e61bd 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1205,6 +1205,8 @@ mymain(void)
     DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD);
     DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD, QEMU_CAPS_DEVICE,
             QEMU_CAPS_DRIVE);
+    DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD, QEMU_CAPS_DEVICE,
+            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
 
     DO_TEST("cpu-topology1", QEMU_CAPS_SMP_TOPOLOGY);
     DO_TEST("cpu-topology2", QEMU_CAPS_SMP_TOPOLOGY);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 0ec4303..ca11e90 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -306,6 +306,7 @@ mymain(void)
     DO_TEST("iothreads");
     DO_TEST_DIFFERENT("cputune-iothreads");
     DO_TEST("iothreads-disk");
+    DO_TEST("iothreads-disk-virtio-ccw");
     DO_TEST("lease");
     DO_TEST("event_idx");
     DO_TEST("vhost_queues");
-- 
1.9.3


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]