Skip to content

core: accept unmanaged parent if it's unrealized

Beniamino Galvani requested to merge bg/rh2101317 into main

find_parent_device_for_connection() must return a parent device even if it's unrealized. In fact, callers already handle the unrealized case; in specific:

  • _internal_activate_device() will try to autoactivate a connection on the unrealized parent to realize it;

  • system_create_virtual_device()'s goal is to create a NMDevice object, so it doesn't matter whether the parent is realized or not.

Relax the condition about managed-ness, since any unrealized device is also unmanaged.

This change fixes the following scenario, where all profiles have autoconnect=no and autoconnect-slaves=yes:

                   vrf0
       -------------^----------------
       |            |               |
       |         bridge0        bond0.4000
       |                            .
     bond0    <......................
    ---^---
    |     |
  veth0  veth1

    ----> = controller
    ....> = VLAN parent

When profiles are added, unrealized devices are created for bond0 and bridge0, but not for bond0.4000 becase its parent is unrealized. Then the autoconnect-slaves machinery for vrf0 tries to activate all ports but fails for bond0.4000 because it can't find a device for it.

https://bugzilla.redhat.com/show_bug.cgi?id=2101317

Merge request reports