## Problem Currently the add_or_update_connection client method not only add_or_update a connection in NetworkManager but it also tries to activate or deactivate it based on the status property. The problem is that the activation could fail in some situations like: - The interface bind to the connection is not present. - The interface bind to the connection is already applying other connection. - In case of Wireless, wireless could be disabled by hardware. .... and other cases. When this happen it returns with an error and the write operation does a rollback to the checkpoint created before starting with the write. - https://trello.com/c/c7HAWvBz/5020-1245548-modifying-a-network-connection-binding-settings-does-not-apply-the-changes-to-the-active-connection ## Solution - When the activation or deactivation of a connection return an error it will be just logged in order to finish with the write of the connections. - Before activating a connection, if it is bind to an specific interface which is applying a different connection then the device will be disconnected in order to be able to activate the latest one. Example, the default connection created by dracut which could be applied to multiple-connections. ## Testing - Tested manually ```bash suse@vikingo:~$ cat test.json { "network": { "connections": [ { "id": "br0", "interface": "br0", "status": "up", "persistent": true, "bridge": { "ports": ["eth0"], "stp": false } } ] } } suse@vikingo:~$ agama config load < test.json ✓ The profile is valid. # Logs from agama-web-server 2025-07-30T13:04:07.370000Z INFO agama_network::nm::adapter: agama-network/src/nm/adapter.rs:152: No change detected for connection Sarambeque (cb47c266-d391-409d-97a2-12cbb311aca6) 2025-07-30T13:04:07.370012Z INFO agama_network::nm::adapter: agama-network/src/nm/adapter.rs:152: No change detected for connection default (bd03462f-6398-4b8b-83b7-3d9196e85030) 2025-07-30T13:04:07.370020Z INFO agama_network::nm::adapter: agama-network/src/nm/adapter.rs:172: Updating connection br0 (9464a892-baf8-4446-b4a5-12bd476a132e) 2025-07-30T13:04:07.391704Z INFO agama_network::nm::client: agama-network/src/nm/client.rs:354: Activating connection br0 2025-07-30T13:04:07.398749Z INFO agama_network::nm::adapter: agama-network/src/nm/adapter.rs:172: Updating connection eth0 (13d5f018-6304-472c-9c55-3a56597ce693) 2025-07-30T13:04:07.429485Z INFO agama_network::nm::client: agama-network/src/nm/client.rs:339: Disconnecting default because the connection is eth0 2025-07-30T13:04:07.458868Z INFO agama_network::nm::client: agama-network/src/nm/client.rs:354: Activating connection eth0 ``` |
||
|---|---|---|
| .. | ||
| share | ||
| src | ||
| Cargo.toml | ||