Skip to contentSkip to conversation

iotests: cure s390x failures by switching to ccw/aliases

PATCH In review Cornelia Huck 5 participants 11 messages Sep 13, 2017 – Sep 15, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover iotests: cure s390x failures by switching to ccw/aliases

Recent changes in s390x made pci support dependant on the zpci cpu feature, which is not provided on all models (and not on by default). This means we cannot instatiate pci devices on a standard qemu invocation for s390x. Moreover, the zpci instructions are not even wired up for tcg yet, so actually doing anything with those pci devices is bound to fail on tcg.

For 040, 051, 139, and 182, this can be fixed by switching to virtio-ccw from virtio-pci on s390x. 051 also needs a bit of post-processing on the output.

For 067, it is easier to switch to virtio aliases, which will pick virtio-ccw on s390x and virtio-pci elsewhere. It also exercises the aliasing path.

v1->v2:
- avoid adding new reference output by adding post-processing to 051 and switching to aliases for 067

Cornelia Huck (3):
iotests: use -ccw on s390x for 040, 139, and 182
iotests: use -ccw on s390x for 051
iotests: use virtio aliases for 067

 tests/qemu-iotests/040        |  6 +++++-
 tests/qemu-iotests/051        | 12 +++++++++++-
 tests/qemu-iotests/051.out    |  2 +-
 tests/qemu-iotests/051.pc.out |  2 +-
 tests/qemu-iotests/067        |  3 ++-
 tests/qemu-iotests/067.out    |  2 +-
 tests/qemu-iotests/139        | 12 ++++++++++--
 tests/qemu-iotests/182        | 13 +++++++++++--
 8 files changed, 42 insertions(+), 10 deletions(-)
Signature · 1 line
2.13.5
#1 lore raw

PATCH v2 1/3 iotests: use -ccw on s390x for 040, 139, and 182

The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x, so use the -ccw instead of the -pci versions of virtio devices on s390x.

---
 tests/qemu-iotests/040 |  6 +++++-
 tests/qemu-iotests/139 | 12 ++++++++++--
 tests/qemu-iotests/182 | 13 +++++++++++--
 3 files changed, 26 insertions(+), 5 deletions(-)
tests/qemu-iotests/040 +5 -1
index 95b7510571..c284d08796 100755
@@ -82,7 +82,11 @@ class TestSingleDrive(ImageCommitTestCase):
         qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', backing_img)
         qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288', mid_img)
         self.vm = iotests.VM().add_drive(test_img, "node-name=top,backing.node-name=mid,backing.backing.node-name=base", interface="none")
-        self.vm.add_device("virtio-scsi-pci")
+        if iotests.qemu_default_machine == 's390-ccw-virtio':
+            self.vm.add_device("virtio-scsi-ccw")
+        else:
+            self.vm.add_device("virtio-scsi-pci")
+
         self.vm.add_device("scsi-hd,id=scsi0,drive=drive0")
         self.vm.launch()
 
tests/qemu-iotests/139 +10 -2
index 50cf40fbd5..f8f02808a9 100644
@@ -25,13 +25,21 @@ import time
 
 base_img = os.path.join(iotests.test_dir, 'base.img')
 new_img = os.path.join(iotests.test_dir, 'new.img')
+if iotests.qemu_default_machine == 's390-ccw-virtio':
+    default_virtio_blk = 'virtio-blk-ccw'
+else:
+    default_virtio_blk = 'virtio-blk-pci'
 
 class TestBlockdevDel(iotests.QMPTestCase):
 
     def setUp(self):
         iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M')
         self.vm = iotests.VM()
-        self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
+        if iotests.qemu_default_machine == 's390-ccw-virtio':
+            self.vm.add_device("virtio-scsi-ccw,id=virtio-scsi")
+        else:
+            self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
+
         self.vm.launch()
 
     def tearDown(self):
@@ -87,7 +95,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
         self.checkBlockDriverState(node, expect_error)
 
     # Add a device model
-    def addDeviceModel(self, device, backend, driver = 'virtio-blk-pci'):
+    def addDeviceModel(self, device, backend, driver = default_virtio_blk):
         result = self.vm.qmp('device_add', id = device,
                              driver = driver, drive = backend)
         self.assert_qmp(result, 'return', {})
