qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 07/23] qemu-iotests: Test I/O in a single drive from a throttling group
Date: Mon, 24 Oct 2016 19:01:55 +0200	[thread overview]
Message-ID: <1477328531-30879-8-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1477328531-30879-1-git-send-email-kwolf@redhat.com>

From: Alberto Garcia <berto@igalia.com>

iotest 093 contains a test that creates a throttling group with
several drives and performs I/O in all of them. This patch adds a new
test that creates a similar setup but only performs I/O in one of the
drives at the same time.

This is useful to test that the round robin algorithm is behaving
properly in these scenarios, and is specifically written using the
regression introduced in 27ccdd52598290f0f8b58be56e as an example.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/093     | 33 ++++++++++++++++++++++++++++-----
 tests/qemu-iotests/093.out |  4 ++--
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
index ffcb271..2ed393a 100755
--- a/tests/qemu-iotests/093
+++ b/tests/qemu-iotests/093
@@ -53,7 +53,7 @@ class ThrottleTestCase(iotests.QMPTestCase):
             result = self.vm.qmp("block_set_io_throttle", conv_keys=False, **params)
             self.assert_qmp(result, 'return', {})
 
-    def do_test_throttle(self, ndrives, seconds, params):
+    def do_test_throttle(self, ndrives, seconds, params, first_drive = 0):
         def check_limit(limit, num):
             # IO throttling algorithm is discrete, allow 10% error so the test
             # is more robust
@@ -85,12 +85,14 @@ class ThrottleTestCase(iotests.QMPTestCase):
         # Send I/O requests to all drives
         for i in range(rd_nr):
             for drive in range(0, ndrives):
-                self.vm.hmp_qemu_io("drive%d" % drive, "aio_read %d %d" %
+                idx = first_drive + drive
+                self.vm.hmp_qemu_io("drive%d" % idx, "aio_read %d %d" %
                                     (i * rq_size, rq_size))
 
         for i in range(wr_nr):
             for drive in range(0, ndrives):
-                self.vm.hmp_qemu_io("drive%d" % drive, "aio_write %d %d" %
+                idx = first_drive + drive
+                self.vm.hmp_qemu_io("drive%d" % idx, "aio_write %d %d" %
                                     (i * rq_size, rq_size))
 
         # We'll store the I/O stats for each drive in these arrays
@@ -105,15 +107,17 @@ class ThrottleTestCase(iotests.QMPTestCase):
 
         # Read the stats before advancing the clock
         for i in range(0, ndrives):
+            idx = first_drive + i
             start_rd_bytes[i], start_rd_iops[i], start_wr_bytes[i], \
-                start_wr_iops[i] = self.blockstats('drive%d' % i)
+                start_wr_iops[i] = self.blockstats('drive%d' % idx)
 
         self.vm.qtest("clock_step %d" % ns)
 
         # Read the stats after advancing the clock
         for i in range(0, ndrives):
+            idx = first_drive + i
             end_rd_bytes[i], end_rd_iops[i], end_wr_bytes[i], \
-                end_wr_iops[i] = self.blockstats('drive%d' % i)
+                end_wr_iops[i] = self.blockstats('drive%d' % idx)
 
         # Check that the I/O is within the limits and evenly distributed
         for i in range(0, ndrives):
@@ -129,6 +133,7 @@ class ThrottleTestCase(iotests.QMPTestCase):
             self.assertTrue(check_limit(params['iops_rd'], rd_iops))
             self.assertTrue(check_limit(params['iops_wr'], wr_iops))
 
+    # Connect N drives to a VM and test I/O in all of them
     def test_all(self):
         params = {"bps": 4096,
                   "bps_rd": 4096,
@@ -146,6 +151,24 @@ class ThrottleTestCase(iotests.QMPTestCase):
                 self.configure_throttle(ndrives, limits)
                 self.do_test_throttle(ndrives, 5, limits)
 
+    # Connect N drives to a VM and test I/O in just one of them a time
+    def test_one(self):
+        params = {"bps": 4096,
+                  "bps_rd": 4096,
+                  "bps_wr": 4096,
+                  "iops": 10,
+                  "iops_rd": 10,
+                  "iops_wr": 10,
+                 }
+        # Repeat the test for each one of the drives
+        for drive in range(0, self.max_drives):
+            # Pick each out of all possible params and test
+            for tk in params:
+                limits = dict([(k, 0) for k in params])
+                limits[tk] = params[tk] * self.max_drives
+                self.configure_throttle(self.max_drives, limits)
+                self.do_test_throttle(1, 5, limits, drive)
+
     def test_burst(self):
         params = {"bps": 4096,
                   "bps_rd": 4096,
diff --git a/tests/qemu-iotests/093.out b/tests/qemu-iotests/093.out
index 914e373..2f7d390 100644
--- a/tests/qemu-iotests/093.out
+++ b/tests/qemu-iotests/093.out
@@ -1,5 +1,5 @@
-.....
+.......
 ----------------------------------------------------------------------
-Ran 5 tests
+Ran 7 tests
 
 OK
-- 
1.8.3.1

  parent reply	other threads:[~2016-10-24 17:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 17:01 [Qemu-devel] [PULL 00/23] Block layer patches Kevin Wolf
2016-10-24 17:01 ` [Qemu-devel] [PULL 01/23] block: failed qemu-img command should return non-zero exit code Kevin Wolf
2016-10-24 17:01 ` [Qemu-devel] [PULL 02/23] qcow2: Support BDRV_REQ_MAY_UNMAP Kevin Wolf
2016-10-24 17:01 ` [Qemu-devel] [PULL 03/23] block: Remove "options" indirection from blockdev-add Kevin Wolf
2016-10-24 17:01 ` [Qemu-devel] [PULL 04/23] block: improve error handling in raw_open Kevin Wolf
2016-10-24 17:01 ` [Qemu-devel] [PULL 05/23] qapi: fix memory leak in bdrv_image_info_specific_dump Kevin Wolf
2016-10-24 17:01 ` [Qemu-devel] [PULL 06/23] throttle: Correct access to wrong BlockBackendPublic structures Kevin Wolf
2016-10-24 17:01 ` Kevin Wolf [this message]
2016-10-24 17:01 ` [Qemu-devel] [PULL 08/23] qemu-nbd: Add --fork option Kevin Wolf
2016-10-24 17:01 ` [Qemu-devel] [PULL 09/23] iotests: Remove raciness from 162 Kevin Wolf
2016-10-24 17:01 ` [Qemu-devel] [PULL 10/23] iotests: Do not rely on unavailable domains in 162 Kevin Wolf
2016-10-24 17:01 ` [Qemu-devel] [PULL 11/23] quorum: change child_iter to children_read Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 12/23] quorum: do not allocate multiple iovecs for FIFO strategy Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 13/23] block: Hide HBitmap in block dirty bitmap interface Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 14/23] HBitmap: Introduce "meta" bitmap to track bit changes Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 15/23] tests: Add test code for meta bitmap Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 16/23] block: Support meta dirty bitmap Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 17/23] block: Add two dirty bitmap getters Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 18/23] block: Assert that bdrv_release_dirty_bitmap succeeded Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 19/23] hbitmap: serialization Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 20/23] block: BdrvDirtyBitmap serialization interface Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 21/23] tests: Add test code for hbitmap serialization Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 22/23] block: More operations for meta dirty bitmap Kevin Wolf
2016-10-24 17:02 ` [Qemu-devel] [PULL 23/23] block/replication: Clarify 'top-id' parameter usage Kevin Wolf
2016-10-24 18:36 ` [Qemu-devel] [PULL 00/23] Block layer patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477328531-30879-8-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).