<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='...'/>
<backingStore type='file' index='1'>
<format type='raw'/> <!-- here is raw -->
<source file='...'/>
<backingStore/>
</backingStore>
</disk>
So, the difference in two xml not only in depth of backing stores but in format type also.
The result of it is that you can't run blockcommit that will commit overlay into base image if they don't have direct relations (if for example overlay is child of child of base image). Virsh says it can't find base in chain (
exception).
Then I got that libvirt stops calling
virStorageFileGetMetadataRecurse function after first call because it thinks that format of first backingStore of disk is raw instead of qcow2. I solved it by adding to the qemu config the following line:
allow_disk_format_probing = 1
But in qemu config it was marked as secure hole.
Idea of fix is that we can try assume that backing store of qcow is qcow insted of raw, but I really don't know what to do to implement this idea if it at all possible
Thanks!