tests/qemu-iotests/182 +11 -2
index 7ecbb22604..2e078ceed8 100755
@@ -45,17 +45,26 @@ _supported_os Linux
 
 size=32M
 
+case "$QEMU_DEFAULT_MACHINE" in
+  s390-ccw-virtio)
+      virtioblk=virtio-blk-ccw
+      ;;
+  *)
+      virtioblk=virtio-blk-pci
+      ;;
+esac
+
 _make_test_img $size
 
 echo "Starting QEMU"
 _launch_qemu -drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \
-    -device virtio-blk-pci,drive=drive0
+    -device $virtioblk,drive=drive0
 
 echo
 echo "Starting a second QEMU using the same image should fail"
 echo 'quit' | $QEMU -monitor stdio \
     -drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \
-    -device virtio-blk-pci,drive=drive0 2>&1 | _filter_testdir 2>&1 |
+    -device $virtioblk,drive=drive0 2>&1 | _filter_testdir 2>&1 |
     _filter_qemu |
     sed -e '/falling back to POSIX file/d' \
         -e '/locks can be lost unexpectedly/d'
Signature · 1 line
2.13.5
#2 lore raw

Re: [Qemu-devel] [PATCH v2 1/3] iotests: use -ccw on s390x for 040, 139, and 182

Quoted 35 lines · Cornelia Huck

The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x, so use the -ccw instead of the -pci versions of virtio devices on s390x.

---
 tests/qemu-iotests/040 |  6 +++++-
 tests/qemu-iotests/139 | 12 ++++++++++--
 tests/qemu-iotests/182 | 13 +++++++++++--
 3 files changed, 26 insertions(+), 5 deletions(-)
tests/qemu-iotests/040 +5 -1
index 95b7510571..c284d08796 100755
@@ -82,7 +82,11 @@ class TestSingleDrive(ImageCommitTestCase):
         qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', backing_img)
         qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288', mid_img)
         self.vm = iotests.VM().add_drive(test_img, "node-name=top,backing.node-name=mid,backing.backing.node-name=base", interface="none")
-        self.vm.add_device("virtio-scsi-pci")
+        if iotests.qemu_default_machine == 's390-ccw-virtio':
+            self.vm.add_device("virtio-scsi-ccw")
+        else:
+            self.vm.add_device("virtio-scsi-pci")
+
         self.vm.add_device("scsi-hd,id=scsi0,drive=drive0")
         self.vm.launch()
 
tests/qemu-iotests/139 +0 -0
index 50cf40fbd5..f8f02808a9 100644

tests/qemu-iotests/139 import time · line 31

Quoted 7 lines
tests/qemu-iotests/139 +4 -0
@@ -25,13 +25,21 @@ import time
 
 base_img = os.path.join(iotests.test_dir, 'base.img')
 new_img = os.path.join(iotests.test_dir, 'new.img')
+if iotests.qemu_default_machine == 's390-ccw-virtio':
+    default_virtio_blk = 'virtio-blk-ccw'
+else:
+    default_virtio_blk = 'virtio-blk-pci'

simply "virtio_blk" ?

Quoted 29 lines
tests/qemu-iotests/139 +6 -2
 class TestBlockdevDel(iotests.QMPTestCase):
 
     def setUp(self):
         iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M')
         self.vm = iotests.VM()
-        self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
+        if iotests.qemu_default_machine == 's390-ccw-virtio':
+            self.vm.add_device("virtio-scsi-ccw,id=virtio-scsi")
+        else:
+            self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
+
         self.vm.launch()
 
     def tearDown(self):
@@ -87,7 +95,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
         self.checkBlockDriverState(node, expect_error)
 
     # Add a device model
-    def addDeviceModel(self, device, backend, driver = 'virtio-blk-pci'):
+    def addDeviceModel(self, device, backend, driver = default_virtio_blk):
         result = self.vm.qmp('device_add', id = device,
                              driver = driver, drive = backend)
         self.assert_qmp(result, 'return', {})
tests/qemu-iotests/182 +0 -0
index 7ecbb22604..2e078ceed8 100755

tests/qemu-iotests/182 _supported_os Linux · line 53

