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

(FACT-3452) Make Xen resolver more strict #2650

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

mhashizume
Copy link
Contributor

Prior to this commit, Facter could misidentify non-Xen systems as being Xen-based.

In some circumstances, a non-Xen system will have /dev/xvd* files present as symlinks to other devices. This was observed on an Amazon Linux 2023 machine, which was running on a Nitro (KVM-based) hypervisor but symlinked /dev/xvda1 to an nvme device.

This commit updates the Xen resolver to check if /dev/xvda1 is a symlink to avoid misidentifying if a system is Xen-based.

@mhashizume mhashizume requested a review from a team as a code owner December 4, 2023 19:51
@mhashizume mhashizume force-pushed the FACT-3452/main/amazon-cloud branch from 29be3d7 to 3a2ac89 Compare December 4, 2023 19:55
Prior to this commit, Facter could misidentify non-Xen systems as being
Xen-based.

In some circumstances, a non-Xen system will have /dev/xvd* files
present as symlinks to other devices. This was observed on an Amazon
Linux 2023 machine, which was running on a Nitro (KVM-based) hypervisor
but symlinked /dev/xvda1 to an nvme device.

This commit updates the Xen resolver to check if /dev/xvda1 is a symlink
to avoid misidentifying if a system is Xen-based.
@mhashizume mhashizume force-pushed the FACT-3452/main/amazon-cloud branch from 3a2ac89 to a11f4f8 Compare December 4, 2023 19:57
@mhashizume
Copy link
Contributor Author

mhashizume commented Dec 4, 2023

On an Amazon Linux 2023 machine running on a t4g.medium instance on Nitro, the system symlinks /dev/xvda1:

$ ls -l /dev/xvda1
lrwxrwxrwx. 1 root root 9 Dec  4 15:58 /dev/xvda1 -> nvme0n1p1

This is how Facter currently behaves:

$ git describe
4.2.5-320-g421f9731c
$ bundle exec facter cloud

$ bundle exec facter virtual
xenu

Note that Facter doesn't resolve the cloud fact and misidentifies the machine as Xen.

With this PR:

$ git describe
4.2.5-375-ga11f4f8a4
$ bundle exec facter cloud
{
  provider => "aws"
}
$ bundle exec facter virtual
kvm

@mhashizume mhashizume linked an issue Dec 4, 2023 that may be closed by this pull request
@mhashizume mhashizume added the bug Something isn't working label Dec 4, 2023
@joshcooper joshcooper merged commit 352e2a8 into puppetlabs:main Dec 6, 2023
17 checks passed
@mhashizume mhashizume deleted the FACT-3452/main/amazon-cloud branch December 6, 2023 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloud fact does not resolve on Amazon Linux 2023
2 participants