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

Added retry mechanism and nmcli commands to set IP for host-acc comm channel. #237

Closed
wants to merge 1 commit into from

Conversation

sudhar-krishnakumar
Copy link
Contributor

@sudhar-krishnakumar sudhar-krishnakumar commented Oct 22, 2024

Upon host reboot, it seems to take time for network-manager's state for each interface,
to stabilize and become activated. This function does a few retries,
when it tries to set IP.

@sudhar-krishnakumar sudhar-krishnakumar force-pushed the nmcli_addip branch 3 times, most recently from 484ec26 to 0feeadd Compare October 22, 2024 23:12
Copy link

@nmididad nmididad left a comment

Choose a reason for hiding this comment

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

Line 209: Must ipAddrSet be initialized to false?

Choose a reason for hiding this comment

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

Line 266: You could return here too, instead of break?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Generally, break is considered better...than return from inside a for-loop. So if you are fine, would keep this part as-it-is.

@sudhar-krishnakumar
Copy link
Contributor Author

Line 209: Must ipAddrSet be initialized to false?

Not required, just a good programming practice.

Copy link

@vkannapp vkannapp left a comment

Choose a reason for hiding this comment

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

nmcli sequence changes looks good.

…or each interface,

to stabilize and become activated. With Option2: we try
to use nmcli to set IP addrtess. But during host reboot, network
manager daemon is flaky, wherein even if interface(conn) does not
exist in nmcli's DB, it thinks it exists, and causes issues.
This function does a few retries, when it tries to set IP.
if err != nil {
log.Errorf("ip link set err->%v, output->%v\n", err, output)
return fmt.Errorf("ip link set err->%v, output->%v\n", err, output)
runCmd = fmt.Sprintf(`nmcli conn show | grep -w "%s"`, intfName)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nmcli conn show should also specify intfName...otherwise...we end up making invalid assumption...that interface already exists....when actually....that interface name just happens...to show up in a different coloumn...as part of the output.

@sudhar-krishnakumar
Copy link
Contributor Author

Plan to keep this branch...for a while..just for reference...in case...we want to re-surrect this for some reason. Although it will aslo need this additional change-> nmcli conn show should also specify intfName...otherwise...we end up making invalid assumption...that interface already exists....when actually....that interface name just happens...to show up in a different coloumn...as part of the output.

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