aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/030
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2012-10-11 05:07:45 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2012-10-11 05:07:45 -0300
commit487a26af87644923656e98a40f7801ec2f459b14 (patch)
tree0a45e66866231c9b48ed4ace875813d4aa035e55 /tests/qemu-iotests/030
parent6b852ae04e3aa1adfeac5a62d6ab71870bcc7c5d (diff)
parent92aa5c6d77ac29574c1717bcf57827fa1e586f31 (diff)
Merge commit '92aa5c6d77ac29574c1717bcf57827fa1e586f31' into upstream-merge
* commit '92aa5c6d77ac29574c1717bcf57827fa1e586f31': (43 commits) iostatus: move BlockdevOnError declaration to QAPI iostatus: rename BlockErrorAction, BlockQMPEventAction qemu-iotests: add test for pausing a streaming operation qmp: add block-job-pause and block-job-resume block: add support for job pause/resume qmp: add 'busy' member to BlockJobInfo block: add block_job_query block: move job APIs to separate files block: fix documentation of block_job_cancel_sync qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE qemu-iotests: add initial tests for live block commit QAPI: add command for live block commit, 'block-commit' block: helper function, to find the base image of a chain blockdev: rename block_stream_cb to a generic block_job_cb block: add live block commit functionality block: add support functions for live commit, to find and delete images. block: Support GlusterFS as a QEMU block backend. configure: Add a config option for GlusterFS as block backend aio: Another fix to the walking_handlers logic qemu: URI parsing library ... Conflicts: blockdev.c Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/030')
-rwxr-xr-xtests/qemu-iotests/03040
1 files changed, 38 insertions, 2 deletions
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 55b16f81d..dfacdf11a 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+import time
import os
import iotests
from iotests import qemu_img, qemu_io
@@ -98,6 +99,43 @@ class TestSingleDrive(ImageStreamingTestCase):
qemu_io('-c', 'map', test_img),
'image file map does not match backing file after streaming')
+ def test_stream_pause(self):
+ self.assert_no_active_streams()
+
+ result = self.vm.qmp('block-stream', device='drive0')
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.qmp('block-job-pause', device='drive0')
+ self.assert_qmp(result, 'return', {})
+
+ time.sleep(1)
+ result = self.vm.qmp('query-block-jobs')
+ offset = self.dictpath(result, 'return[0]/offset')
+
+ time.sleep(1)
+ result = self.vm.qmp('query-block-jobs')
+ self.assert_qmp(result, 'return[0]/offset', offset)
+
+ result = self.vm.qmp('block-job-resume', device='drive0')
+ self.assert_qmp(result, 'return', {})
+
+ completed = False
+ while not completed:
+ for event in self.vm.get_qmp_events(wait=True):
+ if event['event'] == 'BLOCK_JOB_COMPLETED':
+ self.assert_qmp(event, 'data/type', 'stream')
+ self.assert_qmp(event, 'data/device', 'drive0')
+ self.assert_qmp(event, 'data/offset', self.image_len)
+ self.assert_qmp(event, 'data/len', self.image_len)
+ completed = True
+
+ self.assert_no_active_streams()
+ self.vm.shutdown()
+
+ self.assertEqual(qemu_io('-c', 'map', backing_img),
+ qemu_io('-c', 'map', test_img),
+ 'image file map does not match backing file after streaming')
+
def test_stream_partial(self):
self.assert_no_active_streams()
@@ -173,8 +211,6 @@ class TestStreamStop(ImageStreamingTestCase):
os.remove(backing_img)
def test_stream_stop(self):
- import time
-
self.assert_no_active_streams()
result = self.vm.qmp('block-stream', device='drive0')