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

networking-tools: Add nmstate #2269

Merged
merged 1 commit into from
Mar 21, 2023
Merged

Conversation

qinqon
Copy link
Contributor

@qinqon qinqon commented Mar 1, 2023

As discussed the nmstatectl tool is going to be added to FCOS, it will allow to declare the network configuration at boot time

@qinqon
Copy link
Contributor Author

qinqon commented Mar 1, 2023

/cc @cybertron

@bgilbert
Copy link
Contributor

bgilbert commented Mar 2, 2023

I believe you'll need to manually add nmstate to the manifest-lock files.

It'd also be good to add a kola test that configures the network by writing an nmstate config from a Butane config.

@cathay4t
Copy link

cathay4t commented Mar 2, 2023

@qinqon Please also include nmstate-libs in case someone want a C library instead of CLI.

@bgilbert
Copy link
Contributor

bgilbert commented Mar 2, 2023

If nmstate-libs isn't needed by nmstate, we probably shouldn't include the library package. We don't encourage users to install custom software in the host, and so we don't ship libraries that aren't needed by an OS component.

@qinqon
Copy link
Contributor Author

qinqon commented Mar 2, 2023

@cathay4t @bgilbert
This would be needed if one of the os tools use nmstate programatically linking dynamically to it right ?

For static linking the nmstate-lib should be at the dev/build env but not af the target system.

@qinqon qinqon force-pushed the add-nmstate branch 3 times, most recently from 77c3560 to 94ca9d9 Compare March 2, 2023 13:30
@qinqon
Copy link
Contributor Author

qinqon commented Mar 2, 2023

Looks like nmstatectl service do not support nmpolicy

Mar 02 13:59:48 qemu0 kola-runext-test.sh[1762]: [2023-03-02T13:59:48Z ERROR nmstatectl::service] Failed to apply state file /etc/nmstate/br-ex-policy.yml: serde_yaml::Error: Unsupported keys found: ["capture", "desiredState"]

nmstatectl apply is fine

@bgilbert
Copy link
Contributor

bgilbert commented Mar 3, 2023

This would be needed if one of the os tools use nmstate programatically linking dynamically to it right ?

In that case, presumably the RPM of the tool would have Requires: nmstate-libs, right? So we shouldn't need to explicitly add it here.

tests/kola/networking/nmstate/config.bu Outdated Show resolved Hide resolved
tests/kola/networking/nmstate/test.sh Outdated Show resolved Hide resolved
tests/kola/networking/nmstate/test.sh Outdated Show resolved Hide resolved
tests/kola/networking/nmstate/test.sh Outdated Show resolved Hide resolved
@qinqon qinqon force-pushed the add-nmstate branch 2 times, most recently from 148bcfb to bca7530 Compare March 3, 2023 14:07
@cathay4t
Copy link

cathay4t commented Mar 6, 2023

No. The nmstate does not depend on nmstate-libs.

@bgilbert
Copy link
Contributor

bgilbert commented Mar 6, 2023

Great. So it sounds as though we don't need nmstate-libs.

@qinqon qinqon force-pushed the add-nmstate branch 3 times, most recently from 8373814 to 37dfe56 Compare March 6, 2023 07:17
@qinqon
Copy link
Contributor Author

qinqon commented Mar 6, 2023

Have reconstructed the PR and now there are two tests one configuring a normal state and the other using a policy, so we exercise the two main modes to configure networking with nmstate

@qinqon qinqon force-pushed the add-nmstate branch 2 times, most recently from ff0a153 to 5b20eef Compare March 6, 2023 07:38
@qinqon qinqon requested a review from bgilbert March 6, 2023 07:39
@qinqon
Copy link
Contributor Author

qinqon commented Mar 6, 2023

Great. So it sounds as though we don't need nmstate-libs.

@qinqon qinqon closed this Mar 6, 2023
@qinqon qinqon reopened this Mar 6, 2023
@qinqon
Copy link
Contributor Author

qinqon commented Mar 6, 2023

@bgilbert looks like nmstate.service is running before NetworkManger is ready, this is the systemd unit:

[Unit]
Description=Apply nmstate on-disk state
Documentation=man:nmstate.service(8) https://www.nmstate.io
After=NetworkManager.service
Requires=NetworkManager.service

[Service]
Type=oneshot
ExecStart=/usr/bin/nmstatectl service

[Install]
WantedBy=multi-user.target

Logs

