[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 30/32] qemu-iotests: Test naming of throttling groups
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 30/32] qemu-iotests: Test naming of throttling groups |
Date: |
Fri, 8 Jul 2016 19:21:42 +0200 |
From: Alberto Garcia <address@hidden>
Throttling groups are named using the 'group' parameter of the
block_set_io_throttle command and the throttling.group command-line
option. If that parameter is unspecified the groups get the name of
the block device.
This patch adds a new test to check the naming of throttling groups.
Signed-off-by: Alberto Garcia <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/093 | 98 ++++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/093.out | 4 +-
2 files changed, 100 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
index ce8e13c..ffcb271 100755
--- a/tests/qemu-iotests/093
+++ b/tests/qemu-iotests/093
@@ -184,5 +184,103 @@ class ThrottleTestCase(iotests.QMPTestCase):
class ThrottleTestCoroutine(ThrottleTestCase):
test_img = "null-co://"
+class ThrottleTestGroupNames(iotests.QMPTestCase):
+ test_img = "null-aio://"
+ max_drives = 3
+
+ def setUp(self):
+ self.vm = iotests.VM()
+ for i in range(0, self.max_drives):
+ self.vm.add_drive(self.test_img, "throttling.iops-total=100")
+ self.vm.launch()
+
+ def tearDown(self):
+ self.vm.shutdown()
+
+ def set_io_throttle(self, device, params):
+ params["device"] = device
+ result = self.vm.qmp("block_set_io_throttle", conv_keys=False,
**params)
+ self.assert_qmp(result, 'return', {})
+
+ def verify_name(self, device, name):
+ result = self.vm.qmp("query-block")
+ for r in result["return"]:
+ if r["device"] == device:
+ info = r["inserted"]
+ if name:
+ self.assertEqual(info["group"], name)
+ else:
+ self.assertFalse(info.has_key('group'))
+ return
+
+ raise Exception("No group information found for '%s'" % device)
+
+ def test_group_naming(self):
+ params = {"bps": 0,
+ "bps_rd": 0,
+ "bps_wr": 0,
+ "iops": 0,
+ "iops_rd": 0,
+ "iops_wr": 0}
+
+ # Check the drives added using the command line.
+ # The default throttling group name is the device name.
+ for i in range(self.max_drives):
+ devname = "drive%d" % i
+ self.verify_name(devname, devname)
+
+ # Clear throttling settings => the group name is gone.
+ for i in range(self.max_drives):
+ devname = "drive%d" % i
+ self.set_io_throttle(devname, params)
+ self.verify_name(devname, None)
+
+ # Set throttling settings using block_set_io_throttle and
+ # check the default group names.
+ params["iops"] = 10
+ for i in range(self.max_drives):
+ devname = "drive%d" % i
+ self.set_io_throttle(devname, params)
+ self.verify_name(devname, devname)
+
+ # Set a custom group name for each device
+ for i in range(3):
+ devname = "drive%d" % i
+ groupname = "group%d" % i
+ params['group'] = groupname
+ self.set_io_throttle(devname, params)
+ self.verify_name(devname, groupname)
+
+ # Put drive0 in group1 and check that all other devices remain
+ # unchanged
+ params['group'] = 'group1'
+ self.set_io_throttle('drive0', params)
+ self.verify_name('drive0', 'group1')
+ for i in range(1, self.max_drives):
+ devname = "drive%d" % i
+ groupname = "group%d" % i
+ self.verify_name(devname, groupname)
+
+ # Put drive0 in group2 and check that all other devices remain
+ # unchanged
+ params['group'] = 'group2'
+ self.set_io_throttle('drive0', params)
+ self.verify_name('drive0', 'group2')
+ for i in range(1, self.max_drives):
+ devname = "drive%d" % i
+ groupname = "group%d" % i
+ self.verify_name(devname, groupname)
+
+ # Clear throttling settings from drive0 check that all other
+ # devices remain unchanged
+ params["iops"] = 0
+ self.set_io_throttle('drive0', params)
+ self.verify_name('drive0', None)
+ for i in range(1, self.max_drives):
+ devname = "drive%d" % i
+ groupname = "group%d" % i
+ self.verify_name(devname, groupname)
+
+
if __name__ == '__main__':
iotests.main(supported_fmts=["raw"])
diff --git a/tests/qemu-iotests/093.out b/tests/qemu-iotests/093.out
index 89968f3..914e373 100644
--- a/tests/qemu-iotests/093.out
+++ b/tests/qemu-iotests/093.out
@@ -1,5 +1,5 @@
-....
+.....
----------------------------------------------------------------------
-Ran 4 tests
+Ran 5 tests
OK
--
1.8.3.1
- [Qemu-devel] [PULL 23/32] qemu-img: Use strerror() for generic resize error, (continued)
- [Qemu-devel] [PULL 23/32] qemu-img: Use strerror() for generic resize error, Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 26/32] qcow2: Fix qcow2_get_cluster_offset(), Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 21/32] qemu-iotests: Test setting WCE with qdev, Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 11/32] blockjob: Update description of the 'device' field in the QMP API, Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 22/32] block: Remove BB options from blockdev-add, Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 24/32] qcow2: Avoid making the L1 table too big, Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 28/32] vmdk: fix metadata write regression, Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 27/32] Improve block job rate limiting for small bandwidth values, Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 16/32] coroutine: move entry argument to qemu_coroutine_create, Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 29/32] blockdev: Fix regression with the default naming of throttling groups, Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 30/32] qemu-iotests: Test naming of throttling groups,
Kevin Wolf <=
- [Qemu-devel] [PULL 31/32] hmp: use snapshot name to determine whether a snapshot is 'fully available', Kevin Wolf, 2016/07/08
- [Qemu-devel] [PULL 32/32] hmp: show all of snapshot info on every block dev in output of 'info snapshots', Kevin Wolf, 2016/07/08
- Re: [Qemu-devel] [PULL 00/32] Block layer patches, Peter Maydell, 2016/07/11