Re: Statically Defining a Network

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 13, 2024 at 09:28:08AM GMT, Laine Stump wrote:
> On 6/12/24 6:42 AM, Andrea Bolognani wrote:
> > On Tue, Jun 11, 2024 at 04:23:33PM GMT, richard.schmitt--- via Users wrote:
> > > Is there a way to statically define libvirt networks without
> > > needing to run 'virsh net-define'?
> >
> > You need to install the file in /etc/libvirt/qemu/networks instead.
> > If you want the network to be autostarted, you also need to create a
> > symlink in /etc/libvirt/qemu/networks/autostart that points to the
> > network XML and has a matching name.
>
> Note that if you do this, you'll need to "preprocess" the .xml file by
> net-define'ing it on some system so that all the necessary elements are
> there, and then using the resulting xml rather than your original - for
> example, each network must have a <uuid> element, but that is usually filled
> in automatically when the network is net-defined.

That used to be true, but after [1] that's no longer the case. As
long as the XML file you drop into the directory is roughly
equivalent to src/network/default.xml.in everything is going to work
just the way you'd expect it to.

> Also, if you do this keep in mind that the fact that these files are
> currently in /etc/libvirt/qemu/networks is not a part of libvirt's public
> API - it could be changed at any time by an update (although this has never
> happened). The same is true for all other .xml files in /etc/libvirt; only
> the .conf files are public.

Fair disclaimer.


[1] https://lists.libvirt.org/archives/list/devel@xxxxxxxxxxxxxxxxx/thread/EZNHYPCCLSEECOJKGN5LGLPB6367MPVU/
-- 
Andrea Bolognani / Red Hat / Virtualization



[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux