From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: John Snow <jsnow@redhat.com>, qemu-block@nongnu.org
Cc: kwolf@redhat.com, jcody@redhat.com, famz@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 5/5] iotests: add transactional failure race test
Date: Wed, 10 Aug 2016 18:19:37 +0300 [thread overview]
Message-ID: <57AB4609.6090206@virtuozzo.com> (raw)
In-Reply-To: <1470683381-16680-6-git-send-email-jsnow@redhat.com>
On 08.08.2016 22:09, John Snow wrote:
> Add a regression test for the case found by Vladimir.
>
> Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> tests/qemu-iotests/124 | 91 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/qemu-iotests/124.out | 4 +-
> 2 files changed, 93 insertions(+), 2 deletions(-)
>
> diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124
> index de7cdbe..a4a8c83 100644
> --- a/tests/qemu-iotests/124
> +++ b/tests/qemu-iotests/124
> @@ -509,6 +509,97 @@ class TestIncrementalBackup(TestIncrementalBackupBase):
> self.check_backups()
>
>
> + def test_transaction_failure_race(self):
> + '''Test: Verify that transactions with jobs that have no data to
> + transfer do not cause race conditions in the cancellation of the entire
> + transaction job group.
> + '''
> +
> + # Create a second drive, with pattern:
> + drive1 = self.add_node('drive1')
> + self.img_create(drive1['file'], drive1['fmt'])
> + io_write_patterns(drive1['file'], (('0x14', 0, 512),
> + ('0x5d', '1M', '32k'),
> + ('0xcd', '32M', '124k')))
> +
> + # Create a blkdebug interface to this img as 'drive1'
> + result = self.vm.qmp('blockdev-add', options={
> + 'id': drive1['id'],
> + 'driver': drive1['fmt'],
> + 'file': {
> + 'driver': 'blkdebug',
> + 'image': {
> + 'driver': 'file',
> + 'filename': drive1['file']
> + },
> + 'set-state': [{
> + 'event': 'flush_to_disk',
> + 'state': 1,
> + 'new_state': 2
> + }],
> + 'inject-error': [{
> + 'event': 'read_aio',
> + 'errno': 5,
> + 'state': 2,
> + 'immediately': False,
> + 'once': True
> + }],
> + }
> + })
> + self.assert_qmp(result, 'return', {})
> +
> + # Create bitmaps and full backups for both drives
> + drive0 = self.drives[0]
> + dr0bm0 = self.add_bitmap('bitmap0', drive0)
> + dr1bm0 = self.add_bitmap('bitmap0', drive1)
> + self.create_anchor_backup(drive0)
> + self.create_anchor_backup(drive1)
> + self.assert_no_active_block_jobs()
> + self.assertFalse(self.vm.get_qmp_events(wait=False))
> +
> + # Emulate some writes
> + self.hmp_io_writes(drive1['id'], (('0xba', 0, 512),
> + ('0xef', '16M', '256k'),
> + ('0x46', '32736k', '64k')))
> +
> + # Create incremental backup targets
> + target0 = self.prepare_backup(dr0bm0)
> + target1 = self.prepare_backup(dr1bm0)
> +
> + # Ask for a new incremental backup per-each drive, expecting drive1's
> + # backup to fail and attempt to cancel the empty drive0 job.
> + transaction = [
> + transaction_drive_backup(drive0['id'], target0, sync='incremental',
> + format=drive0['fmt'], mode='existing',
> + bitmap=dr0bm0.name),
> + transaction_drive_backup(drive1['id'], target1, sync='incremental',
> + format=drive1['fmt'], mode='existing',
> + bitmap=dr1bm0.name)
> + ]
> + result = self.vm.qmp('transaction', actions=transaction,
> + properties={'completion-mode': 'grouped'} )
> + self.assert_qmp(result, 'return', {})
> +
> + # Observe that drive0's backup is cancelled and drive1 completes with
> + # an error.
> + self.wait_qmp_backup_cancelled(drive0['id'])
> + self.assertFalse(self.wait_qmp_backup(drive1['id']))
> + error = self.vm.event_wait('BLOCK_JOB_ERROR')
> + self.assert_qmp(error, 'data', {'device': drive1['id'],
> + 'action': 'report',
> + 'operation': 'read'})
> + self.assertFalse(self.vm.get_qmp_events(wait=False))
> + self.assert_no_active_block_jobs()
> +
> + # Delete drive0's successful target and eliminate our record of the
> + # unsuccessful drive1 target.
> + dr0bm0.del_target()
> + dr1bm0.del_target()
> +
> + self.vm.shutdown()
> +
> +
> +
it is a almost duplication of test_transaction_failure, I think it would
be better to make separate do_test_transaction_failure with parameter
and two wrappers
> def test_sync_dirty_bitmap_missing(self):
> self.assert_no_active_block_jobs()
> self.files.append(self.err_img)
> diff --git a/tests/qemu-iotests/124.out b/tests/qemu-iotests/124.out
> index 36376be..e56cae0 100644
> --- a/tests/qemu-iotests/124.out
> +++ b/tests/qemu-iotests/124.out
> @@ -1,5 +1,5 @@
> -..........
> +...........
> ----------------------------------------------------------------------
> -Ran 10 tests
> +Ran 11 tests
>
> OK
--
Best regards,
Vladimir
next prev parent reply other threads:[~2016-08-10 15:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-08 19:09 [Qemu-devel] [PATCH 0/5] blockjobs: Fix transactional race condition John Snow
2016-08-08 19:09 ` [Qemu-devel] [PATCH 1/5] blockjob: fix dead pointer in txn list John Snow
2016-09-29 18:16 ` Eric Blake
2016-08-08 19:09 ` [Qemu-devel] [PATCH 2/5] blockjob: add block_job_start John Snow
2016-08-08 19:09 ` [Qemu-devel] [PATCH 3/5] blockjob: refactor backup_start as backup_job_create John Snow
2016-08-08 21:23 ` John Snow
2016-08-08 19:09 ` [Qemu-devel] [PATCH 4/5] blockjob: add .clean property John Snow
2016-08-08 19:09 ` [Qemu-devel] [PATCH 5/5] iotests: add transactional failure race test John Snow
2016-08-10 15:19 ` Vladimir Sementsov-Ogievskiy [this message]
2016-08-08 19:18 ` [Qemu-devel] [PATCH 0/5] blockjobs: Fix transactional race condition no-reply
2016-08-08 19:19 ` John Snow
[not found] ` <57E94491.8090501@virtuozzo.com>
[not found] ` <bf412a34-acb7-d3df-1710-ee7917ee2060@redhat.com>
2016-09-28 12:16 ` Vladimir Sementsov-Ogievskiy
2016-09-29 11:33 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2016-09-29 12:30 ` Stefan Hajnoczi
2016-09-29 20:58 ` John Snow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57AB4609.6090206@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).