aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-11-14 16:11:19 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-11-14 16:11:19 +0000
commit191b5fbfa66e5b23e2150f3c6981d30eb84418a9 (patch)
treedf2fa0a21490630f50e81cbb03d5db0a93e32d0f /tests
parent0dc8874aded76e2b6c73d95df5651e3c8a31a9ec (diff)
parent0761562687e0d8135310a94b1d3e08376387c027 (diff)
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Pull request The following disk I/O throttling fixes solve recent bugs. # gpg: Signature made Tue 14 Nov 2017 10:37:12 GMT # gpg: using RSA key 0x9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/block-pull-request: qemu-iotests: Test I/O limits with removable media block: Leave valid throttle timers when removing a BDS from a backend block: Check for inserted BlockDriverState in blk_io_limits_disable() throttle-groups: drain before detaching ThrottleState block: all I/O should be completed before removing throttle timers. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/09362
-rw-r--r--tests/qemu-iotests/093.out4
2 files changed, 64 insertions, 2 deletions
diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
index ef3997206b..5c36a5fb4d 100755
--- a/tests/qemu-iotests/093
+++ b/tests/qemu-iotests/093
@@ -308,6 +308,68 @@ class ThrottleTestGroupNames(iotests.QMPTestCase):
groupname = "group%d" % i
self.verify_name(devname, groupname)
+class ThrottleTestRemovableMedia(iotests.QMPTestCase):
+ def setUp(self):
+ self.vm = iotests.VM()
+ 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):
+ self.vm.shutdown()
+
+ def test_removable_media(self):
+ # Add a couple of dummy nodes named cd0 and cd1
+ result = self.vm.qmp("blockdev-add", driver="null-aio",
+ node_name="cd0")
+ self.assert_qmp(result, 'return', {})
+ result = self.vm.qmp("blockdev-add", driver="null-aio",
+ node_name="cd1")
+ self.assert_qmp(result, 'return', {})
+
+ # Attach a CD drive with cd0 inserted
+ result = self.vm.qmp("device_add", driver="scsi-cd",
+ id="dev0", drive="cd0")
+ self.assert_qmp(result, 'return', {})
+
+ # Set I/O limits
+ args = { "id": "dev0", "iops": 100, "iops_rd": 0, "iops_wr": 0,
+ "bps": 50, "bps_rd": 0, "bps_wr": 0 }
+ result = self.vm.qmp("block_set_io_throttle", conv_keys=False, **args)
+ self.assert_qmp(result, 'return', {})
+
+ # Check that the I/O limits have been set
+ result = self.vm.qmp("query-block")
+ self.assert_qmp(result, 'return[0]/inserted/iops', 100)
+ self.assert_qmp(result, 'return[0]/inserted/bps', 50)
+
+ # Now eject cd0 and insert cd1
+ result = self.vm.qmp("blockdev-open-tray", id='dev0')
+ self.assert_qmp(result, 'return', {})
+ result = self.vm.qmp("x-blockdev-remove-medium", id='dev0')
+ self.assert_qmp(result, 'return', {})
+ result = self.vm.qmp("x-blockdev-insert-medium", id='dev0', node_name='cd1')
+ self.assert_qmp(result, 'return', {})
+
+ # Check that the I/O limits are still the same
+ result = self.vm.qmp("query-block")
+ self.assert_qmp(result, 'return[0]/inserted/iops', 100)
+ self.assert_qmp(result, 'return[0]/inserted/bps', 50)
+
+ # Eject cd1
+ result = self.vm.qmp("x-blockdev-remove-medium", id='dev0')
+ self.assert_qmp(result, 'return', {})
+
+ # Check that we can't set limits if the device has no medium
+ result = self.vm.qmp("block_set_io_throttle", conv_keys=False, **args)
+ self.assert_qmp(result, 'error/class', 'GenericError')
+
+ # Remove the CD drive
+ result = self.vm.qmp("device_del", id='dev0')
+ self.assert_qmp(result, 'return', {})
+
if __name__ == '__main__':
iotests.main(supported_fmts=["raw"])
diff --git a/tests/qemu-iotests/093.out b/tests/qemu-iotests/093.out
index 2f7d3902f2..594c16f49f 100644
--- a/tests/qemu-iotests/093.out
+++ b/tests/qemu-iotests/093.out
@@ -1,5 +1,5 @@
-.......
+........
----------------------------------------------------------------------
-Ran 7 tests
+Ran 8 tests
OK