On 03/09/2016 09:53 AM, Andrei Perietanu wrote:

On Wed, Mar 9, 2016 at 2:49 PM, Andrea Bolognani <abologna@redhat.com> wrote:
On Wed, 2016-03-09 at 14:15 +0000, Andrei Perietanu wrote:
> I am building a custom Linux image which includes KVM and will be installed on multiple machines. By default when
> installing libvirt you get a 'default network' which adds a 'vrbr0'.
> I found several tutorials online about removing this 'virbr0' but I would like to not have it in the first place.
>
> I am compiling libvirt from source so I would think there is some compile time option or some configuration file I
> need to change for the default network not to be included. 
It should be enough to run

  # virsh net-autostart --disable default

or delete

  /etc/libvirt/qemu/networks/autostart/default.xml

after installation. You can also run

  # virsh net-undefine default

or delete

  /etc/libvirt/qemu/networks/default.xml

if you are sure you're never going to need the
default network.

Cheers.

     Thanks for the answer, but this does not solve the problem. As I said I am building an linux image which will be installed on multiple machines. I don't want to have to go to each one and manually disable the default network. I would like to disable it in the image itself so that it's not installed in the first place. 


This is why libvirt has been split into many smaller subpackages. Just setup your image to not install the package called "libvirt-daemon-config-network" and the default network (and thus virbr0) will never be created. (This assumes that your distro uses the same packaging setup as RHEL/Fedora/CentOS).

(the "libvirt" package itself is just a meta-package that includes a bunch of the other smaller packages).