
ping 02.08.2021 21:54, Vladimir Sementsov-Ogievskiy wrote:
Hi all!
As a continuation of "Qemu block filter insertion/removal API" discussion, here is my proposal of blockdev-replace.
The realization allows:
- replace children of different parents: BDS, block devices, block exports
- automatically replace all parents of specific BDS, excluding creating loops (like bdrv_replace_node())
- do several replacements in one transaction
It's an untested draft, so you may go to patch 8, to look at QAPI addition.
Vladimir Sementsov-Ogievskiy (8): block-backend: blk_root(): drop const specifier on return type block: add BlockParentClass class block: realize BlockParentClass for BlockDriverState block/export: realize BlockParentClass functionality qdev: improve find_device_state() to distinguish simple not found case qdev: realize BlockParentClass block: improve bdrv_replace_node_noperm() qapi: add blockdev-replace command
qapi/block-core.json | 78 ++++++++++++++++ include/block/block-parent.h | 32 +++++++ include/sysemu/block-backend.h | 2 +- block.c | 158 ++++++++++++++++++++++++++++++++- block/block-backend.c | 2 +- block/block-parent.c | 66 ++++++++++++++ block/export/export.c | 44 +++++++++ softmmu/qdev-monitor.c | 90 +++++++++++++++---- block/meson.build | 1 + 9 files changed, 453 insertions(+), 20 deletions(-) create mode 100644 include/block/block-parent.h create mode 100644 block/block-parent.c
-- Best regards, Vladimir