On 08/19/2011 08:17 AM, Osier Yang wrote:
Libvirt loads the domain conf from the status file (/var/run/libvirt/qemu/$dom.xml) if the domain is running, the problem if one restart libvirtd just after some changing on the domain conf, and then destroy/start the guest. libvirt will never known what the original domain conf is then. (vm->newdef is NULL at this moment, generally libvirt restore the domain conf to the original conf (vm->newDef) when destroying and shutdown).
Sounds to me like this is a bug in libvirtd reloading. For a running persistent guest, libvirt should be looking in two files: both the running state (/var/run/libvirt/qemu/$dom.xml) and the next-boot state (/etc/lib/libvirt/qemu/$dom.xml); and if they differ, then assign vm->newDef to the persistent definition. In other words, the bug is that vm->newdef was NULL after libvirtd restart.
The solution in my mind is to add some attribute to the status XML, such as "live_updated=1", and do the checking when loading the domain conf from status XML:
Shouldn't need any XML changes; rather, libvirtd just needs to be taught to properly reconstruct its state from multiple files, instead of assuming that the first file that worked was all the state it needed.
For a transient domain, we still have no way to get the original domain conf, that means one will still be surprised when seeing the the disk is still there.
For a transient domain, it is already forbidden to request a persistent change. So you can't get into this situation in the first place unless you have a persistent domain.
-- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list