Message ID | 20220614102910.1431380-8-vsementsov@yandex-team.ru |
---|---|
State | New |
Headers | show |
Series | [PULL,01/10] block/copy-before-write: refactor option parsing | expand |
On 14/06/2022 12.29, Vladimir Sementsov-Ogievskiy wrote: > From: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> > > Add two simple test-cases: timeout failure with > break-snapshot-on-cbw-error behavior and similar with > break-guest-write-on-cbw-error behavior. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> > Reviewed-by: Hanna Reitz <hreitz@redhat.com> > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> > --- > tests/qemu-iotests/tests/copy-before-write | 81 +++++++++++++++++++ > .../qemu-iotests/tests/copy-before-write.out | 4 +- > 2 files changed, 83 insertions(+), 2 deletions(-) Hi! Seems like this test is failing in the CI on FreeBSD and macOS: https://gitlab.com/qemu-project/qemu/-/jobs/2670729995#L5763 https://gitlab.com/qemu-project/qemu/-/jobs/2670729993#L3247 Could you please have a look? Thanks, Thomas
On 7/5/22 12:03, Thomas Huth wrote: > On 14/06/2022 12.29, Vladimir Sementsov-Ogievskiy wrote: >> From: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> >> >> Add two simple test-cases: timeout failure with >> break-snapshot-on-cbw-error behavior and similar with >> break-guest-write-on-cbw-error behavior. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> >> Reviewed-by: Hanna Reitz <hreitz@redhat.com> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> >> --- >> tests/qemu-iotests/tests/copy-before-write | 81 +++++++++++++++++++ >> .../qemu-iotests/tests/copy-before-write.out | 4 +- >> 2 files changed, 83 insertions(+), 2 deletions(-) > > Hi! > > Seems like this test is failing in the CI on FreeBSD and macOS: > > https://gitlab.com/qemu-project/qemu/-/jobs/2670729995#L5763 > https://gitlab.com/qemu-project/qemu/-/jobs/2670729993#L3247 > > Could you please have a look? > +AssertionError: 'wrot[102 chars]led: Operation timed out\nread 1048576/1048576[72 chars]c)\n' != 'wrot[102 chars]led: Connection timed out\nread 1048576/104857[73 chars]c)\n' + wrote 524288/524288 bytes at offset 0 + 512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +- write failed: Operation timed out +? ^^ ^^ ++ write failed: Connection timed out +? ^^^^ ^ Seems just different representation of ETIMEDOUT error. I'll send a patch to allow both variants.
On 05/07/2022 11.03, Thomas Huth wrote: > On 14/06/2022 12.29, Vladimir Sementsov-Ogievskiy wrote: >> From: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> >> >> Add two simple test-cases: timeout failure with >> break-snapshot-on-cbw-error behavior and similar with >> break-guest-write-on-cbw-error behavior. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> >> Reviewed-by: Hanna Reitz <hreitz@redhat.com> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> >> --- >> tests/qemu-iotests/tests/copy-before-write | 81 +++++++++++++++++++ >> .../qemu-iotests/tests/copy-before-write.out | 4 +- >> 2 files changed, 83 insertions(+), 2 deletions(-) > > Hi! > > Seems like this test is failing in the CI on FreeBSD and macOS: > > https://gitlab.com/qemu-project/qemu/-/jobs/2670729995#L5763 > https://gitlab.com/qemu-project/qemu/-/jobs/2670729993#L3247 > > Could you please have a look? I just hit another failure, this time in a restricted build: +FFFF +====================================================================== +FAIL: test_break_guest_write_on_cbw_error (__main__.TestCbwError) +break-guest-write behavior: +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/home/thuth/devel/qemu/tests/qemu-iotests/tests/copy-before-write", line 124, in test_break_guest_write_on_cbw_error + log = self.do_cbw_error('break-guest-write') + File "/home/thuth/devel/qemu/tests/qemu-iotests/tests/copy-before-write", line 82, in do_cbw_error + self.assert_qmp(result, 'return', {}) + File "/home/thuth/devel/qemu/tests/qemu-iotests/iotests.py", line 1190, in assert_qmp + result = self.dictpath(d, path) + File "/home/thuth/devel/qemu/tests/qemu-iotests/iotests.py", line 1164, in dictpath + self.fail(f'failed path traversal for "{path}" in "{d}"') +AssertionError: failed path traversal for "return" in "{'error': {'class': 'GenericError', 'desc': "Driver 'copy-before-write' is not whitelisted"}}" I think you need to check for the availability of the driver first, like it is e.g. done in the image-fleecing test? Thomas
On 7/6/22 19:22, Thomas Huth wrote: > On 05/07/2022 11.03, Thomas Huth wrote: >> On 14/06/2022 12.29, Vladimir Sementsov-Ogievskiy wrote: >>> From: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> >>> >>> Add two simple test-cases: timeout failure with >>> break-snapshot-on-cbw-error behavior and similar with >>> break-guest-write-on-cbw-error behavior. >>> >>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> >>> Reviewed-by: Hanna Reitz <hreitz@redhat.com> >>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> >>> --- >>> tests/qemu-iotests/tests/copy-before-write | 81 +++++++++++++++++++ >>> .../qemu-iotests/tests/copy-before-write.out | 4 +- >>> 2 files changed, 83 insertions(+), 2 deletions(-) >> >> Hi! >> >> Seems like this test is failing in the CI on FreeBSD and macOS: >> >> https://gitlab.com/qemu-project/qemu/-/jobs/2670729995#L5763 >> https://gitlab.com/qemu-project/qemu/-/jobs/2670729993#L3247 >> >> Could you please have a look? > > I just hit another failure, this time in a restricted build: > > +FFFF > +====================================================================== > +FAIL: test_break_guest_write_on_cbw_error (__main__.TestCbwError) > +break-guest-write behavior: > +---------------------------------------------------------------------- > +Traceback (most recent call last): > + File "/home/thuth/devel/qemu/tests/qemu-iotests/tests/copy-before-write", line 124, in test_break_guest_write_on_cbw_error > + log = self.do_cbw_error('break-guest-write') > + File "/home/thuth/devel/qemu/tests/qemu-iotests/tests/copy-before-write", line 82, in do_cbw_error > + self.assert_qmp(result, 'return', {}) > + File "/home/thuth/devel/qemu/tests/qemu-iotests/iotests.py", line 1190, in assert_qmp > + result = self.dictpath(d, path) > + File "/home/thuth/devel/qemu/tests/qemu-iotests/iotests.py", line 1164, in dictpath > + self.fail(f'failed path traversal for "{path}" in "{d}"') > +AssertionError: failed path traversal for "return" in "{'error': {'class': 'GenericError', 'desc': "Driver 'copy-before-write' is not whitelisted"}}" > > I think you need to check for the availability of the driver first, like it is e.g. done in the image-fleecing test? > Oh, right!
diff --git a/tests/qemu-iotests/tests/copy-before-write b/tests/qemu-iotests/tests/copy-before-write index 6c7638965e..f01f26f01c 100755 --- a/tests/qemu-iotests/tests/copy-before-write +++ b/tests/qemu-iotests/tests/copy-before-write @@ -126,6 +126,87 @@ read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) """) + def do_cbw_timeout(self, on_cbw_error): + result = self.vm.qmp('object-add', { + 'qom-type': 'throttle-group', + 'id': 'group0', + 'limits': {'bps-write': 300 * 1024} + }) + self.assert_qmp(result, 'return', {}) + + result = self.vm.qmp('blockdev-add', { + 'node-name': 'cbw', + 'driver': 'copy-before-write', + 'on-cbw-error': on_cbw_error, + 'cbw-timeout': 1, + 'file': { + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': source_img, + } + }, + 'target': { + 'driver': 'throttle', + 'throttle-group': 'group0', + 'file': { + 'driver': 'qcow2', + 'file': { + 'driver': 'file', + 'filename': temp_img + } + } + } + }) + self.assert_qmp(result, 'return', {}) + + result = self.vm.qmp('blockdev-add', { + 'node-name': 'access', + 'driver': 'snapshot-access', + 'file': 'cbw' + }) + self.assert_qmp(result, 'return', {}) + + result = self.vm.qmp('human-monitor-command', + command_line='qemu-io cbw "write 0 512K"') + self.assert_qmp(result, 'return', '') + + # We need second write to trigger throttling + result = self.vm.qmp('human-monitor-command', + command_line='qemu-io cbw "write 512K 512K"') + self.assert_qmp(result, 'return', '') + + result = self.vm.qmp('human-monitor-command', + command_line='qemu-io access "read 0 1M"') + self.assert_qmp(result, 'return', '') + + self.vm.shutdown() + log = self.vm.get_log() + log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log) + log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log) + log = iotests.filter_qemu_io(log) + return log + + def test_timeout_break_guest(self): + log = self.do_cbw_timeout('break-guest-write') + self.assertEqual(log, """\ +wrote 524288/524288 bytes at offset 0 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +write failed: Connection timed out +read 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +""") + + def test_timeout_break_snapshot(self): + log = self.do_cbw_timeout('break-snapshot') + self.assertEqual(log, """\ +wrote 524288/524288 bytes at offset 0 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 524288/524288 bytes at offset 524288 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read failed: Permission denied +""") + if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'], diff --git a/tests/qemu-iotests/tests/copy-before-write.out b/tests/qemu-iotests/tests/copy-before-write.out index fbc63e62f8..89968f35d7 100644 --- a/tests/qemu-iotests/tests/copy-before-write.out +++ b/tests/qemu-iotests/tests/copy-before-write.out @@ -1,5 +1,5 @@ -.. +.... ---------------------------------------------------------------------- -Ran 2 tests +Ran 4 tests OK