fix(ec2): ignore all-zero /sys/hypervisor/uuid - #6953
Open
Sanjays2402 wants to merge 1 commit into
Open
Conversation
On a Xen dom0 /sys/hypervisor/uuid reads all zeros. _collect_platform_data() prefers that file over DMI and an all-zero uuid is truthy, so the DMI fallback never ran and AWS was not identified. No IMDSv2 token was then requested, and with HttpTokens=required the tokenless IMDSv1 requests failed for the full 240 second wait before the datasource gave up. Treat the null uuid as absent so the DMI system-uuid is used. Fixes canonicalGH-6937
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Commit Message
Additional Context
Fixes #6937
Reported in #6937 with logs from an Ubuntu 24.04 EC2 instance booted as a Xen dom0.
Test Steps
tests/unittests/sources/test_ec2.py::TestIdentifyPlatform::test_identify_aws_null_hypervisor_uuidmocks the null/sys/hypervisor/uuidand anec2...DMI system-uuid; it fails on the current code (unknown) and passes with this change (aws). The rest oftests/unittests/sources/test_ec2.pyis unchanged and green (67 passed).On a live system: boot an EC2 instance with
--metadata-options HttpTokens=requiredas a Xen dom0, then check thatcloud-initidentifies the AWS datasource instead of waiting out the 240 second IMDSv1 timeout and falling back toDataSourceNone.Merge type