From patchwork Mon Oct 17 15:46:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 683095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3syN5J3wNyz9rxv for ; Tue, 18 Oct 2016 02:52:52 +1100 (AEDT) Received: from localhost ([::1]:34009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwADZ-0004QE-52 for incoming@patchwork.ozlabs.org; Mon, 17 Oct 2016 11:52:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwA7O-0006Wi-AE for qemu-devel@nongnu.org; Mon, 17 Oct 2016 11:46:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwA7K-0001vr-JQ for qemu-devel@nongnu.org; Mon, 17 Oct 2016 11:46:26 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:49769 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwA7K-0001vV-6l; Mon, 17 Oct 2016 11:46:22 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BTAgAm8QRY/5tjdVtcHAEBBAEBCgEBgzwBAQEBAR2BU400lV0BAQEBAQEFAYEXAZIsgg+CCIYiAoFnOBQBAgEBAQEBAQFeJ4RiAgR5ED8SPBsZiFYBwl4BAQgohXKCUIZ0hgIFiDyGd4pTkASBbogehWmQex42RAYIgiyCRG+GU4IuAQEB X-IPAS-Result: A2BTAgAm8QRY/5tjdVtcHAEBBAEBCgEBgzwBAQEBAR2BU400lV0BAQEBAQEFAYEXAZIsgg+CCIYiAoFnOBQBAgEBAQEBAQFeJ4RiAgR5ED8SPBsZiFYBwl4BAQgohXKCUIZ0hgIFiDyGd4pTkASBbogehWmQex42RAYIgiyCRG+GU4IuAQEB X-IronPort-AV: E=Sophos;i="5.31,357,1473112800"; d="scan'208";a="67262649" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 17 Oct 2016 17:46:17 +0200 Received: from a88-114-146-170.elisa-laajakaista.fi ([88.114.146.170] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim) id 1bwA7F-0004Tq-Fb; Mon, 17 Oct 2016 17:46:17 +0200 Received: from berto by perseus.local with local (Exim 4.87) (envelope-from ) id 1bwA72-0004yO-4d; Mon, 17 Oct 2016 18:46:04 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2016 18:46:03 +0300 Message-Id: X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: [Qemu-devel] [PATCH 2/2] qemu-iotests: Test I/O in a single drive from a throttling group X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Paolo Bonzini , Alberto Garcia , qemu-stable@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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