nmstate: Nmstate should ignore interface with `state: unknown` also
This state should NO_OP:
---
interfaces:
- name: eth1
type: ethernet
state: unknown
mtu: 9000
About this issue
- Original URL
- State: open
- Created 8 months ago
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Nmstate should ignore interface with state: unknown #2452 — committed to abigailajohn/nmstate by abigailajohn 3 months ago
- Nmstate should ignore interface with state: unknown #2452 Signed-off-by: Abigail Inyang <abigailainyang@gmail.com> — committed to abigailajohn/nmstate by abigailajohn 3 months ago
Hi, as promised I’m going to give some hints about where to look at. Sorry for the delay.
First, all the input in yaml format is parsed and converted it to Rust structures. This is done by the crate (library)
serde
. In most cases, the way to parse the different structures is indicated only with macro annotations like#[serde(...)]
in the Rust structs itself. Other times, more rarely, we need to implement theDeserialize
trait if the yaml deserialization is more complex.The request in this issue is to ignore interfaces that in the yaml has
state: unknown
, that’s what NO_OP means (no operation). We already allow it withstate: ignore
, but we want to accept “unknown” too. Am I correct on this, @cathay4t?The field “state” is part of the items of the list “interfaces”. So, we can deduce that each of the elements is parsed to the Rust type
Interface
. Actually,Interface
can be of different types likeEthernetInterface
,LinuxBridgeInterface
, etc. If we look to some of those types, we see that all them contains a field of the typeBaseInterface
.This
BaseInterface
is the Rust structure that contains the information common to all interface types, “state” among them. Take a look to thisBaseInteface
type and see how you can do to accept “state: unknown” for it and do what is requested in this issue.You can probably ignore the warning about the unsupported NetworkManager version. If you can update to a newer Ubuntu it will disappear, though.
You can use any of them. If you don’t have any preference, I recomend you Fedora. But if you are already familiar with Ubuntu, you can use it too.