mirror of https://github.com/xemu-project/xemu.git
qemu-iotests: add test for pausing a streaming operation
These check that a paused streaming job does not advance its offset. Sometimes the new test fails; the map is different between the source and the destination of the streaming because qemu-io does not always pack adjacent clusters that have the same allocated/unallocated state. However, this also happens with the existing test_stream testcase, and is better fixed in qemu-io. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
6e37fb811a
commit
0c81734765
|
@ -18,6 +18,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import time
|
||||||
import os
|
import os
|
||||||
import iotests
|
import iotests
|
||||||
from iotests import qemu_img, qemu_io
|
from iotests import qemu_img, qemu_io
|
||||||
|
@ -98,6 +99,43 @@ class TestSingleDrive(ImageStreamingTestCase):
|
||||||
qemu_io('-c', 'map', test_img),
|
qemu_io('-c', 'map', test_img),
|
||||||
'image file map does not match backing file after streaming')
|
'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):
|
def test_stream_partial(self):
|
||||||
self.assert_no_active_streams()
|
self.assert_no_active_streams()
|
||||||
|
|
||||||
|
@ -173,8 +211,6 @@ class TestStreamStop(ImageStreamingTestCase):
|
||||||
os.remove(backing_img)
|
os.remove(backing_img)
|
||||||
|
|
||||||
def test_stream_stop(self):
|
def test_stream_stop(self):
|
||||||
import time
|
|
||||||
|
|
||||||
self.assert_no_active_streams()
|
self.assert_no_active_streams()
|
||||||
|
|
||||||
result = self.vm.qmp('block-stream', device='drive0')
|
result = self.vm.qmp('block-stream', device='drive0')
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.......
|
........
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
Ran 7 tests
|
Ran 8 tests
|
||||||
|
|
||||||
OK
|
OK
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
027 rw auto quick
|
027 rw auto quick
|
||||||
028 rw backing auto
|
028 rw backing auto
|
||||||
029 rw auto quick
|
029 rw auto quick
|
||||||
030 rw auto
|
030 rw auto backing
|
||||||
031 rw auto quick
|
031 rw auto quick
|
||||||
032 rw auto
|
032 rw auto
|
||||||
033 rw auto
|
033 rw auto
|
||||||
|
|
Loading…
Reference in New Issue