
On Mon, Mar 17, 2014 at 05:46:04PM -0600, Jim Fehlig wrote:
I received a report about an odd use case of /etc/libvirt/<driver>/ config files, and would like to hear some opinions about it. The user "preps" a host by mounting a remote fs containing VM images and config, creates links in /etc/libvirt/<driver>/dom.xml to /mnt-point/whatever/dom.xml, and starts libvirtd. All is well until there is a need to modify the VM config (e.g. virsh setmaxmem ... --config), at which point libvirt replaces the link with a file containing the new config, instead of updating the contents of the linked file.
FWIW the reason why that happens is because when we write the new XML we don't simply re-write the existing XML file. That would be unsafe, because in the event of host crash you could end up with a zero length or partially written XML file. Instead we write to a temporary file and then issue a rename() syscall which atomically replaces the old with new. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|