Mar  6 07:50:05.269335 systemd[1]: Starting nmstate.service - Apply nmstate on-disk state...
Mar  6 07:50:05.277998 systemd[1]: Finished systemd-homed-activate.service - Home Area Activation.  
Mar  6 07:50:05.278000 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-homed-activate comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' 
Mar  6 07:50:05.280000 audit: BPF prog-id=67 op=LOAD                            
Mar  6 07:50:05.281000 audit: BPF prog-id=68 op=LOAD                            
Mar  6 07:50:05.281000 audit: BPF prog-id=69 op=LOAD                            
Mar  6 07:50:05.290390 systemd[1]: Starting systemd-hostnamed.service - Hostname Service...
Mar  6 07:50:05.294788 systemd[1]: Started chronyd.service - NTP client/server. 
Mar  6 07:50:05.298000 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=chronyd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Mar  6 07:50:05.308385 nmstatectl[1263]: [2023-03-06T07:50:05Z WARN  nmstate::nm::nm_dbus::error] Unknown DBUS error MethodError("org.freedesktop.DBus.Error.UnknownMethod", Some("Object does not exist at path “/org/freedesktop/NetworkManager”"), Msg { type: Error, sender: ":1.3", reply-serial: 2, body: Signature: [
Mar  6 07:50:05.308385 nmstatectl[1263]:             s (115),                    
Mar  6 07:50:05.308385 nmstatectl[1263]:     ] })                                
Mar  6 07:50:05.310309 nmstatectl[1263]: [2023-03-06T07:50:05Z ERROR nmstatectl::service] Failed to apply state file /etc/nmstate/br-ex.yml: NmstateError: Bug: DbusConnectionError: org.freedesktop.DBus.Error.UnknownMethod: Object does not exist at path “/org/freedesktop/NetworkManager”
Mar  6 07:50:05.310867 systemd[1]: nmstate.service: Deactivated successfully.    

@cathay4t
Copy link

cathay4t commented Mar 6, 2023

Above service dependency issue will be fixed by nmstate/nmstate#2265

@bgilbert
Copy link
Contributor

bgilbert commented Mar 6, 2023

I commented in the PR, but in short, I don't think that PR is the right fix.

@cathay4t
Copy link

cathay4t commented Mar 6, 2023

@bgilbert I have update the PR with new approach (retry on daemon not start failure) as NM team confirmed this is a bug of NM.

@qinqon
Copy link
Contributor Author

qinqon commented Mar 21, 2023

tests are failing.

also can we get someone to answer the questions and try to get the fedora-release PR merged?

looks like qemu is running as ipv6 single stack at CI

auto-merge was automatically disabled March 21, 2023 15:11

Head branch was pushed to by a user without write access

@dustymabe
Copy link
Member

looks like qemu is running as ipv6 single stack at CI

I'd be surprised if that was the case.

@dustymabe
Copy link
Member

looks like qemu is running as ipv6 single stack at CI

I'd be surprised if that was the case.

Maybe try adding https://github.com/coreos/fedora-coreos-config/pull/2269/files#r1143551266 to both your tests.

As discussed at [1] the nmstatectl tool is going to be added to FCOS, it
will allow to declare the network configuration at boot time

[1] coreos/fedora-coreos-tracker#1175

Signed-off-by: Enrique Llorente <[email protected]>
@qinqon qinqon requested review from dustymabe and bgilbert and removed request for dustymabe March 21, 2023 16:29
@bgilbert bgilbert enabled auto-merge (rebase) March 21, 2023 17:40
@bgilbert bgilbert merged commit 95e06df into coreos:testing-devel Mar 21, 2023
@bgilbert
Copy link
Contributor

@qinqon I'm confused by nmstate/nmstate#2283. Does that mean nmstate.service is failing in a default install today? CI in this PR should have failed if that's the case.

@bgilbert
Copy link
Contributor

I've confirmed that nmstate.service is not failing if /etc/nmstate doesn't exist, so I'm not sure what nmstate/nmstate#2283 is doing.

@cathay4t
Copy link

I tried with old nmstatectl. The systemd start nmstate.service will fail on missing /etc/nmstate folder with error:

Mar 22 14:27:19 c9s nmstatectl[4929]: std::io::Error: No such file or directory (os error 2)

Anyway, PR nmstate/nmstate#2283 should fixed in next fedora update.

@cathay4t
Copy link

The detail rpm based install will have /etc/nmstate with README file in it, hence no failure on default install.

@travier
Copy link
Member

travier commented Mar 28, 2023

Shouldn't this PR close coreos/fedora-coreos-tracker#1175?

@bgilbert
Copy link
Contributor

No, the remaining steps are in coreos/fedora-coreos-tracker#1175 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants