On 02/20/2012 09:58 AM, Cole Robinson wrote:
On 02/20/2012 11:21 AM, Jakub Mroziński wrote:
> Hi,
> virt-manager after saving guest config destroy symlink to this file and
> creates new file. How to reproduce:
>
> cd /etc/libvirt/qemu
> # mv openbsd.xml /mount/
> # ln -s /mount/openbsd.xml
> # ls -l openbsd.xml
> lrwxrwxrwx 1 root root 49 Feb 20 17:09 openbsd.xml -> /mount/openbsd.xml
> # virt-manager
Unsupported. /etc/libvirt must be a local directory on each host, and
_must not be shared_ between machines. There are a few subdirectories
under /etc/libvirt and /var/lib/libvirt that can be shared (in fact,
http://libvirt.org/locking.html documents that /var/lib/libvirt/sanlock
must be shared to be useful), but these are the exception, not the rule.
>
> Now we need to edit host openbsd in virt-manager then "Apply" changes and
we got:
> # ls -l openbsd.xml
> -rw------- 1 root root 2076 Feb 20 17:13 openbsd.xml
Correct - libvirt will not follow symlinks when saving internal
configuration, but rewrites the file from scratch without preserving the
symlink. And I don't think this is a bug, since we already explicitly
document that files under /etc/libvirt are internal to libvirt, and must
not be shared. Rather, it is probably an intentional side-effect of a
recent libvirt change to atomically update internal .xml files (libvirt
used to write over internal files in a non-atomic manner, which could
corrupt domains if a power outage occurred at the wrong moment).
>
> I have network storage and move every configuration there. On host i want have
> only symlinks. I know that i can do workaround, but i dont want.
If you want to store your configuration in shared storage, then the only
supported method of doing that is to store the XML independently of
/etc/libvirt. For example, you can 'virsh dumpxml $dom >
/mount/$dom.xml' to save off the configuration to shared storage, and
'virsh define /mount/$dom.xml' to reload the shared configuration if you
don't trust what might be in place locally.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org