Quoted 9 lines
tests/qemu-iotests/182 +6 -0
@@ -45,17 +45,26 @@ _supported_os Linux
 
 size=32M
 
+case "$QEMU_DEFAULT_MACHINE" in
+  s390-ccw-virtio)
+      virtioblk=virtio-blk-ccw
+      ;;
+  *)
+      virtioblk=virtio-blk-pci

s/virtioblk/virtio_blk/ ?

(due to "virtio_scsi" in next patch)

Quoted 20 lines
tests/qemu-iotests/182 +5 -2
+      ;;
+esac
+
 _make_test_img $size
 
 echo "Starting QEMU"
 _launch_qemu -drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \
-    -device virtio-blk-pci,drive=drive0
+    -device $virtioblk,drive=drive0
 
 echo
 echo "Starting a second QEMU using the same image should fail"
 echo 'quit' | $QEMU -monitor stdio \
     -drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \
-    -device virtio-blk-pci,drive=drive0 2>&1 | _filter_testdir 2>&1 |
+    -device $virtioblk,drive=drive0 2>&1 | _filter_testdir 2>&1 |
     _filter_qemu |
     sed -e '/falling back to POSIX file/d' \
         -e '/locks can be lost unexpectedly/d'
Signature · 3 lines
Thanks,

David
#3 lore raw

PATCH v2 2/3 iotests: use -ccw on s390x for 051

In reply to Cornelia Huck

The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x, so use the -ccw instead of the -pci versions of virtio devices on s390x.

---
 tests/qemu-iotests/051        | 12 +++++++++++-
 tests/qemu-iotests/051.out    |  2 +-
 tests/qemu-iotests/051.pc.out |  2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)
tests/qemu-iotests/051 +11 -1
index c8cfc764bc..dba8816c9f 100755
@@ -103,7 +103,17 @@ echo
 echo === Device without drive ===
 echo
 
-run_qemu -device virtio-scsi-pci -device scsi-hd
+case "$QEMU_DEFAULT_MACHINE" in
+  s390-ccw-virtio)
+      virtio_scsi=virtio-scsi-ccw
+      ;;
+  *)
+      virtio_scsi=virtio-scsi-pci
+      ;;
+esac
+
+run_qemu -device $virtio_scsi -device scsi-hd |
+    sed -e "s/$virtio_scsi/VIRTIO_SCSI/"
 
 echo
 echo === Overriding backing file ===
tests/qemu-iotests/051.out +1 -1
index 4d3b1ff316..e3c6eaba57 100644
@@ -49,7 +49,7 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif
 
 === Device without drive ===
 
-Testing: -device virtio-scsi-pci -device scsi-hd
+Testing: -device VIRTIO_SCSI -device scsi-hd
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) QEMU_PROG: -device scsi-hd: drive property not set
 
tests/qemu-iotests/051.pc.out +1 -1
index 76d7205460..ae7801b44b 100644
@@ -49,7 +49,7 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif
 
 === Device without drive ===
 
-Testing: -device virtio-scsi-pci -device scsi-hd
+Testing: -device VIRTIO_SCSI -device scsi-hd
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) QEMU_PROG: -device scsi-hd: drive property not set
 
Signature · 1 line
2.13.5
Reviewed-by on v2 2/3
#4 lore raw

Re: [Qemu-devel] [PATCH v2 2/3] iotests: use -ccw on s390x for 051

Quoted 11 lines · Cornelia Huck

The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x, so use the -ccw instead of the -pci versions of virtio devices on s390x.

---
 tests/qemu-iotests/051        | 12 +++++++++++-
 tests/qemu-iotests/051.out    |  2 +-
 tests/qemu-iotests/051.pc.out |  2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)
Reviewed-by on v2 2/3
#5 lore raw

Re: [Qemu-devel] [PATCH v2 2/3] iotests: use -ccw on s390x for 051

In reply to Cornelia Huck
Quoted 54 lines · Cornelia Huck

The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x, so use the -ccw instead of the -pci versions of virtio devices on s390x.

---
 tests/qemu-iotests/051        | 12 +++++++++++-
 tests/qemu-iotests/051.out    |  2 +-
 tests/qemu-iotests/051.pc.out |  2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)
