From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu 3/3] blockdev: query file child QMP command
Date: Mon, 30 Jun 2025 14:43:11 +0200 [thread overview]
Message-ID: <1751287337.5ct5ta78ui.astroid@yuna.none> (raw)
In-Reply-To: <20250626160504.330350-4-f.ebner@proxmox.com>
On June 26, 2025 6:04 pm, Fiona Ebner wrote:
> There currently does not seem to be a good way to obtain information
> about the file child of a node, so add a custom command. The
> query-block and query-named-block-nodes commands lack the necessary
> info and while x-debug-query-block-graph exists, that is explicitly
> only for debugging and experimental.
>
> This is requried for e.g. blockdev-mirror in PVE to determine the
> node below the top throttle node.
>
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>
> Alternatively, we could think about adding the node name of the file
> child to the info returned by query-named-block-nodes. I can give that
> a shot and also ask upstream which approach is prefered.
that might be nice, or alternatively if we go with our custom solution
here for now - give it a prefixed name to avoid potential clashes with a
future upstream variant?
>
> blockdev.c | 22 ++++++++++++++++++++++
> qapi/block-core.json | 13 +++++++++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/blockdev.c b/blockdev.c
> index 17de5d2ae4..3be209767a 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -57,6 +57,7 @@
> #include "system/system.h"
> #include "system/iothread.h"
> #include "block/block_int.h"
> +#include "block/qapi.h"
> #include "block/trace.h"
> #include "system/runstate.h"
> #include "system/replay.h"
> @@ -2782,6 +2783,27 @@ XDbgBlockGraph *qmp_x_debug_query_block_graph(Error **errp)
> return bdrv_get_xdbg_block_graph(errp);
> }
>
> +BlockDeviceInfo *qmp_block_node_query_file_child(const char *node_name,
> + Error **errp)
> +{
> + GRAPH_RDLOCK_GUARD_MAINLOOP();
> +
> + BlockDriverState *bs;
> +
> + bs = bdrv_find_node(node_name);
> + if (!bs) {
> + error_setg(errp, "Failed to find node with node-name='%s'", node_name);
> + return NULL;
> + }
> +
> + if (!bs->file || !bs->file->bs) {
> + error_setg(errp, "Node '%s' has no 'file' child", node_name);
> + return NULL;
> + }
> +
> + return bdrv_block_device_info(NULL, bs->file->bs, false, errp);
> +}
> +
> void qmp_blockdev_backup(BlockdevBackup *backup, Error **errp)
> {
> TransactionAction action = {
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index f8ed564cf0..6c683b00ec 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -2463,6 +2463,19 @@
> 'features': [ 'unstable' ],
> 'allow-preconfig': true }
>
> +##
> +# @block-node-query-file-child:
> +#
> +# Get information about a child of the specified block node.
> +#
> +# @node-name: the block node name of the node to query.
> +#
> +# Returns: the BlockDeviceInfo of the file child.
> +##
> +{ 'command': 'block-node-query-file-child',
> + 'data': { 'node-name': 'str' },
> + 'returns': 'BlockDeviceInfo' }
> +
> ##
> # @drive-mirror:
> #
> --
> 2.47.2
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-06-30 12:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 16:04 [pve-devel] [PATCH-SERIES qemu 0/3] prepartion for blockdev Fiona Ebner
2025-06-26 16:04 ` [pve-devel] [PATCH qemu 1/3] PVE backup: prepare for the switch to using blockdev rather than drive Fiona Ebner
2025-06-26 16:04 ` [pve-devel] [PATCH qemu 2/3] block/zeroinit: support using as blockdev driver Fiona Ebner
2025-06-26 16:04 ` [pve-devel] [PATCH qemu 3/3] blockdev: query file child QMP command Fiona Ebner
2025-06-30 12:43 ` Fabian Grünbichler [this message]
2025-06-30 14:23 ` Fiona Ebner
2025-06-27 15:51 ` [pve-devel] [PATCH qemu 4/4] block/alloc-track: support using as blockdev driver Fiona Ebner
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=1751287337.5ct5ta78ui.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.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.