-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1 iQIcBAABAgAGBQJW+dDJAAoJEL2+eyfA3jBXk6oP/R/zX4foUVFMTvDbxHwWc41t gXGk1BpIjFnteab/tzUBDIdgs/DPxzM6bClhe45gNInVBgnOyeVmpUwRGGNYQKbn FdkrAcC6Vy6BJv+xRTMMS+h4i6ebJ6HqqQPwkz0VulxsAknDPQsBebe0tM8uO7k9 G+ccMYOyUUiGTIRC3pBkRCu8APEialPSv3MpUTMtp71R3US+pEwmo1AgyOFq/lDu B/8LUBoR48XCEGfOA6ZixzoMwF1lTWpezx5/KF+fQ26sgnNzjpwYWnJk+LG7Gtvj 8PHYsHDoXSISlIgxzLpS0AA6s54+mutgIeNJG5FBXGrSSNlAB1+cKZsnZw42YjfI BVIHQkmcGT+h9UEDdekiOfQorypSYRm51ueTGO/lUbxNifvJ5LQA97F0G/filoCj ovGIfOwgpWaEBPCb//U1TRGhhTg+dNyCeC4GoxDEFyWmLPYp8p7Xtz+vsZOIdH4O Wl9i6BzzeNEgJyutKqn2qpNLl6Pfd548MOJJqAUkGxDGrCJMkmn2lJSpSSji6cdm y4Az/tPY0/xpxwjSRakaIMOlhDoGXmrQG+I6JG1TZLSH7x1+Ajhr2ryx4CBONceV 1quibAqoG1GwxCyYn7dv4aeJrDlg3XzEWQW6nJhuE91d9ZH+jF5u2+i+IZcQCDBe Cd6d0SZlcOnq3M5LiOrA =1ekF -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging # gpg: Signature made Tue 29 Mar 2016 01:48:09 BST using RSA key ID C0DE3057 # gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>" # gpg: aka "Jeffrey Cody <jeff@codyprime.org>" # gpg: aka "Jeffrey Cody <codyprime@gmail.com>" * remotes/cody/tags/block-pull-request: qemu-iotests: add no-op streaming test qemu-iotests: fix test_stream_partial() block: never cancel a streaming job without running stream_complete() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
553934db66
@ -90,21 +90,21 @@ static void coroutine_fn stream_run(void *opaque)
|
|||||||
StreamCompleteData *data;
|
StreamCompleteData *data;
|
||||||
BlockDriverState *bs = s->common.bs;
|
BlockDriverState *bs = s->common.bs;
|
||||||
BlockDriverState *base = s->base;
|
BlockDriverState *base = s->base;
|
||||||
int64_t sector_num, end;
|
int64_t sector_num = 0;
|
||||||
|
int64_t end = -1;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
void *buf;
|
void *buf;
|
||||||
|
|
||||||
if (!bs->backing) {
|
if (!bs->backing) {
|
||||||
block_job_completed(&s->common, 0);
|
goto out;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s->common.len = bdrv_getlength(bs);
|
s->common.len = bdrv_getlength(bs);
|
||||||
if (s->common.len < 0) {
|
if (s->common.len < 0) {
|
||||||
block_job_completed(&s->common, s->common.len);
|
ret = s->common.len;
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
end = s->common.len >> BDRV_SECTOR_BITS;
|
end = s->common.len >> BDRV_SECTOR_BITS;
|
||||||
@ -191,6 +191,7 @@ wait:
|
|||||||
|
|
||||||
qemu_vfree(buf);
|
qemu_vfree(buf);
|
||||||
|
|
||||||
|
out:
|
||||||
/* Modify backing chain and close BDSes in main loop */
|
/* Modify backing chain and close BDSes in main loop */
|
||||||
data = g_malloc(sizeof(*data));
|
data = g_malloc(sizeof(*data));
|
||||||
data->ret = ret;
|
data->ret = ret;
|
||||||
|
@ -35,6 +35,7 @@ class TestSingleDrive(iotests.QMPTestCase):
|
|||||||
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, mid_img)
|
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, mid_img)
|
||||||
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % mid_img, test_img)
|
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % mid_img, test_img)
|
||||||
qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 512', backing_img)
|
qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 512', backing_img)
|
||||||
|
qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 524288 512', mid_img)
|
||||||
self.vm = iotests.VM().add_drive("blkdebug::" + test_img)
|
self.vm = iotests.VM().add_drive("blkdebug::" + test_img)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
|
||||||
@ -90,10 +91,28 @@ class TestSingleDrive(iotests.QMPTestCase):
|
|||||||
qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img),
|
qemu_io('-f', iotests.imgfmt, '-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_no_op(self):
|
||||||
|
self.assert_no_active_block_jobs()
|
||||||
|
|
||||||
|
# The image map is empty before the operation
|
||||||
|
empty_map = qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img)
|
||||||
|
|
||||||
|
# This is a no-op: no data should ever be copied from the base image
|
||||||
|
result = self.vm.qmp('block-stream', device='drive0', base=mid_img)
|
||||||
|
self.assert_qmp(result, 'return', {})
|
||||||
|
|
||||||
|
self.wait_until_completed()
|
||||||
|
|
||||||
|
self.assert_no_active_block_jobs()
|
||||||
|
self.vm.shutdown()
|
||||||
|
|
||||||
|
self.assertEqual(qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img),
|
||||||
|
empty_map, 'image file map changed after a no-op')
|
||||||
|
|
||||||
def test_stream_partial(self):
|
def test_stream_partial(self):
|
||||||
self.assert_no_active_block_jobs()
|
self.assert_no_active_block_jobs()
|
||||||
|
|
||||||
result = self.vm.qmp('block-stream', device='drive0', base=mid_img)
|
result = self.vm.qmp('block-stream', device='drive0', base=backing_img)
|
||||||
self.assert_qmp(result, 'return', {})
|
self.assert_qmp(result, 'return', {})
|
||||||
|
|
||||||
self.wait_until_completed()
|
self.wait_until_completed()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.............
|
..............
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
Ran 13 tests
|
Ran 14 tests
|
||||||
|
|
||||||
OK
|
OK
|
||||||
|
Loading…
Reference in New Issue
Block a user