Skip to content

fix(NetworkManager): Fix network activator#5620

Merged
holmanb merged 1 commit into
canonical:mainfrom
holmanb:holmanb/networkmanager-activator
Sep 17, 2024
Merged

fix(NetworkManager): Fix network activator#5620
holmanb merged 1 commit into
canonical:mainfrom
holmanb:holmanb/networkmanager-activator

Conversation

@holmanb
Copy link
Copy Markdown
Member

@holmanb holmanb commented Aug 14, 2024

Proposed Commit Message

fix(NetworkManager): Fix network activator

Reload NetworkManager configuration rather than bringing up interfaces.

This enables NetworkManager to configure interfaces which are not yet available in userspace, and fixes a race that was previously worked around in a service file.

Additional Context

#5512

@TheRealFalcon TheRealFalcon self-assigned this Aug 16, 2024
return _alter_interface(cmd, device_name)

@classmethod
def bring_up_interfaces(cls, device_names: Iterable[str]) -> bool:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this get called from? Given that this is a new function I assume there are no existing calls to this function?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

@a-dubs a-dubs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one question regarding how this new code is used

Copy link
Copy Markdown
Contributor

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok as-is, but I'm not sure we need the extra systemctl call.

We should also wait to see if RH QA can test this code path.

"Expected NetworkManager SubState=running, but detected: %s",
state,
)
return _alter_interface(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was there supposed to be an else here? The final service code only does the reload or restart if network manager is already started.....though if it isn't running already we have much bigger problems.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was there supposed to be an else here? The final service code only does the reload or restart if network manager is already started.....though if it isn't running already we have much bigger problems.

The intent here was just to warn about the bigger problems in the case that it isn't already running.

@github-actions
Copy link
Copy Markdown

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging TheRealFalcon, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag TheRealFalcon to reopen it.)

@github-actions github-actions Bot added the stale-pr Pull request is stale; will be auto-closed soon label Aug 31, 2024
@holmanb holmanb removed the stale-pr Pull request is stale; will be auto-closed soon label Aug 31, 2024
@holmanb
Copy link
Copy Markdown
Member Author

holmanb commented Sep 13, 2024

We should also wait to see if RH QA can test this code path.

They are in agreement with this approach. I'd like to make a small change, however, based on the reported log from the testing it looks like we need an .rstrip() to chomp a newline to avoid this unnecessary warning.

2024-09-09 15:55:57,596 - activators.py[WARNING]: Expected NetworkManager SubState=running, but detected: SubState=running

2024-09-09 15:55:57,596 - activators.py[DEBUG]: Attempting command ['systemctl', 'reload-or-try-restart', 'NetworkManager.service'] for device all

@holmanb holmanb force-pushed the holmanb/networkmanager-activator branch from 38e5452 to 7de64d3 Compare September 16, 2024 17:52
Reload NetworkManager configuration rather than bringing up interfaces.

This enables NetworkManager to configure interfaces which are not
yet available in userspace, and fixes a race that was previously worked
around in a service file.
@holmanb holmanb force-pushed the holmanb/networkmanager-activator branch from 7de64d3 to 122643a Compare September 16, 2024 18:10
@holmanb
Copy link
Copy Markdown
Member Author

holmanb commented Sep 16, 2024

I just rebased on main due to a conflict and applied the strip which led to a couple of minor test refactors. @TheRealFalcon would you mind re-reviewing please (assuming tests pass)?

Copy link
Copy Markdown
Contributor

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@holmanb holmanb merged commit bde913a into canonical:main Sep 17, 2024
holmanb added a commit to holmanb/cloud-init that referenced this pull request Sep 17, 2024
Reload NetworkManager configuration rather than bringing up interfaces.

This enables NetworkManager to configure interfaces which are not
yet available in userspace, and fixes a race that was previously worked
around in a service file.
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.

3 participants