[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 33/41] qemu-iotest: Add pause_drive and resume_drive
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 33/41] qemu-iotest: Add pause_drive and resume_drive methods |
Date: |
Fri, 29 Nov 2013 17:45:48 +0100 |
From: Fam Zheng <address@hidden>
They wrap blkdebug "break" and "remove_break".
Add optional argument "resume" to cancel_and_wait().
Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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.1.4
- [Qemu-devel] [PULL 24/41] COW: Speed up writes, (continued)
- [Qemu-devel] [PULL 24/41] COW: Speed up writes, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 25/41] COW: Extend checking allocated bits to beyond one sector, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 26/41] MAINTAINERS: add sheepdog development mailing list, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 23/41] qapi: Change BlockDirtyInfo to list, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 27/41] qdict: Fix memory leak in qdict_do_flatten(), Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 28/41] qdict: Optimise qdict_do_flatten(), Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 29/41] sheepdog: refactor do_sd_create(), Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 31/41] qemu-iotests: Drop local version of cancel_and_wait from 040, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 30/41] sheepdog: support user-defined redundancy option, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 32/41] blkdebug: add "remove_break" command, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 33/41] qemu-iotest: Add pause_drive and resume_drive methods,
Kevin Wolf <=
- [Qemu-devel] [PULL 34/41] qemu-iotests: Make test case 030, 040 and 055 deterministic, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 35/41] block: Enable BDRV_O_SNAPSHOT with driver-specific options, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 37/41] block: Use BDRV_O_NO_BACKING where appropriate, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 36/41] qemu-iotests: Test snapshot mode, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 38/41] qemu-iotests: Filter qemu-io output in 025, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 40/41] vmdk: Allow read only open of VMDK version 3, Kevin Wolf, 2013/11/29
- [Qemu-devel] [PULL 41/41] qemu-iotests: Add sample image and test for VMDK version 3, Kevin Wolf, 2013/11/29