All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: armbru@redhat.com, mreitz@redhat.com, kwolf@redhat.com,
	pbonzini@redhat.com, den@openvz.org
Subject: Re: [Qemu-devel] [PATCH v4 10/10] iotests: test nbd reconnect
Date: Wed, 16 Jan 2019 11:11:23 -0600	[thread overview]
Message-ID: <bc4780d7-dc96-e050-dfe0-1a47d99893d5@redhat.com> (raw)
In-Reply-To: <20180731173033.75467-11-vsementsov@virtuozzo.com>

[-- Attachment #1: Type: text/plain, Size: 4466 bytes --]

On 7/31/18 12:30 PM, Vladimir Sementsov-Ogievskiy wrote:
> Add test, which starts backup to nbd target and restarts nbd server
> during backup.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  tests/qemu-iotests/220        | 67 +++++++++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/220.out    |  7 +++++
>  tests/qemu-iotests/group      |  1 +
>  tests/qemu-iotests/iotests.py |  4 +++
>  4 files changed, 79 insertions(+)
>  create mode 100755 tests/qemu-iotests/220
>  create mode 100644 tests/qemu-iotests/220.out
> 

Test 220 has been created in the meantime; the obvious resolution is to
pick a new test number.

> diff --git a/tests/qemu-iotests/220 b/tests/qemu-iotests/220
> new file mode 100755
> index 0000000000..c9702a7dad
> --- /dev/null
> +++ b/tests/qemu-iotests/220
> @@ -0,0 +1,67 @@
> +#!/usr/bin/env python

> +
> +import iotests
> +from iotests import qemu_img_create, file_path, qemu_nbd_popen
> +
> +disk_a, disk_b, nbd_sock = file_path('disk_a', 'disk_b', 'nbd-sock')
> +nbd_uri = 'nbd+unix:///exp?socket=' + nbd_sock
> +
> +qemu_img_create('-f', iotests.imgfmt, disk_a, '5M')
> +qemu_img_create('-f', iotests.imgfmt, disk_b, '5M')
> +srv = qemu_nbd_popen('-k', nbd_sock, '-x', 'exp', '-f', iotests.imgfmt, disk_b)
> +time.sleep(1)
> +
> +vm = iotests.VM().add_drive(disk_a)
> +vm.launch()
> +vm.hmp_qemu_io('drive0', 'write 0 5M')
> +
> +print 'blockdev-add:', vm.qmp('blockdev-add', node_name='backup0', driver='raw',
> +                              file={'driver':'nbd',
> +                                    'export': 'exp',
> +                                    'server': {'type': 'unix',
> +                                               'path': nbd_sock}})
> +print 'blockdev-backup:', vm.qmp('blockdev-backup', device='drive0',
> +                                 sync='full', target='backup0')
> +
> +time.sleep(1)
> +print 'Kill NBD server'
> +srv.kill()
> +
> +jobs = vm.qmp('query-block-jobs')['return']
> +if jobs and jobs[0]['offset'] < jobs[0]['len']:
> +    print 'Backup job is still in progress'
> +
> +time.sleep(1)

That's a lot of sleep()s for a test marked quick. Are we sure it won't
fail under heavy load? Can you make the test more reliable by looking
for specific events rather than just a fixed-length sleep?

> +
> +print 'Start NBD server'
> +srv = qemu_nbd_popen('-k', nbd_sock, '-x', 'exp', '-f', iotests.imgfmt, disk_b)
> +
> +try:
> +    e = vm.event_wait('BLOCK_JOB_COMPLETED')
> +    print e['event'], ':', e['data']
> +except:
> +    pass
> +
> +print 'blockdev-del:', vm.qmp('blockdev-del', node_name='backup0')
> +srv.kill()
> +vm.shutdown()
> diff --git a/tests/qemu-iotests/220.out b/tests/qemu-iotests/220.out
> new file mode 100644
> index 0000000000..dae1a49d9f
> --- /dev/null
> +++ b/tests/qemu-iotests/220.out
> @@ -0,0 +1,7 @@
> +blockdev-add: {u'return': {}}
> +blockdev-backup: {u'return': {}}
> +Kill NBD server
> +Backup job is still in progress
> +Start NBD server
> +BLOCK_JOB_COMPLETED : {u'device': u'drive0', u'type': u'backup', u'speed': 0, u'len': 5242880, u'offset': 5242880}
> +blockdev-del: {u'return': {}}
> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
> index b973dc842d..ee2473c6a3 100644
> --- a/tests/qemu-iotests/group
> +++ b/tests/qemu-iotests/group
> @@ -219,6 +219,7 @@
>  217 rw auto quick
>  218 rw auto quick
>  219 rw auto
> +220 rw auto quick
>  221 rw auto quick
>  222 rw auto quick
>  223 rw auto quick
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 4e67fbbe96..17bc8c8e32 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -185,6 +185,10 @@ def qemu_nbd(*args):
>      '''Run qemu-nbd in daemon mode and return the parent's exit code'''
>      return subprocess.call(qemu_nbd_args + ['--fork'] + list(args))
>  
> +def qemu_nbd_popen(*args):
> +    '''Run qemu-nbd in daemon mode and return the parent's exit code'''
> +    return subprocess.Popen(qemu_nbd_args + ['--persistent'] + list(args))
> +
>  def compare_images(img1, img2, fmt1=imgfmt, fmt2=imgfmt):
>      '''Return True if two image files are identical'''
>      return qemu_img('compare', '-f', fmt1,
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-01-16 17:11 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31 17:30 [Qemu-devel] [PATCH v4 00/10] NBD reconnect Vladimir Sementsov-Ogievskiy
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 01/10] block/nbd-client: split channel errors from export errors Vladimir Sementsov-Ogievskiy
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 02/10] block/nbd: move connection code from block/nbd to block/nbd-client Vladimir Sementsov-Ogievskiy
2019-01-16 15:56   ` Eric Blake
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 03/10] block/nbd-client: split connection from initialization Vladimir Sementsov-Ogievskiy
2019-01-16 15:52   ` Eric Blake
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 04/10] block/nbd-client: fix nbd_reply_chunk_iter_receive Vladimir Sementsov-Ogievskiy
2019-01-16 16:01   ` Eric Blake
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 05/10] block/nbd-client: don't check ioc Vladimir Sementsov-Ogievskiy
2019-01-16 16:05   ` Eric Blake
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 06/10] block/nbd-client: move from quit to state Vladimir Sementsov-Ogievskiy
2019-01-16 16:25   ` Eric Blake
2019-01-16 16:58     ` Daniel P. Berrangé
2019-02-05 16:35       ` Vladimir Sementsov-Ogievskiy
2019-02-06  8:51         ` Vladimir Sementsov-Ogievskiy
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 07/10] block/nbd-client: rename read_reply_co to connection_co Vladimir Sementsov-Ogievskiy
2019-01-16 16:35   ` Eric Blake
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 08/10] block/nbd: add cmdline and qapi parameter reconnect-delay Vladimir Sementsov-Ogievskiy
2019-01-04 22:25   ` Eric Blake
2019-02-05 16:48     ` Vladimir Sementsov-Ogievskiy
2019-04-11 15:47     ` Vladimir Sementsov-Ogievskiy
2019-04-11 15:47       ` Vladimir Sementsov-Ogievskiy
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 09/10] block/nbd-client: nbd reconnect Vladimir Sementsov-Ogievskiy
2018-11-02 12:39   ` Vladimir Sementsov-Ogievskiy
2019-01-16 17:04   ` Eric Blake
2019-02-05 17:07     ` Vladimir Sementsov-Ogievskiy
2019-02-05 17:15       ` Eric Blake
2018-07-31 17:30 ` [Qemu-devel] [PATCH v4 10/10] iotests: test " Vladimir Sementsov-Ogievskiy
2019-01-16 17:11   ` Eric Blake [this message]
2019-04-11 16:02     ` Vladimir Sementsov-Ogievskiy
2019-04-11 16:02       ` Vladimir Sementsov-Ogievskiy
     [not found] ` <fc24ba9e-e325-6478-cb22-bc0a256c6e87@virtuozzo.com>
2018-10-09 19:33   ` [Qemu-devel] [Qemu-block] [PATCH v4 00/10] NBD reconnect John Snow
2018-10-09 21:59     ` Vladimir Sementsov-Ogievskiy
2018-12-12 10:33 ` [Qemu-devel] ping " Vladimir Sementsov-Ogievskiy
2018-12-29 12:23 ` [Qemu-devel] ping3 " Vladimir Sementsov-Ogievskiy

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=bc4780d7-dc96-e050-dfe0-1a47d99893d5@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.