tests/qemu-iotests/051 +11 -1
index c8cfc764bc..dba8816c9f 100755
@@ -103,7 +103,17 @@ echo
 echo === Device without drive ===
 echo
 
-run_qemu -device virtio-scsi-pci -device scsi-hd
+case "$QEMU_DEFAULT_MACHINE" in
+  s390-ccw-virtio)
+      virtio_scsi=virtio-scsi-ccw
+      ;;
+  *)
+      virtio_scsi=virtio-scsi-pci
+      ;;
+esac
+
+run_qemu -device $virtio_scsi -device scsi-hd |
+    sed -e "s/$virtio_scsi/VIRTIO_SCSI/"
 
 echo
 echo === Overriding backing file ===
tests/qemu-iotests/051.out +1 -1
index 4d3b1ff316..e3c6eaba57 100644
@@ -49,7 +49,7 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif
 
 === Device without drive ===
 
-Testing: -device virtio-scsi-pci -device scsi-hd
+Testing: -device VIRTIO_SCSI -device scsi-hd
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) QEMU_PROG: -device scsi-hd: drive property not set
 
tests/qemu-iotests/051.pc.out +0 -0
index 76d7205460..ae7801b44b 100644

tests/qemu-iotests/051.pc.out QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif · line 55

Quoted 8 lines
tests/qemu-iotests/051.pc.out +1 -1
@@ -49,7 +49,7 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif
 
 === Device without drive ===
 
-Testing: -device virtio-scsi-pci -device scsi-hd
+Testing: -device VIRTIO_SCSI -device scsi-hd
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) QEMU_PROG: -device scsi-hd: drive property not set
 
Signature · 3 lines
Thanks,

David
#6 lore raw

PATCH v2 3/3 iotests: use virtio aliases for 067

In reply to Cornelia Huck

The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x.

Using virtio-scsi will implicitly pick the right device, so just switch to that for simplicity.

---
 tests/qemu-iotests/067     | 3 ++-
 tests/qemu-iotests/067.out | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
tests/qemu-iotests/067 +2 -1
index 5d4ca4bc61..cbb3da286a 100755
@@ -141,7 +141,7 @@ echo
 echo === Empty drive with -device and device_del ===
 echo
 
-run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
+run_qemu -device virtio-scsi -device scsi-cd,id=cd0 <<EOF
 { "execute": "qmp_capabilities" }
 { "execute": "query-block" }
 { "execute": "device_del", "arguments": { "id": "cd0" } }
@@ -150,6 +150,7 @@ run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
 { "execute": "quit" }
 EOF
 
+
 # success, all done
 echo "*** done"
 rm -f $seq.full
tests/qemu-iotests/067.out +1 -1
index bd70557ddc..58e83c4505 100644
@@ -419,7 +419,7 @@ Testing:
 
 === Empty drive with -device and device_del ===
 
-Testing: -device virtio-scsi-pci -device scsi-cd,id=cd0
+Testing: -device virtio-scsi -device scsi-cd,id=cd0
 {
     QMP_VERSION
 }
Signature · 1 line
2.13.5
Reviewed-by on v2 3/3
#7 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] iotests: use virtio aliases for 067

Quoted 27 lines · Cornelia Huck

The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x.

Using virtio-scsi will implicitly pick the right device, so just switch to that for simplicity.

---
 tests/qemu-iotests/067     | 3 ++-
 tests/qemu-iotests/067.out | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
tests/qemu-iotests/067 +1 -1
index 5d4ca4bc61..cbb3da286a 100755
@@ -141,7 +141,7 @@ echo
 echo === Empty drive with -device and device_del ===
 echo
 
-run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
+run_qemu -device virtio-scsi -device scsi-cd,id=cd0 <<EOF
 { "execute": "qmp_capabilities" }
 { "execute": "query-block" }
 { "execute": "device_del", "arguments": { "id": "cd0" } }

tests/qemu-iotests/067 run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF · line 153

Quoted 4 lines
tests/qemu-iotests/067 +1 -0
@@ -150,6 +150,7 @@ run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
 { "execute": "quit" }
 EOF
 
+

Superfluous white space change?

With that nit removed:

Reviewed-by on v2 3/3
#8 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] iotests: use virtio aliases for 067

