Skip to content

Conversation

@raineszm
Copy link
Contributor

@raineszm raineszm commented Jan 6, 2026

Proposed Commit Message

fix(ec2): check elastic NICs for metadata server first

The EC2 datasource checks all NICs one by one to see which can reach the
metadata server. This can lead to slow boot if the primary NIC is not checked
first. We use the fact that typically the primary NIC on an EC2 instance will
be the lowest numbered Elastic interface (either ENA or EFA) and order these
first. Only then checking other network devices that may be present.

Fixes GH-6618

Test Steps

The fix can be tested by starting an AWS EC2 instance with an image that contains the patch. The metadata should be fetched from the primary interface of the instance.

See PALS-1874 for more details.

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

The EC2 datasource checks all NICs one by one to see which can reach the
metadata server. This can lead to slow boot if the primary NIC is not
checked first. We use the fact that typically the primary NIC on an EC2
instance will be the lowest numbered Elastic interface (either ENA or
EFA) and order these first. Only then checking other network devices
that may be present.

Fixes canonicalGH-6618

Signed-off-by: Zachary Raines <zachary.raines@canonical.com>
Copy link
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

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

I left a few nitpicks comments - this is really good. Thanks, @raineszm.


# Drivers that indicate a NIC is being provided by EC2
# as an Elastic Network Adaptor or Elastic Fabric Adapter
# https://github.com/amzn/amzn-drivers/tree/46e50d6265ef6669877610549205973955748039/kernel/linux
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how this link relates to the comment, outside of the fact that it is the repo for amazon's network drivers. Is there something significant about this commitish?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just where I sourced the list of amazon driver types from. I'm not sure if there's a more authoritative listing of what kernel drivers are used by AWS elastic interfaces.

Copy link
Member

Choose a reason for hiding this comment

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

I see. In that case the main repo page (https://github.com/amzn/amzn-drivers/) seems more authoritative than a specific committish that could be removed at any point. And no need for the extra whitespace before the link.

@holmanb holmanb self-assigned this Jan 6, 2026
Signed-off-by: Zachary Raines <zachary.raines@canonical.com>
@raineszm raineszm requested a review from holmanb January 7, 2026 14:57
Copy link
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

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

Thank you for your work on this, @raineszm! We're getting there, this looks closer to ready.

Can you please include some details in the PR description about verification? It would be helpful in the future to know what kind of instance will be affected by this change, and cloud-init.log from a system that was tested with this change.

Also the commit message is long - it should be wrapped to a shorter line length.

Once those and my other comment are addressed, I think this should be ready to merge.


# Drivers that indicate a NIC is being provided by EC2
# as an Elastic Network Adaptor or Elastic Fabric Adapter
# https://github.com/amzn/amzn-drivers/tree/46e50d6265ef6669877610549205973955748039/kernel/linux
Copy link
Member

Choose a reason for hiding this comment

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

I see. In that case the main repo page (https://github.com/amzn/amzn-drivers/) seems more authoritative than a specific committish that could be removed at any point. And no need for the extra whitespace before the link.

Signed-off-by: Zachary Raines <zachary.raines@canonical.com>
Copy link
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

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

Thanks @raineszm!

@holmanb holmanb merged commit 7af9d0a into canonical:main Jan 7, 2026
21 checks passed
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.

2 participants