Repository navigation
fix (EC2/GCE): wait for NIC on allowlisted platforms - #7065
Conversation
blackboxsw
left a comment
There was a problem hiding this comment.
Thank you for all this work @goldberl! I think this looks like a contained approach which limits exposure to boot-time costs to known instance types.
I have a number of requests and discussion points inline. Please do feel free to push back on things that you think are unreasonable.
Can you also please add a comment with the related log entries emitted by this PR on a working instance?
9ae9014 to
8517063
Compare
|
Hi @blackboxsw, thank you for the detailed review. I've made the following changes to the PR:
I'll run tests on AWS and GCP instances to capture updated logs and update the PR description with those |
29aa35b to
f9d5234
Compare
blackboxsw
left a comment
There was a problem hiding this comment.
@goldberl thank you for this iteration.
While looking at the end product here, the use of timeout as dual purpose where 0 means just run once and > 0 means max_wait it makes it a bit harder to discern the intent of the timeout param.
I think we may need to go with the alternative solution to pre-flight check:
if not wait_on_nics:
find_candidate_nics()
else:
wait_on_candidate_nics()
That should then ensure a clear path between conditions which require calling wait_for_candidate_nics versus those we expect to succeed on a single call.
f9d5234 to
f230c3e
Compare
|
Thank you again @blackboxsw for your continuous feedback. I've updated the PR with the following changes:
|
f230c3e to
0925e3f
Compare
|
Simplified logic in datasource files with a straightforward if/else block for better readability. |
There was a problem hiding this comment.
@goldberl this looks great. Thank you for the changes here. I think this makes things much easier to understand at the call-sites in GCE and Ec2 datasources.
One minor nit on when we should enter the perfomance.Timed context manager and then we can merge this.
I ran the full suite of integration tests with this changeset and see no degradation in behavior for standard instance types.
…latforms On some GCE and AWS EC2 instances, cloud-init-local runs before network interfaces are fully initialized by the kernel. This causes early datasource detection to fail, preventing metadata fetching and SSH access. To avoid introducing boot delays across all platforms, implement allowlist gated NIC polling and centralize the retry logic in a shared network helper: * add wait_for_candidate_nics() in cloudinit/net/__init__.py * use helper from DataSourceEc2 and DataSourceGCE only when allowlisted * EC2 gate: DMI system-product-name (e.g. hpc7a.96xlarge) * GCE gate: DMI baseboard-product-name (e.g. izumi) Fixes first-boot race conditions on affected AWS and GCP instances without impacting unaffected instance types or breaking unit tests. Add unit coverage for: * helper retry/timeout behavior * EC2 allowlisted vs non-allowlisted polling paths * GCE allowlisted vs non-allowlisted polling paths Fixes: canonicalGH-6697, canonicalGH-6737, LP-2144694 Signed-off-by: Leah Goldberg <leah.goldberg@canonical.com>
0925e3f to
97c313e
Compare
|
@blackboxsw Thanks for the review again! Made the small change in |
blackboxsw
left a comment
There was a problem hiding this comment.
Thank you for the detailed work here @goldberl. Let's get this fix shipped!
On some GCE and AWS EC2 instances, cloud-init-local runs before network interfaces are fully initialized by the kernel. This causes early datasource detection to fail, preventing metadata fetching and SSH access. To avoid introducing boot delays across all platforms, implement allowlist-gated NIC polling and centralize the retry logic in a shared network helper: * add wait_for_candidate_nics() in cloudinit/net/init.py * use helper from DataSourceEc2 and DataSourceGCE when allowlisted * EC2 gate: DMI system-product-name (e.g. hpc7a.96xlarge) * GCE gate: DMI baseboard-product-name (e.g. izumi) Fixes first-boot race conditions on affected AWS and GCP instances without impacting unaffected instance types or breaking unit tests. Add unit coverage for: * helper retry/timeout behavior * EC2 allowlisted vs non-allowlisted polling paths * GCE allowlisted vs non-allowlisted polling paths Fixes: canonicalGH-6697, canonicalGH-6737 LP: #2144694 Signed-off-by: Leah Goldberg <leah.goldberg@canonical.com>
PR canonical#7065 added wait_for_candidate_nics() for hpc7a.96xlarge, but fast-booting Graviton instances (m8g, r8g, c8g, etc.) still hit the race condition where cloud-init-local runs before ena finishes PCI probe. When that happens, DataSourceEc2 exits without writing network config. Poll for candidate NICs on Graviton instances by matching product prefixes (m8g., r8g., c8g., c7g., m7g., r7g.) in DMI system-product-name. Fixes canonicalGH-6697 LP: #2151279
PR canonical#7065 added wait_for_candidate_nics() for hpc7a.96xlarge, but fast-booting Graviton instances (m8g, r8g, c8g, c7g, m7g, r7g, c6g, m6g, r6g, t4g) still hit the race condition where cloud-init-local runs before ena finishes PCI probe. When that happens, DataSourceEc2 exits without writing network config. Poll for candidate NICs on Graviton instances by matching product prefixes (m8g., r8g., c8g., c7g., m7g., r7g., c6g., m6g., r6g., t4g.) in DMI system-product-name. Fixes canonicalGH-6697 LP: #2151279
Proposed Commit Message
Additional info
This fix will emit logs on affected AWS and GCP instances when NIC polling is enabled, such as:
Merge type