On Wed, Nov 16, 2022 at 09:17:43 +0800, Jiatong Shen wrote:
> Hello Community,
>
> We are observing that after a blockcopy, the disk backend will inherit
> from original disk's cache mode configuration even though a new cache mode
> is given. Specifically, the function
> https://github.com/libvirt/libvirt/blob/cd94d891fb4b5cdda229f58b1dee261d5514082b/src/qemu/qemu_domain.c#L10887
> which eventually calls qemuDomainPrepareDiskSourceData and override input
> config.
> My question is is this on purpose? Because seems like qemu allows different
> configs.
> Thnak you very much for the help.
This is an historical artifact from the time when the block copy API
used the 'drive-mirror' QMP API of qemu which didn't allow configuring
any image specific parameters.
Nowadays we use 'blockdev-mirror' which takes an image instantiated via
'blockdev-add' which can configure everything the same way as the disk,
so it would be possible to honour the cache mode as specified in the
block copy XML.
Note that if you intend to implement it, the code must still preserve
the original cache mode if the user doesn't specify it in the XML.