How can I have a list of interfaces in virt-manager network config

Hi, I have a standalone VM host running Debian bookworm, which features libvirt 9.0.0 and qemu 7.2. My users mostly have Debian unstable on their notebooks, which currently comes with virt manager 4.1.0. The host has a 802.1Q VLAN trunk to the network with contains a number of VLANs. Each VLAN has a bridge host-side, for example VLAN 188: [3/114]mh@spiral:~ $ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host noprefixroute valid_lft forever preferred_lft forever 2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 4c:52:62:b4:53:12 brd ff:ff:ff:ff:ff:ff altname enp2s0 inet6 fe80::4e52:62ff:feb4:5312/64 scope link valid_lft forever preferred_lft forever 5: int188: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 96:f3:9b:c6:7f:db brd ff:ff:ff:ff:ff:ff inet6 fe80::94f3:9bff:fec6:7fdb/64 scope link valid_lft forever preferred_lft forever 21: vlan188@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master int188 state UP group default qlen 1000 link/ether 4c:52:62:b4:53:12 brd ff:ff:ff:ff:ff:ff This is configured with systemd-networkd: ==> /etc/systemd/network/10-eno1.network <== [Match] Name=eno1 [Network] Description=eno1 VLAN 1xx DHCP=no IPForward=no IPv6AcceptRA=no IPv6SendRA=no DHCPv6PrefixDelegation=no [Network] VLAN=vlan188 /etc/systemd/network/int188.netdev <== [NetDev] Name=int188 Kind=bridge ==> /etc/systemd/network/int188.network <== [Match] Name=int188 [Network] Description=int188 Labor DHCP=no IPForward=no IPv6AcceptRA=no IPv6SendRA=no DHCPv6PrefixDelegation=no ==> /etc/systemd/network/vlan188.netdev <== [NetDev] Name=vlan188 Kind=vlan [VLAN] Id=188 ==> /etc/systemd/network/vlan188.network <== [Match] Name=vlan188 [Network] Description=vlan188 Labor Bridge=int188 DHCP=no IPForward=no IPv6AcceptRA=no IPv6SendRA=no DHCPv6PrefixDelegation=no I can attach a VM to that vlan in virt-manager by selecting the virtual NIC, network source: bridge device, device name: int188. This works and results in the following XML snippet: <interface type="bridge"> <mac address="52:54:00:af:fd:f8"/> <source bridge="int188"/> <model type="virtio"/> <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/> </interface> Network configuration host-wise looks like this: 1 [13/119]mh@spiral:~ $ virsh net-list Name State Autostart Persistent ---------------------------------------- [14/120]mh@spiral:~ $ virsh iface-list Name State MAC Address -------------------------------------- eno1 active 4c:52:62:b4:53:12 int188 active 96:f3:9b:c6:7f:db [15/120]mh@spiral:~ $ virsh iface-dumpxml int188 <interface type='bridge' name='int188'> <mtu size='1500'/> <bridge stp='off' delay='1500'> <interface type='vlan' name='vlan188'> <link speed='1000' state='up'/> <vlan tag='188'> <interface name='eno1'/> </vlan> </interface> </bridge> </interface> [16/121]mh@spiral:~ $ So far so good, this is useable. However, I need to document a list of available interfaces since the interface name "int188" needs to be entered in a text area in virt-manager. The dialog in virt-manager also has a list box that is pre-filled with "Virtual Network 'default'", "Bridge Device..." and "Macvtap device...", and the text area for the bridge device name shows up once "Bridge device" is selected. Can I configure somewhere (may it be in libvirt, may it be in virt-manager) a list of network interfaces, so that this list box has like "Bridge Device int181", "Bridge Device int188" etc in addition to the three entries that are already present, to give my users a hint about which interfaces might be available? You can also point me towards documentation if I might have missed something. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402 Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421

Hi, On Fri, Dec 08, 2023 at 04:48:09PM +0100, Marc Haber wrote:
You can also point me towards documentation if I might have missed something.
Nobody? Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402 Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421

