Brvirt
brvirt displays bridges and enclosed interfaces along with corresponding KVM Virtual Machines names and virsh domain ids.
Install / Use
/learn @hellt/BrvirtREADME
About brvirt
brvirt displays bridges and enclosed interfaces along with corresponding
KVM Virtual Machines names and virsh domain ids.
It answers one simple question: How to determine which virtual interface belongs to which virtual machine and what bridge it is in?"

Requirements
The script is compatible with python2.7 and python3+.
brvirtusesvirshtool to list VM properties and virtual network interfaces. To installvirshuse:
# on Debian-based distros:
sudo apt-get install libvirt-bin
# on RHEL based:
sudo yum install libvirt
- Apart from virsh, the script relies on tabulate python package to render console tables:
TABULATE_INSTALL=lib-only pip install tabulate
Usage
As simple as python brvirt.py
will produce the following output which combines brctl and virsh domiflist commands output:
(brvirt) [root@leo ~]# python brvirt.py
+----------+---------------+-----------+-------------+--------------------+
| Bridge | Interface | VM name | Domain ID | Int. MAC address |
|----------+---------------+-----------+-------------+--------------------|
| br0 | eno1 | | | 28:80:23:90:ea:28 |
| | vnet0 | cobbler | 8 | 52:54:00:5a:a9:2c |
| | vnet4 | nuage-dns | 4 | 52:54:00:db:45:92 |
| br1 | eno2 | | | 28:80:23:90:ea:29 |
| | vnet1 | cobbler | 8 | 52:54:00:9b:c2:dc |
| br999 | eno2.999@eno2 | | | 28:80:23:90:ea:29 |
+----------+---------------+-----------+-------------+--------------------+
