* [Qemu-devel] [PATCH] block: Allow node name for 'qemu-io' HMP command
@ 2016-08-19 16:46 Kevin Wolf
2016-08-31 2:31 ` Eric Blake
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2016-08-19 16:46 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, qemu-devel
When using a node name, create a temporary BlockBackend that is used to
run the qemu-io command.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hmp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hmp.c b/hmp.c
index a7dfe6f..ad33b44 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1923,11 +1923,22 @@ void hmp_chardev_remove(Monitor *mon, const QDict *qdict)
void hmp_qemu_io(Monitor *mon, const QDict *qdict)
{
BlockBackend *blk;
+ BlockBackend *local_blk = NULL;
const char* device = qdict_get_str(qdict, "device");
const char* command = qdict_get_str(qdict, "command");
Error *err = NULL;
blk = blk_by_name(device);
+ if (!blk) {
+ BlockDriverState *bs = bdrv_lookup_bs(NULL, device, &err);
+ if (bs) {
+ blk = local_blk = blk_new();
+ blk_insert_bs(blk, bs);
+ } else {
+ goto fail;
+ }
+ }
+
if (blk) {
AioContext *aio_context = blk_get_aio_context(blk);
aio_context_acquire(aio_context);
@@ -1940,6 +1951,8 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
"Device '%s' not found", device);
}
+fail:
+ blk_unref(local_blk);
hmp_handle_error(mon, &err);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Allow node name for 'qemu-io' HMP command
2016-08-19 16:46 [Qemu-devel] [PATCH] block: Allow node name for 'qemu-io' HMP command Kevin Wolf
@ 2016-08-31 2:31 ` Eric Blake
0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2016-08-31 2:31 UTC (permalink / raw)
To: Kevin Wolf, qemu-block; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 429 bytes --]
On 08/19/2016 11:46 AM, Kevin Wolf wrote:
> When using a node name, create a temporary BlockBackend that is used to
> run the qemu-io command.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> hmp.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-31 2:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-19 16:46 [Qemu-devel] [PATCH] block: Allow node name for 'qemu-io' HMP command Kevin Wolf
2016-08-31 2:31 ` Eric Blake
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).