Hi ,I hit a bug with libvirt+ qemu+kvm when doing follow steps:
1.initial status :vm = base+z(z is a snapshot)
2. call snapshotCreateXML( ): vm = base+z +z'
3. call blockRebase( ): vm = base+z''(z rebase to z')
4 .(after rebasing work done) vm shutdown and then start
an error accord like this:
unable to set user and group to '0:0' on '/tvm/tvm/405b9ea5-10a7-4e56-946d-58e93e2688d6/405b9ea5-10a7-4e56-946d-58e93e2688d6.vda_20141101044033': No such file or directory
A second start may sucess.
I debugged with gdb and found that the error message was cauesed by
virSecurityDACSetSecurityDiskLabel misuse the disk chain(that is base+z +z',
after rebase), and z' was deleted yet.
why virSecurityDACSetSecurityDiskLabel used old disk chain after rebasing ?
I finally find that In qemuProcessHandleBlockJob when rebase complete, disk chain in vm->def is updated but vm->newDef is not(when vm->newDef is not null). In shutdown( actrully in qemuProcessStop ), if vm->newDef is not null , vm->def will be replaced by vm->newDef, which contains a wrong disk chain!!! the next start will failed with above message.