Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vlan keyfile parser support #370

Merged
merged 4 commits into from
Jun 28, 2023

Commits on Jun 28, 2023

  1. parser: introduce the "placeholder" interface type

    This change is intended to be used only by Network Manager, more
    specifically when used through the integration with Netplan.
    
    Network Manager doesn't enforce the existence of interfaces in order to
    create a connection. For example, when creating a VLAN, it doesn't care
    if the parent interface doesn't exist. The nmconnection will be created
    anyway.
    
    When creating a VLAN directly in Netplan, the "link" property is
    required and the interface used as "link", the parent interface, must
    exist in Netplan. It will throw an error otherwise.
    
    Since the integration with Network Manager, some of these restrictions
    need to be relaxed or NM will error out when creating these types of
    connections.
    
    The NETPLAN_DEF_TYPE_NM_PLACEHOLDER_ is intended to fill the gaps of interfaces
    that must exist for the connection to work but don't really exist.
    
    Practical example: when creating a VLAN, the "link" property is required
    and the interface pointed by the link also must exist somewhere in the
    YAML files. Although, when creating it through Network Manager, it will
    successfully create the connection, it will just not do anything. Since
    the integration with Netplan, this scenario will start to fail and might
    be surprising for users.
    
    Also, when creating an ethernet connection through NM, the interface ID
    in Netplan will end up being something like
    NM-030c95e3-b025-4a1e-905f-d3d92acfd8b9. The VLAN link is supposed to
    point to that interface name in the Netplan configuration. But as
    translation from keyfile to YAML are handled isolated from the rest of
    the netplan state, we don't know what netdef ID no point to when doing
    the translation. Doing it properly would require loading and analyzing
    all the Netplan state before emitting YAML for keyfiles.
    daniloegea committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    2b77e06 View commit details
    Browse the repository at this point in the history
  2. parse-nm: add support for VLANs

    It relies on the new placeholder netdef type.
    daniloegea committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    c39d96a View commit details
    Browse the repository at this point in the history
  3. tests: fix keyfile parser existing tests

    Also add a few more tests.
    daniloegea committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    52ee2f1 View commit details
    Browse the repository at this point in the history
  4. parse: handle redefinition of a place holder netdef

    If we find an interface with the same name of a place holder created
    earlier, we just change the place holder type to the type of the
    new interface and use it to store the configuration.
    
    Without this logic the parser would fail if it finds an interface with
    the same name of the place holder but of a different type.
    daniloegea committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    04681a8 View commit details
    Browse the repository at this point in the history