In reply to Cornelia Huck
Quoted 40 lines · Cornelia Huck

The default cpu model on s390x does not provide zPCI, which is not yet wired up on tcg. Moreover, virtio-ccw is the standard on s390x.

Using virtio-scsi will implicitly pick the right device, so just switch to that for simplicity.

---
 tests/qemu-iotests/067     | 3 ++-
 tests/qemu-iotests/067.out | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
tests/qemu-iotests/067 +2 -1
index 5d4ca4bc61..cbb3da286a 100755
@@ -141,7 +141,7 @@ echo
 echo === Empty drive with -device and device_del ===
 echo
 
-run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
+run_qemu -device virtio-scsi -device scsi-cd,id=cd0 <<EOF
 { "execute": "qmp_capabilities" }
 { "execute": "query-block" }
 { "execute": "device_del", "arguments": { "id": "cd0" } }
@@ -150,6 +150,7 @@ run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
 { "execute": "quit" }
 EOF
 
+
 # success, all done
 echo "*** done"
 rm -f $seq.full
tests/qemu-iotests/067.out +0 -0
index bd70557ddc..58e83c4505 100644

tests/qemu-iotests/067.out Testing: · line 425

Quoted 8 lines
tests/qemu-iotests/067.out +1 -1
@@ -419,7 +419,7 @@ Testing:
 
 === Empty drive with -device and device_del ===
 
-Testing: -device virtio-scsi-pci -device scsi-cd,id=cd0
+Testing: -device virtio-scsi -device scsi-cd,id=cd0
 {
     QMP_VERSION
 }

Certainly not wrong to use the old alias in some tests, as long as we test both variants.

Signature · 3 lines
Thanks,

David
Reviewed-by on the v2 series
#9 lore raw
In reply to Cornelia Huck

for the series of patches.

Thanks

Quoted 34 lines · Cornelia Huck

Recent changes in s390x made pci support dependant on the zpci cpu feature, which is not provided on all models (and not on by default). This means we cannot instatiate pci devices on a standard qemu invocation for s390x. Moreover, the zpci instructions are not even wired up for tcg yet, so actually doing anything with those pci devices is bound to fail on tcg.

For 040, 051, 139, and 182, this can be fixed by switching to virtio-ccw from virtio-pci on s390x. 051 also needs a bit of post-processing on the output.

For 067, it is easier to switch to virtio aliases, which will pick virtio-ccw on s390x and virtio-pci elsewhere. It also exercises the aliasing path.

v1->v2:
- avoid adding new reference output by adding post-processing to 051 and switching to aliases for 067

Cornelia Huck (3):

   iotests: use -ccw on s390x for 040, 139, and 182
   iotests: use -ccw on s390x for 051
   iotests: use virtio aliases for 067
  tests/qemu-iotests/040        |  6 +++++-
  tests/qemu-iotests/051        | 12 +++++++++++-
  tests/qemu-iotests/051.out    |  2 +-
  tests/qemu-iotests/051.pc.out |  2 +-
  tests/qemu-iotests/067        |  3 ++-
  tests/qemu-iotests/067.out    |  2 +-
  tests/qemu-iotests/139        | 12 ++++++++++--
  tests/qemu-iotests/182        | 13 +++++++++++--
  8 files changed, 42 insertions(+), 10 deletions(-)
Signature · 2 lines
Regards
QingFeng Hao
#10 lore raw
In reply to Cornelia Huck

Am 13.09.2017 um 11:10 hat Cornelia Huck geschrieben:

Quoted 7 lines

Recent changes in s390x made pci support dependant on the zpci cpu feature, which is not provided on all models (and not on by default). This means we cannot instatiate pci devices on a standard qemu invocation for s390x. Moreover, the zpci instructions are not even wired up for tcg yet, so actually doing anything with those pci devices is bound to fail on tcg.

Quoted 7 lines

For 040, 051, 139, and 182, this can be fixed by switching to virtio-ccw from virtio-pci on s390x. 051 also needs a bit of post-processing on the output.

For 067, it is easier to switch to virtio aliases, which will pick virtio-ccw on s390x and virtio-pci elsewhere. It also exercises the aliasing path.

Thanks, dropped the whitespace change in patch 3 and applied to the block branch.

Kevin