On 12/08/2012 10:36 AM, David Mitchell wrote:
On Dec 8, 2012, at 7:56 AM, Eric Blake wrote:
> On 12/07/2012 04:32 PM, David Mitchell wrote:
>> Where are the configuration files for libvirt and/or virsh actually stored?
>
> That's an implementation detail, and might change in the future. You
> shouldn't need to care where they are stored, and instead access the
> data via the API (such as virDomainGetXMLDesc and virDomainDefine) or
> API wrappers (such as virsh dumpxml/define). That said:
In my case I'm trying to sync the configuration files between two physical servers.
To that end I have a drbd partition which I mirror. I have /etc/libvirt softlinked into
that partition. I could easily link /var/lib/libvirt into that partition as well but
without understanding what it's for I'm not sure of all the ramifications.
Don't. Mirroring the contents of /etc/libvirt or /var/libvirt is going
behind libvirt's back, and risks data inconsistencies if the libvirtd on
one machine sees data in an incomplete state as written by a libvirtd on
another machine.
The _only_ two safe ways to share configuration between multiple
machines is to share the output of 'virsh dumpxml' and then to 'virsh
define' it on the destination; or to use only transient objects in the
first place (VDSM does the latter). (Well, you don't have to use virsh
- you can use any language binding that eventually boils down to the
same underlying C API that virsh is using).
For clean stops and starts I do plan on using the API to save or
destroy the running domains, etc and that should keep the /var/lib/ and
/etc/configurations consistent if I understand their purpose. I'm a little worried
about what will happen during unclean stops though.
_Always_ use the API, rather than attempting to read implementation
detail files behind libvirt's back.
> # edit the persistent definition, which will touch /etc
> virsh net-edit default
> # stop the running instance with the old definition from /var
> virsh net-destroy default
> # restart, which will repopulate /var with your changes
> virsh net-start default
I will give that a try. The problem I'm having is that the /var configuration is
being used even after a reboot instead of the /etc/ configuration.
You'd have to provide more details as to why you think the runtime
configuration is surviving a reboot; are you sure you are properly using
the API to set the persistent definition?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org