To break the chicken and egg problem loop between qemu and libvirt in using new features introduce experimental support for blockdev-reopen (or actually x-blockdev-reopen for the time being). This patchset adds QEMU_CAPS_BLOCKDEV_REOPEN capability which is currently not asserted until qemu stabilizes the blockdev-reopen interface but implements all the handlers to use it. This is a similar approach we used to add all of the bits required to use -blockdev with qemu. To show it's usefullnes two real problems are addressed using reopening: - Checkpoint deletion in backing chain, where we need to reopen the read-only backing images to allow modification of bitmaps. Using this approach will prevent qemu from having to introduce yet another ad-hoc interface to deal with the bitmaps. (note that checkpoints are also experimental themselves since they are part of the not-yet-finished incremental backup feature) - Late open of backing files for virDomainBlockCopy oVirt abuses a quirk in the old handling of block-copy when drive-mirror is used as qemu opens the backing images of the destination of the copy only once block-job-complete is called. Without blockdev-reopen it's impossible to replicate the old semantics as we need to install a backing file for the mirror copy and that is possible only using blockdev-reopen. (this change will stay disabled until blockdev-reopen is stabilized) There are a few other problems which this will deal with mostly related to bitmap handling which would also require ad-hoc qemu functionality otherwise. Since we have an existing interface we can show we are willing to use it to prevent wasting more engieering on qemu's side on partial solutions. This patchset applies on top of: https://www.redhat.com/archives/libvir-list/2020-February/msg01062.html It can be fetched from my repo: git fetch https://gitlab.com/pipo.sk/libvirt.git reopen-impl https://gitlab.com/pipo.sk/libvirt/-/commits/reopen-impl Note the above branch contains also patches which enable the feature and also enable incremental backup to facilitate simple testing without the need to use the qemu namespace. Successful use requires the following qemu patches: https://lists.gnu.org/archive/html/qemu-block/2020-02/msg01423.html https://lists.gnu.org/archive/html/qemu-block/2020-02/msg01467.html A qemu repo containing the above patches and patch to enable the detection done in my private brnch mentioned above can be fetched at: git fetch https://gitlab.com/pipo.sk/qemu.git bitmap-reopen https://gitlab.com/pipo.sk/qemu/-/commits/bitmap-reopen Peter Krempa (8): qemu: capabilities: Add QEMU_CAPS_BLOCKDEV_REOPEN qemu: monitor: Add handler for blockdev-reopen qemu: block: implement helpers for blockdev-reopen qemuCheckpointDiscardBitmaps: Reopen images for bitmap modifications qemuCheckpointDiscardBitmaps: Use correct field for checkpoint bitmap name qemuDomainBlockPivot: Move check prior to executing the pivot steps qemuDomainBlockCopyCommon: Record updated flags to block job qemu: blockcopy: Allow late opening of the backing chain of a shallow copy src/qemu/qemu_block.c | 121 +++++++++++++++++++++++++++++++++++ src/qemu/qemu_block.h | 14 ++++ src/qemu/qemu_capabilities.c | 1 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_checkpoint.c | 6 +- src/qemu/qemu_driver.c | 67 ++++++++++++++++--- src/qemu/qemu_monitor.c | 13 ++++ src/qemu/qemu_monitor.h | 3 + src/qemu/qemu_monitor_json.c | 21 ++++++ src/qemu/qemu_monitor_json.h | 4 ++ 10 files changed, 241 insertions(+), 10 deletions(-) -- 2.24.1