blockcommit does not persist changes
Software environment
- Operating system: 20.04.3 LTS (Focal Fossa)
- Architecture: x86_64
- kernel version: Linux 5.4.0-89-generic #100 (closed)-Ubuntu SMP Fri Sep 24 14:50:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
- libvirt version: libvirtd (libvirt) 6.0.0
- Hypervisor and version: QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.18)
Description of problem
using blockcommit does not persist a reboot of the domain, the --delete option removes the "unnecessary" image files, domain is not able to start.
Steps to reproduce
- create a domain (using terraform and cloud-init)
- consolidate the disk chain to use a single disk image
- shutdown the domain
- start the domain
Additional information
documentation used for blockcommit
# get domain info
DOMAIN_NAME="test"
#get initial state
virsh domblklist ${DOMAIN_NAME}
Target Source
----------------------------------------------------
vda test-rootfs.qcow2
hdd /data/libvirt/pools/disk-images/test.iso
#do the blockcommit
virsh blockcommit ${DOMAIN_NAME} $(virsh domblklist ${DOMAIN_NAME} | awk '/.*.qcow2/{print $1}') --verbose --pivot --delete --active
Block commit: [100 %]
Successfully pivoted
#state after block commit
virsh domblklist ${DOMAIN_NAME}
Target Source
------------------------------------------------------
vda /data/libvirt/pools/disk-images/test.qcow2
hdd /data/libvirt/pools/disk-images/test.iso
#that's the expected result
#shutdown domain
$ virsh shutdown test
Domain test is being shutdown
#start again
$ virsh start test
error: Failed to start domain test
error: Storage volume not found: no storage vol with matching path '/data/libvirt/pools/disk-images/test-rootfs.qcow2'
I would expect the domain to start again, using the image file: vda /data/libvirt/pools/disk-images/test.qcow2
but instead the config is showing ...
virsh dumpxml test
...
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='volume' device='disk'>
<driver name='qemu' type='qcow2'/>
<source pool='disk-images' volume='test-rootfs.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
...
if the blockcommit is triggered without the "--delete" option, domain starts just fine, but is still using volume='test-rootfs.qcow2'.
Is there any option I'm missing to persist the change to survive a shutdown / start? Using reboot keeps the image file (/data/libvirt/pools/disk-images/test.qcow2) just fine.
Edited by J Mue