On Fri, Dec 08, 2023 at 04:48:09PM +0100, Marc Haber wrote:
You can also point me towards documentation if I might have missed something.
Nobody?
Interfaces of what? What you can't get from this? [@ ~]# virsh domiflist vps-ad2 Interface Type Source Model MAC ------------------------------------------------------- [@~]# virsh iface-list Name State MAC Address ---------------------------------------------------

On Tue, Dec 12, 2023 at 08:20:52PM +0000, Marc wrote:
On Fri, Dec 08, 2023 at 04:48:09PM +0100, Marc Haber wrote:
You can also point me towards documentation if I might have missed something.
Nobody?
Interfaces of what? What you can't get from this?
[@ ~]# virsh domiflist vps-ad2 Interface Type Source Model MAC -------------------------------------------------------
That list is empty on my new host because it doesn't have any domains yet.
[@~]# virsh iface-list Name State MAC Address ---------------------------------------------------
That gives a list of the interfaces, for example: mh@spiral:~ $ virsh iface-list Name State MAC Address -------------------------------------- eno1 active 4c:52:62:b4:53:12 int182 active da:9c:98:9e:35:86 int192 active 16:64:a5:ff:e8:92 [3/135]mh@spiral:~ $ (just two interfaces listed) But what does this have to do with my question? Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402 Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421

On 12/8/23 10:48 AM, Marc Haber wrote:
[very detailed description of a network setup, the important point being that there is a bridge created outside of libvirt]
I can attach a VM to that vlan in virt-manager by selecting the virtual NIC, network source: bridge device, device name: int188. This works and results in the following XML snippet: <interface type="bridge"> <mac address="52:54:00:af:fd:f8"/> <source bridge="int188"/> <model type="virtio"/> <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/> </interface>
[more details] So far so good, this is useable. However, I need to document a list of available interfaces since the interface name "int188" needs to be entered in a text area in virt-manager.
The dialog in virt-manager also has a list box that is pre-filled with "Virtual Network 'default'", "Bridge Device..." and "Macvtap device...", and the text area for the bridge device name shows up once "Bridge device" is selected.
Can I configure somewhere (may it be in libvirt, may it be in virt-manager) a list of network interfaces, so that this list box has like "Bridge Device int181", "Bridge Device int188" etc in addition to the three entries that are already present, to give my users a hint about which interfaces might be available?
So you have a host bridge created outside libvirt that you want to be listed in the potential connections in virt-manager (rather than needing to type the name of the bridge). You can do that by creating a libvirt virtual network with <forward mode='bridge'/> - this type of virtual network expects that the bridge device will have already been created and attached to the world by someone other than libvirt: https://libvirt.org/formatnetwork.html#using-an-existing-host-bridge Create a temporary file (call it /tmp/xyz.xml for example) with the text of that example, but replace "br0" with "int188", and "host-bridge" with whatever name you want to use (it could be "int188", or it could be, e.g. "engineering-support" or something equally descriptive). define and start this network with: virsh net-define /tmp/xyz.xml virsh net-start engineering-support virsh net-autostart engineering-support Now "engineering-support" should show up as a potential connection in virt-manager's list of virtual networks. If you look at the domain XML, you'll find that <interface type='bridge'> <source bridge='int188'/> ... has been replaced with <interface type='network'> <source network='engineering-support'/> ... but the result will be the same - the guest's tap interface will be connected to the bridge int188.

On Tue, Dec 12, 2023 at 03:28:50PM -0500, Laine Stump wrote:
On 12/8/23 10:48 AM, Marc Haber wrote:
[very detailed description of a network setup, the important point being that there is a bridge created outside of libvirt]
Sorry for being too detailed, I reckoned it is better to give all information that MIGHT be useful.
So you have a host bridge created outside libvirt that you want to be listed in the potential connections in virt-manager (rather than needing to type the name of the bridge).
Yes, that sounds like it.
You can do that by creating a libvirt virtual network with <forward mode='bridge'/> - this type of virtual network expects that the bridge device will have already been created and attached to the world by someone other than libvirt:
https://libvirt.org/formatnetwork.html#using-an-existing-host-bridge
Yes, that solved my issue nicely. Thank you very much for the pointer. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402 Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421
participants (3)
-
Laine Stump
-
Marc
-
Marc Haber