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).
Following is a demo of the problem:
1) hotplug a disk to a running domain without "--persistent" specified.
2) restart libvirtd
3) Destroy/start the guest
4) you will see the hotpluged disk is still there.
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:
* if "live_updated=1", then loads the domain conf from the persistent
domain XML.
But the problem is:
For a persistent domain, if one made changes on the domain conf both
persistently and transiently, we have no way to known which part are
changed. Loading from the persistent domain conf is not correct either.
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.
Any idea on this?
Thanks
Osier