canonical/lxd

Network: Show parent interfaces in `lxc network show`

Opened this issue · 1 comments

latest/edge on Ubuntu 24.04

Issue description

A network's parent interface is present in the networks_config table but isn't displayed by lxc network show (aka GET /networks/{name}). parent is a required config key when creating a new OVN UPLINK, but since it's cluster-member specific (each cluster member gets a different row in the DB for parent) it's not clear how it should be fetched via API/displayed to the user.

The parent is at least included in lxc network info, but it isn't the first place I thought to go.

I found this initially confusing when trying to figure out how a MicroCloud deployment is put together; it makes UPLINK look like magic rather than clearly showing the relationships between system ifaces and LXD physical networks.

Steps to reproduce

Deploy a single-node microcloud:

$ lxc network show UPLINK
name: UPLINK
description: ""
type: physical
managed: true
status: Created
config:
  dns.nameservers: 10.24.158.1
  ipv4.gateway: 10.24.158.1/24
  ipv4.ovn.ranges: 10.24.158.10-10.24.158.20
  ipv4.routes: 10.24.158.0/24
  volatile.last_state.created: "false"
used_by:
- /1.0/networks/default
locations:
- single-node
- $ lxc network info UPLINK
Name: UPLINK
MAC address: 32:b7:c6:8a:74:7f
MTU: 1500
State: up
Type: broadcast

...

Bridge:
  ID: 8000.32b7c68a747f
  STP: false
  Forward delay: 1500
  Default VLAN ID: 1
  VLAN filtering: false
  Upper devices: enp5s0, lxdovn1a

In a cluster you can also do lxc network show UPLINK --target <member> to get the parent.