From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Nir Soffer <nirsof@gmail.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Nir Soffer <nsoffer@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH v2 3/4] iotests: Add more qemu_img helpers
Date: Tue, 28 Jul 2020 16:50:12 +0300 [thread overview]
Message-ID: <398e7bd6-3bc6-f42a-0a9e-df8cc76e073d@virtuozzo.com> (raw)
In-Reply-To: <20200727215846.395443-4-nsoffer@redhat.com>
28.07.2020 00:58, Nir Soffer wrote:
> Add 2 helpers for measuring and checking images:
> - qemu_img_measure()
> - qemu_img_check()
>
> Both use --output-json and parse the returned json to make easy to use
> in other tests. I'm going to use them in a new test, and I hope they
> will be useful in may other tests.
>
> Signed-off-by: Nir Soffer <nsoffer@redhat.com>
> ---
> tests/qemu-iotests/iotests.py | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 8f79668435..717b5b652c 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -141,6 +141,12 @@ def qemu_img_create(*args):
>
> return qemu_img(*args)
>
> +def qemu_img_measure(*args):
> + return json.loads(qemu_img_pipe("measure", "--output", "json", *args))
> +
> +def qemu_img_check(*args):
> + return json.loads(qemu_img_pipe("check", "--output", "json", *args))
> +
qemu_img_pipe has type hints, so I assume we should add them here too.
Also, qemu-img don't report errors in json format, so in case of error, this will raise a problem about something that json can't parse. Probably we need better error handling.
Still, for 5.1 it's OK as is I think, so if we are in a hurry:
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> def qemu_img_verbose(*args):
> '''Run qemu-img without suppressing its output and return the exit code'''
> exitcode = subprocess.call(qemu_img_args + list(args))
>
--
Best regards,
Vladimir
next prev parent reply other threads:[~2020-07-28 13:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 21:58 [PATCH v2 0/4] Fix convert to qcow2 compressed to NBD Nir Soffer
2020-07-27 21:58 ` [PATCH v2 1/4] block: nbd: Fix convert qcow2 compressed to nbd Nir Soffer
2020-07-28 13:15 ` Vladimir Sementsov-Ogievskiy
2020-07-28 14:30 ` Eric Blake
2020-07-28 14:28 ` Eric Blake
2020-07-27 21:58 ` [PATCH v2 2/4] iotests: Make qemu_nbd_popen() a contextmanager Nir Soffer
2020-07-28 13:42 ` Vladimir Sementsov-Ogievskiy
2020-07-28 14:36 ` Eric Blake
2020-07-28 16:05 ` Nir Soffer
2020-08-05 7:38 ` Vladimir Sementsov-Ogievskiy
2020-08-05 8:47 ` Nir Soffer
2020-07-27 21:58 ` [PATCH v2 3/4] iotests: Add more qemu_img helpers Nir Soffer
2020-07-28 13:50 ` Vladimir Sementsov-Ogievskiy [this message]
2020-07-28 16:34 ` Nir Soffer
2020-07-27 21:58 ` [PATCH v2 4/4] iotests: Test convert to qcow2 compressed to NBD Nir Soffer
2020-07-28 14:45 ` Eric Blake
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=398e7bd6-3bc6-f42a-0a9e-df8cc76e073d@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=nirsof@gmail.com \
--cc=nsoffer@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).