Skip to content

Commit

Permalink
parse: fix renderer validation for nm-devices
Browse files Browse the repository at this point in the history
When we process a nm-device we check to see if the renderer is
NetworkManager. If it's not set to NetworkManager we log a warning
message and change the backend.

This verification can be only done after the netdef is processed. Move
the verification so it happens after the call to process_mapping().

Fixes LP: #2091755
  • Loading branch information
daniloegea committed Dec 18, 2024
1 parent a28be21 commit e765570
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -3376,11 +3376,6 @@ handle_network_type(NetplanParser* npp, yaml_node_t* node, const char* key_prefi
case NETPLAN_DEF_TYPE_NM:
g_debug("netplan: %s: handling NetworkManager passthrough device, settings are not fully supported.", npp->current.netdef->id);
handlers = ethernet_def_handlers;
if (npp->current.netdef->backend != NETPLAN_BACKEND_NM) {
g_debug("nm-device: %s: the renderer for nm-devices must be NetworkManager, it will be used instead of the defined one.",
npp->current.netdef->id);
npp->current.netdef->backend = NETPLAN_BACKEND_NM;
}
break;
default: g_assert_not_reached(); // LCOV_EXCL_LINE
}
Expand Down Expand Up @@ -3409,6 +3404,12 @@ handle_network_type(NetplanParser* npp, yaml_node_t* node, const char* key_prefi
}
}

if (npp->current.netdef->type == NETPLAN_DEF_TYPE_NM && npp->current.netdef->backend != NETPLAN_BACKEND_NM) {
g_debug("nm-device: %s: the renderer for nm-devices must be NetworkManager, it will be used instead of the defined one.",
npp->current.netdef->id);
npp->current.netdef->backend = NETPLAN_BACKEND_NM;
}

/* Postprocessing */
/* Implicit VXLAN settings, which can be deduced from parsed data. */
if (npp->current.netdef->type == NETPLAN_DEF_TYPE_TUNNEL &&
Expand Down

0 comments on commit e765570

Please sign in to comment.