-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ec2): Fix broken uuid match with other-endianness (#5236)
EC2 documents that the system-uuid may be reported in different endianness[1]. A user has reported a case where cloud-init is broken due to inability to detect the system platform. Fix it. Behavior change: Cloud-init was previously making the assumption that uuid and serial would match on ec2. This assumption was: 1) not documented as a valid way to identify ec2[1] 2) proven invalid on ec2 by the DMI_PRODUCT_SERIAL and DMI_PRODUCT_UUID reported in #5105 3) used in the logic which warns about not running on the "real" ec2 Preserving this warning logic exactly as it was presents several challenges: a) Risk of regression outside of our control: Since this logic relied upon undocumented behavior, AWS could change this at any point, which would break all cloud-init instances. b) Risk of incorrect implementation: What format is the uuid and product serial actually in? We don't know. It's easy and safe to just swap the byteorder of the first segment of the uuid because this is documented, but matching the whole uuid is problematic because UUID formats may be presented as mixed encoding (partially little endian and partially big endian). To implement this behavior while fixing this bug we would have to make even more assumptions than before. I propose we stop assuming and if a cloud happens to implement the same as EC2 (minus the serial/product match), then we just don't emit that warning. It's simpler, it's safer, and I really don't think that it is a huge change. This is a "change in behavior", but the change is that the code more correctly identifies EC2 and would no longer emit a warning on valid ec2 instances, so I don't think that this would require omitting this change from SRU. c) Implementing whatever assumptions we make in b) would require implementing a byteswapping algorithm in POSIX shell, which is possible but best to avoid this if possible. [1] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/identify_ec2_instances.html Fixes GH-5105
- Loading branch information
Showing
4 changed files
with
75 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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