virsh: networkGetBridgeName error

Artur asked:

I’m trying to configure foreman. So far I connected foreman to one of our KVM hosts. Specifically, this is a libvirt and we are using virsh for managing it.

When I try to create VM in foreman I’m getting the following error:
2019-08-26 12:56:48.641+0000: 23751: error : networkGetBridgeName:4007 : internal error: network 'direct' does not have a bridge name.

My network configuration looks like that:

virsh net-dumpxml --network direct
<network>
  <name>direct</name>
  <uuid>799cc56d-4c09-4963-83f6-dadb5c03bbaa</uuid>
  <forward dev='br0' mode='bridge'>
    <interface dev='br0'/>
  </forward>
</network>

Do you know what should I do with that? In foreman I’m getting the following error:

Error loading interfaces information: Internal Server Error

One more config file which can help:

cat /etc/sysconfig/network-scripts/ifcfg-br0 
# Generated by dracut initrd
DEVICE="br0"
IPV6INIT="no"
BOOTPROTO=none
ONBOOT=yes
TYPE=Bridge
USERCTL=no
NM_CONTROLLED=no
IPADDR=172.26.106.89
NETMASK=255.255.224.0
GATEWAY=172.26.96.1
NAME=br0
DEFROUTE=yes

Thank you for your help.

My answer:


Your XML has an error in it, and because of that I have no idea how you got it into libvirt to begin with.

To define a network corresponding to an existing bridge on the host that libvirt does not manage, you need to have a <bridge> element inside the <forward> element. But your XML does not.

You should not have:

    <interface dev='br0'/>

You should instead have:

    <bridge name='br0'/>

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.