On 08/22/2011 03:12 AM, Osier Yang wrote:
于 2011年08月20日 01:16, Eric Blake 写道:
> 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.
Is this too expensive? Need to compare most of the properties of the
domain conf (except the auto-generated info, and some other fixed info
such as domain name, UUID, etc. All other info which could be changed
lively should be compared).
We don't necessarily have to do a comparison. Just blindly parsing in
both files is a good enough approach, even in the case where the two
files end up not describing any difference in inactive configuration.
My main point was that since we track state in two files, we should be
restoring two files when libvirtd restarts, but right now we are only
restoring one.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org