[libvirt-users] Configuration file question

Eric Blake eblake at redhat.com
Sat Dec 8 14:56:42 UTC 2012


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:

> 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

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20121208/55ca5530/attachment.sig>


More information about the libvirt-users mailing list