All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: qemu-devel@nongnu.org,  qemu-block@nongnu.org,
	 eduardo@habkost.net, berrange@redhat.com,  pbonzini@redhat.com,
	 eblake@redhat.com, devel@lists.libvirt.org,  hreitz@redhat.com,
	 kwolf@redhat.com
Subject: Re: [PATCH v10 4/8] qapi: add blockdev-replace command
Date: Wed, 18 Feb 2026 07:25:16 +0100	[thread overview]
Message-ID: <87a4x6h8kz.fsf@pond.sub.org> (raw)
In-Reply-To: <04575653-a2ba-4ef1-b1af-a514bec80a69@yandex-team.ru> (Vladimir Sementsov-Ogievskiy's message of "Tue, 17 Feb 2026 20:55:49 +0300")

Block layer maintainers' advice sought:

Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:

> On 17.02.26 16:10, Markus Armbruster wrote:
>> Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
>> 
>>> On 14.02.26 11:04, Markus Armbruster wrote:

[...]

>>>> This interface sort of overloads @parent and @child, and overloading the
>>>> former creates ambiguity that can make the command unusable.
>>>
>>> Is it a real problem if we do deprecate the thing, that leads to this
>>> ambiguity?
>>>
>>> If it is, we may mark the command "unstable" during the deprecation period.
>> 
>> By itself, the proposed command is a trap for the unwary.
>> 
>> Deprecating the usage that enables the trap makes the trap temporary.
>> 
>> Warning on (deprecated) usage that enables the trap helps users avoid
>> it.  Human users, mostly.
>> 
>> Marking the command "unstable" should ensure management application
>> avoid the command, and thus the trap.
>> 
>> All of the above together feels acceptable to me.  Can we do better?
>> Maybe, and that's discussed below.
>> 
>>> Or even postpone its addition up to the end of this period.
>> 
>> No trap, no problem :)
>> 
>>>> @parent's set of valid values is the union of QOM path, block node name,
>>>> block export ID with values occuring in more than one of them dropped.
>>>>
>>>> @child's set of valid values depends on @parent: child name when it's a
>>>> QOM path, else "root".
>>>>
>>>> The obvious non-overloaded interface is a union of three branches: QOM,
>>>> block node, block export.  The QOM branch has variant members @qom-path
>>>> and @child.  The block node branch has variant member @node-name.  The
>>>> block export branch has variant member @id.
>>>>
>>>> This is a bit more verbose: you have to specify the union tag[*].
>>>>
>>>> If we ever need to replace block nodes associated with additional
>>>> things, we simply more branches.  These branches can have arbitrary
>>>> members.  In your interface, we'd have to make do with @child, or maybe
>>>> add optional arguments.
>>>>
>>>> Thoughts?  Mind, this isn't a demand!  I'm exploring the design space.
>>>
>>> Union-based solution was v9: https://lore.kernel.org/qemu-devel/20240626115350.405778-5-vsementsov@yandex-team.ru/
>>>
>>> And there was a discussion, that we may try a way without a union. And that's
>>> this v10.
>> 
>> I see Kevin suggested to explore this approach.  I certainly respect his
>> judgement.
>> 
>>> Hmm, but that had different field names for parents: qdev-id, export-id and node-name.
>>>
>>> What you suggest is to keep one filed for parent - "parent", but also add a "parent-type"
>>> field. This way, we may deprecate and remove "parent-type" in future. Or, we may
>>> add it as deprecated now (together with deprecating non-unique IDs)
>> 
>> We can't deprecate the union tag right away: it is *required*.
>> 
>>>> [*] We could add a "may omit union tag when the tag value can be derived
>>>> from present variant members" convenience feature to QAPI, but I'm not
>>>> sure it's worth the complexity.
>>>>
>>>
>>> It also may be not a union, but a simple structure with optional fields:
>>>
>>> {
>>>      parent: str, required, qom-path, or node-name, or export name
>>>      child: str, optional, but required when parent is node-name, and must be 'root'
>>>             if present for other parent types
>>>      parent-type: str, optional, "qom-path" | "block-node" | "block-export", helps to
>>>             overcome parent ambiguity, deprecated
>>>      new-child: str, required node-name
>>> }
>> 
>> PRO union: which members are valid together is syntactically obvious.
>> With a bunch of optional members, that information is in the member
>> descriptions.
>> 
>> CON union: need to specify the union tag.  The verbosity is a non-issue
>> for management applications, and mildly bothersome for humans.
>> 
>> How important is keeping things terse for humans here?
>> 
>
> It's not very important. Mostly, I just want to make "nice" interface, and possibility to
> reference any supported object by one ID seemed very tempting to me.
>
> But to be honest, introducing such a precedent makes sense, if we have in mind more
> cases where such approach may be reused. Personally, I don't have them. If blockdev-replace
> command remains the only API for the ages, which allows to mix in one field different kinds
> of IDs, it becomes just an extra exclusion from common practices.
>
> Finally, I don't care too much, which interface we chose. I'm not sure now that unifying
> ids is better than union. So I'm OK to go back to union-based solution from v9, update and
> resend it as v11.

Hanna, Kevin, got a preference?



  reply	other threads:[~2026-02-18  6:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19 14:49 [PATCH v10 0/8] blockdev-replace Vladimir Sementsov-Ogievskiy
2026-01-19 14:49 ` [PATCH v10 1/8] block-backend: blk_root(): drop const specifier on return type Vladimir Sementsov-Ogievskiy
2026-01-19 14:49 ` [PATCH v10 2/8] block/export: add blk_by_export_id() Vladimir Sementsov-Ogievskiy
2026-01-19 14:49 ` [PATCH v10 3/8] block: make bdrv_find_child() function public Vladimir Sementsov-Ogievskiy
2026-01-19 14:49 ` [PATCH v10 4/8] qapi: add blockdev-replace command Vladimir Sementsov-Ogievskiy
2026-02-04 12:26   ` Markus Armbruster
2026-02-05  7:30     ` Vladimir Sementsov-Ogievskiy
2026-02-14  8:04       ` Markus Armbruster
2026-02-16  5:48         ` Vladimir Sementsov-Ogievskiy
2026-02-17 13:10           ` Markus Armbruster
2026-02-17 17:55             ` Vladimir Sementsov-Ogievskiy
2026-02-18  6:25               ` Markus Armbruster [this message]
2026-02-19 21:30                 ` Kevin Wolf
2026-02-23  7:21                   ` Markus Armbruster
2026-01-19 14:49 ` [PATCH v10 5/8] block: bdrv_get_xdbg_block_graph(): report export ids Vladimir Sementsov-Ogievskiy
2026-01-19 14:49 ` [PATCH v10 6/8] iotests.py: introduce VM.assert_edges_list() method Vladimir Sementsov-Ogievskiy
2026-01-19 14:49 ` [PATCH v10 7/8] iotests: add filter-insertion Vladimir Sementsov-Ogievskiy
2026-01-19 14:49 ` [PATCH v10 8/8] deprecate names duplication between qdev, block-node and block-export Vladimir Sementsov-Ogievskiy
2026-01-22 16:01 ` [PATCH v11 " Vladimir Sementsov-Ogievskiy
2026-02-04 12:38   ` Markus Armbruster
2026-02-05  7:32     ` Vladimir Sementsov-Ogievskiy
2026-02-14  7:13       ` Markus Armbruster
2026-02-16  7:25         ` Vladimir Sementsov-Ogievskiy
2026-02-17 12:25           ` Markus Armbruster
2026-02-24 15:24   ` Hanna Czenczek

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=87a4x6h8kz.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=devel@lists.libvirt.org \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /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.