From: Eric Blake <eblake@redhat.com>
To: Thomas Huth <thuth@redhat.com>,
qemu-devel@nongnu.org, Peter Xu <peterx@redhat.com>
Cc: Amit Shah <amit@kernel.org>, Paolo Bonzini <pbonzini@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] tests: Introduce generic device hot-plug/hot-unplug functions
Date: Tue, 19 Sep 2017 08:38:00 -0500 [thread overview]
Message-ID: <f09b7bd0-2055-9f1c-4bb8-ab5f2bbf6837@redhat.com> (raw)
In-Reply-To: <1505328054-23805-1-git-send-email-thuth@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
On 09/13/2017 01:40 PM, Thomas Huth wrote:
> A lot of tests provide code for adding and removing a device via the
> device_add and device_del QMP commands. Maintaining this code in so many
> places is cumbersome and error-prone (some of the code parts check the
> responses for device deletion in an incorrect way, for example, we've got
> to deal with both, error code and DEVICE_DEL event here). So let's provide
> some proper generic functions for adding and removing a device instead.
>
> The code for correctly unplugging a device has been taken from a patch
> from Peter Xu.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> + */
> +void qtest_qmp_device_del(const char *id)
> +{
> + QDict *response1, *response2, *event = NULL;
> + char *cmd;
> +
> + cmd = g_strdup_printf("{'execute': 'device_del',"
> + " 'arguments': { 'id': '%s' }}", id);
> + response1 = qmp(cmd);
> + g_free(cmd);
> + g_assert(response1);
> + g_assert(!qdict_haskey(response1, "error"));
> +
> + response2 = qmp("");
Hmm, this new use of qmp("") means I get to rebase the efforts to remove
the empty qmp command usage from the testsuite efforts. We really want
to have two low-level functions (one to send, one to receive), and then
have qmp() be the combination of both in a row; we have qmp_async() for
the send, and only qtest_receive() for the receive, so I'll have to
revive my work on unifying things...
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2017-09-19 13:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-13 18:40 [Qemu-devel] [PATCH v2] tests: Introduce generic device hot-plug/hot-unplug functions Thomas Huth
2017-09-14 4:30 ` Peter Xu
2017-09-19 13:38 ` Eric Blake [this message]
2017-09-19 15:22 ` Thomas Huth
2017-09-19 15:37 ` 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=f09b7bd0-2055-9f1c-4bb8-ab5f2bbf6837@redhat.com \
--to=eblake@redhat.com \
--cc=amit@kernel.org \
--cc=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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 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).