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.
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.
> It seems that most of them are in /etc/libvirt
That would be the persistent definitions (virsh dumpxml --inactive)
> but identical copies are also found in /var/lib/libvirt.
Those are not identical, but are the runtime definitions. It is
possible to make changes to either one in isolation (hotplugs to an
in-use object affect /var, changes that affect only the next start of an
object affect /etc, and it is possible to affect both files at once).
> In my case I am having issues with the network/default.xml file being different. Is
there a reason why the config seems to be in two places at once?
Yes - because all libvirt objects (domains, networks, etc.) have both an
active state and a persistent state, and the two can be different.
> And which one is the 'correct' one?
Correct for what? Both are used by libvirt, but you should never edit
either. It sounds like you instead need to do:
# 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.
all without you ever directly touching files in /etc or /var.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org
-----------------------------------------------------------------
| David Mitchell (mitchell(a)ucar.edu) Network Engineer IV |
| Tel: (303) 497-1845 National Center for |
| FAX: (303) 497-1818 Atmospheric Research |
-----------------------------------------------------------------