Creating a managed network with same name as an existing unmanaged physical network

I realised that it is possible to create a managed physical network with same name as an existing physical network. Basically transforming an unmanaged network into a managed one.

Is this simply an undocumented feature or a bug?

If I have the following networks

$ incus network ls
+----------+----------+---------+------------+------+-------------+---------+---------+
|   NAME   |   TYPE   | MANAGED |    IPV4    | IPV6 | DESCRIPTION | USED BY |  STATE  |
+----------+----------+---------+------------+------+-------------+---------+---------+
| col0     | physical | false   |            |      |             | 0       |         |
+----------+----------+---------+------------+------+-------------+---------+---------+
| eth0     | physical | false   |            |      |             | 0       |         |
+----------+----------+---------+------------+------+-------------+---------+---------+
| incusbr0 | bridge   | true    | 10.0.0.1/8 | none |             | 2       | CREATED |
+----------+----------+---------+------------+------+-------------+---------+---------+
| lo       | loopback | false   |            |      |             | 0       |         |
+----------+----------+---------+------------+------+-------------+---------+---------+

And I create a managed network with same name as the parent, col0.

incus network create col0 --type=physical parent=col0

Listing the networks now shows col0 as a managed network, with the actual physical network suppressed.

$ incus network ls
+----------+----------+---------+------------+------+-------------+---------+---------+
|   NAME   |   TYPE   | MANAGED |    IPV4    | IPV6 | DESCRIPTION | USED BY |  STATE  |
+----------+----------+---------+------------+------+-------------+---------+---------+
| col0     | physical | true    |            |      |             | 0       | CREATED |
+----------+----------+---------+------------+------+-------------+---------+---------+
| eth0     | physical | false   |            |      |             | 0       |         |
+----------+----------+---------+------------+------+-------------+---------+---------+
| incusbr0 | bridge   | true    | 10.0.0.1/8 | none |             | 2       | CREATED |
+----------+----------+---------+------------+------+-------------+---------+---------+
| lo       | loopback | false   |            |      |             | 0       |         |
+----------+----------+---------+------------+------+-------------+---------+---------+

It indeed works fine and makes it convenient to start an instance with the managed network instead of needing to specify a nic device.

I stumbled upon this by accident but would like to know if this was indeed intended.

Thanks.

1 Like

Yeah, that case is fine. It wasn’t really intentional for us to support it, but since physical and macvlan network types are DB-only managed networks, they don’t conflict with an existing interface of the same name.