From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vix7N-0002AC-UX for qemu-devel@nongnu.org; Tue, 19 Nov 2013 21:02:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vix7I-0004cL-Em for qemu-devel@nongnu.org; Tue, 19 Nov 2013 21:02:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vix7I-0004cF-6c for qemu-devel@nongnu.org; Tue, 19 Nov 2013 21:02:08 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAK227kW028912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Nov 2013 21:02:07 -0500 From: Fam Zheng Date: Wed, 20 Nov 2013 10:01:55 +0800 Message-Id: <1384912916-18712-4-git-send-email-famz@redhat.com> In-Reply-To: <1384912916-18712-1-git-send-email-famz@redhat.com> References: <1384912916-18712-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v6 3/4] qemu-iotest: Add pause_drive and resume_drive methods List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, mreitz@redhat.com They wrap blkdebug "break" and "remove_break". Add optional argument "resume" to cancel_and_wait(). Signed-off-by: Fam Zheng --- tests/qemu-iotests/iotests.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index fb10ff4..10c9a99 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -107,6 +107,19 @@ class VM(object): self._num_drives += 1 return self + def pause_drive(self, drive, event=None): + '''Pause drive r/w operations''' + if not event: + self.pause_drive(drive, "read_aio") + self.pause_drive(drive, "write_aio") + return + self.qmp('human-monitor-command', + command_line='qemu-io %s "break %s bp_%s"' % (drive, event, drive)) + + def resume_drive(self, drive): + self.qmp('human-monitor-command', + command_line='qemu-io %s "remove_break bp_%s"' % (drive, drive)) + def hmp_qemu_io(self, drive, cmd): '''Write to a given drive using an HMP command''' return self.qmp('human-monitor-command', @@ -222,11 +235,14 @@ class QMPTestCase(unittest.TestCase): result = self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return', []) - def cancel_and_wait(self, drive='drive0', force=False): + def cancel_and_wait(self, drive='drive0', force=False, resume=False): '''Cancel a block job and wait for it to finish, returning the event''' result = self.vm.qmp('block-job-cancel', device=drive, force=force) self.assert_qmp(result, 'return', {}) + if resume: + self.vm.resume_drive(drive) + cancelled = False result = None while not cancelled: -- 1.8.4.2