Jira (FACT-2081) Facter virtual and is_virtual are worng

17 views
Skip to first unread message

Pierre Bardou (JIRA)

unread,
Oct 24, 2019, 7:19:03 AM10/24/19
to puppe...@googlegroups.com
Pierre Bardou created an issue
 
Facter / Bug FACT-2081
Facter virtual and is_virtual are worng
Issue Type: Bug Bug
Affects Versions: FACT 3.13.1
Assignee: Unassigned
Created: 2019/10/24 4:18 AM
Environment:

OpenBSD 6.6 amd64

qemu-kvm 1:3.1+dfsg-8~deb10u1

Debian 10

 

Priority: Normal Normal
Reporter: Pierre Bardou

Facter gives wrong results on virtual and is_virtual facts when used in an OpenBSD virtual machine over Linux KVM host.

Previous versions also affected

 

root@fwe01 ~ $ facter | grep virt
is_virtual => false
virtual => physical

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Mihai Buzgau (JIRA)

unread,
Oct 25, 2019, 7:26:02 AM10/25/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Team: Night's Watch

Mihai Buzgau (JIRA)

unread,
Oct 25, 2019, 7:26:02 AM10/25/19
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR - Triage

Mihai Buzgau (Jira)

unread,
Mar 5, 2020, 11:50:03 AM3/5/20
to puppe...@googlegroups.com
Mihai Buzgau commented on Bug FACT-2081
 
Re: Facter virtual and is_virtual are worng

Hi, Pierre Bardou we do not support OpenBSD, so we don't have the necessary infrastructure to implement and test a fix.

If you want to contribute, we can work with you to get your PR merged.

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Pierre Bardou (Jira)

unread,
Mar 6, 2020, 8:19:03 AM3/6/20
to puppe...@googlegroups.com

Hi,

 

Thanks for the reply.

Unfortunately I have very few coding skills in Ruby/C++...

 

Facts for the host are :

root@tfe-00001-rc-fwe1 ~ $ facter
augeas => {
{{ version => "1.10.1"}}
}
dmi => {
{{ bios => {}}
{{ vendor => "QEMU",}}
{{ version => "pc-i440fx-3.1"}}
{{ },}}
{{ product => {}}
{{ name => "Standard PC (i440FX + PIIX, 1996)",}}
{{ uuid => "1ed1fa4f-5394-644b-abe1-8b5d28e9cab3"}}
{{ }}}
}
facterversion => 3.14.4
filesystems => ffs
identity => {
{{ gid => 0,}}
{{ group => "wheel",}}
{{ privileged => true,}}
{{ uid => 0,}}
{{ user => "root"}}
}
is_virtual => false
kernel => OpenBSD
kernelmajversion => 6
kernelrelease => 6.6
kernelversion => 6.6
load_averages => {
{{ 15m => 0,}}
{{ 1m => 0,}}
{{ 5m => 0}}
}
memory => {
{{ system => {}}
{{ available => "597.07 MiB",}}
{{ available_bytes => 626069504,}}
{{ capacity => "38.66%",}}
{{ total => "973.43 MiB",}}
{{ total_bytes => 1020715008,}}
{{ used => "376.36 MiB",}}
{{ used_bytes => 394645504}}
{{ }}}
}
mountpoints => {
{{ / => {}}
{{ available => "3.69 GiB",}}
{{ available_bytes => 3966150656,}}
{{ capacity => "24.90%",}}
{{ device => "/dev/sd0a",}}
{{ filesystem => "ffs",}}
{{ options => [}}
{{ "local",}}
{{ "root",}}
{{ "wxallowed"}}
{{ ],}}
{{ size => "4.92 GiB",}}
{{ size_bytes => 5281363968,}}
{{ used => "1.22 GiB",}}
{{ used_bytes => 1315213312}}
{{ }}}
}
networking => {
{{ domain => "twin",}}
{{ fqdn => "tfe-00001-rc-fwe1.twin",}}
{{ hostname => "tfe-00001-rc-fwe1",}}
{{ interfaces => {}}
{{ em0 => {}}
{{ mac => "52:54:00:6c:a4:0d",}}
{{ mtu => 1500}}
{{ },}}
{{ enc0 => {}}
{{ mtu => 0}}
{{ },}}
{{ lo0 => {}}
{{ bindings => [}}
{{ {}}
{{ address => "127.0.0.1",}}
{{ network => "127.0.0.1"}}
{{ }}}
{{ ],}}
{{ bindings6 => [}}
{{ {}}
{{ address => "::1",}}
{{ netmask => "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",}}
{{ network => "::1"}}
{{ },}}
{{ {}}
{{ address => "fe80:5::1",}}
{{ netmask => "ffff:ffff:ffff:ffff::",}}
{{ network => "fe80:5::"}}
{{ }}}
{{ ],}}
{{ ip => "127.0.0.1",}}
{{ ip6 => "::1",}}
{{ mtu => 32768,}}
{{ netmask6 => "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",}}
{{ network => "127.0.0.1",}}
{{ network6 => "::1"}}
{{ },}}
{{ pflog0 => {}}
{{ mtu => 33136}}
{{ },}}
{{ vio0 => {}}
{{ bindings => [}}
{{ {}}
{{ address => "192.168.2.4",}}
{{ network => "192.168.2.4"}}
{{ }}}
{{ ],}}
{{ ip => "192.168.2.4",}}
{{ mac => "52:54:00:6e:aa:d0",}}
{{ mtu => 1500,}}
{{ network => "192.168.2.4"}}
{{ },}}
{{ vio1 => {}}
{{ bindings => [}}
{{ {}}
{{ address => "172.16.1.253",}}
{{ network => "172.16.1.253"}}
{{ }}}
{{ ],}}
{{ ip => "172.16.1.253",}}
{{ mac => "52:54:00:c2:18:c6",}}
{{ mtu => 1500,}}
{{ network => "172.16.1.253"}}
{{ }}}
{{ },}}
{{ ip => "192.168.2.4",}}
{{ mac => "52:54:00:6e:aa:d0",}}
{{ mtu => 1500,}}
{{ network => "192.168.2.4",}}
{{ primary => "vio0"}}
}
os => {
{{ architecture => "amd64",}}
{{ family => "OpenBSD",}}
{{ hardware => "amd64",}}
{{ name => "OpenBSD",}}
{{ release => {}}
{{ full => "6.6",}}
{{ major => "6",}}
{{ minor => "6"}}
{{ }}}
}
path => /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/ bin
processors => {
{{ count => 1,}}
{{ isa => "amd64",}}
{{ models => [}}
{{ "Intel Xeon Processor (Skylake, IBRS)"}}
{{ ],}}
{{ speed => "3.59 GHz"}}
}
ruby => {
{{ platform => "x86_64-openbsd",}}
{{ sitedir => "/usr/local/lib/ruby/site_ruby/2.6",}}
{{ version => "2.6.5"}}
}
ssh => {
{{ dsa => {}}
{{ fingerprints => {}}
{{ sha1 => "SSHFP 2 1 a5f14685a68b9c139c5b1b9b5d4f8c8143011690",}}
{{ sha256 => "SSHFP 2 2 ce9175f3d3677b86d98adfff3c6d5d4c502cecbed92786af485d2 bb3d95537c3"}}
{{ },}}
{{ key => "AAAAB3NzaC1kc3MAAACBAJmu4kpSdxHiR8DaQu9KsAs74UPB2ne+Aism/ZlY8/U8DIWg GUrLJSedDuvdwUlH10kq/9WH9VFofqCrp7+1Yw+VlWzltlq0oTyCCKaPI72BBgCIroUpxBoV3W9UqAbO K0qtZkmFxIEuV9YJIBCewl6zE7nFoKnyUR0nIoBMwyZbAAAAFQD3RmhCGPGUqNmWf4XwCBD76vRLqQAA AIArEOQY9GNNvGnMO0N8QddfS9yfvoogQmo9MbZQdS3fzmUAzrPL5BHSofvBAbiDp8q6L4NOzR0rBVP9 jqAZ4npTuZzVY6pCjzt01x9hlFlkduq5WtmSS0f00B1cTz7Pdl7kmdkFWPdNQ2NExgU7jFB69dz+cgEW nrho255+UFT04QAAAIBjGPkkSbk7FoPEwoILiZpT8SjvuBR1/6aCrlYFDDhjY9IyI6/iiMUV/bLQnCLq meCAvSieN6fpHY8f2MwgLtT5VlkXbKzspjqjLpWY1b54AthuvBm359fMBJwZM5vTadUR6jShPItih61/ vle/Bw6XFZwOCi/6LZw5Z7GqBFB42Q==",}}
{{ type => "ssh-dss"}}
{{ },}}
{{ ecdsa => {}}
{{ fingerprints => {}}
{{ sha1 => "SSHFP 3 1 74785a602b16f0b2540375ab121d7298cad7a095",}}
{{ sha256 => "SSHFP 3 2 e2244cd6078d475d5b889dbaa62de9dbfa8831e2d759f85d2544b 67e7f995e1d"}}
{{ },}}
{{ key => "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFyhwnLyy/FBYPK7 v9RVoqJpxGW6+agJUw1Sra5FcjOGUs5CVMssF73P+ETfC4sSctR/H1Ma73b22nDh/02Ks8E=",}}
{{ type => "ecdsa-sha2-nistp256"}}
{{ },}}
{{ ed25519 => {}}
{{ fingerprints => {}}
{{ sha1 => "SSHFP 4 1 870f4e6a461f4dbe3ecbb3f02a05a47ef8af9bf4",}}
{{ sha256 => "SSHFP 4 2 4839b240c070393dbfc7605a559035d0ebbeaffc29913ddb93ad9 01f54321dfd"}}
{{ },}}
{{ key => "AAAAC3NzaC1lZDI1NTE5AAAAIJV/5qLdp96LKCQxc8+CliBq39RAqJQtueA3mW3niQQY ",}}
{{ type => "ssh-ed25519"}}
{{ },}}
{{ rsa => {}}
{{ fingerprints => {}}
{{ sha1 => "SSHFP 1 1 42c5f7fa9cf4f5000a11acfead58e2d570d490f2",}}
{{ sha256 => "SSHFP 1 2 c3ce1edd459a84f119ec6592b46a65ba8a96271767376d6e26ffd 8c74115ef2d"}}
{{ },}}
{{ key => "AAAAB3NzaC1yc2EAAAADAQABAAABgQDAaS4t8MKPYitdrodaleMmPqBLaCligxKyAZNv V27ZqaMFRZe1dmQ0EV268D9e73UbIRtpwZ1dfHqHdx9jYegRKQLOPpuHB7/hAlJl+kaBlauQxLhBUvlt Z5k94aHF7iYaBvCJwy9ApJ6jm/ATMZBUl2Ylqni8GO/vnNn6gawexm6L+a/TIZ8Vqwp0ZdccVPQsy2HG h9PoDGwfhE98suz/oyo64009vFTsZg2JxwX8sc68c/K0EuMv2LksAK/jAzegcfiRbRzO52MXw9M4mGyZ DRvG0pyO3DlnNLIGn39Zq2eXtj/Bju/xljVxFXUJXF2yVm6VQbkSEJXlolUbf0JjMNj93FWOM/UeF/uK iKvcEYtNvE7pl7gRWX0u6quQ/VWsnVgnbJ/NSQyk0b0l5mPzep1ngrdy9sgWq+GGIp9Lj1/QJrg33RGY viwBxTKmxnF3IypGlK466uVCrZMNEbUCRvzdiHEwZJZ8SsXQ4hzU5q6lIyTFQfXm+gfuXJfhJN8=",}}
{{ type => "ssh-rsa"}}
{{ }}}
}
system_uptime => {
{{ days => 7,}}
{{ hours => 168,}}
{{ seconds => 607731,}}
{{ uptime => "7 days"}}
}
timezone => UTC
virtual => physical

I guess the problem is bios vendor is reported as "QEMU", and in the file lib/src/facts/resolvers/virtualization_resolver.cc line 81 KVM virtualization is detected searching for the string "KVM".

 

A fix has been applied on freeBSD VM (file lib/src/facts/resolvers/virtualization_resolver.cc), lines 23 to 26.

 

So I think this diff can do the trick :

root@tfe-00001-rc-fwe1 ~ $ diff facter/lib/src/facts/openbsd/dmi_resolver.cc dmi_resolver.cc
25a26,30
>         // Fix for OpenBSD on KVM
>         if (result.manufacturer == "QEMU") {
>             result.product_name = "KVM";
>         }
>

Unfortunately, I didn't manage to compile facter, so I can't test it.

root@tfe-00001-rc-fwe1 ~ $ pkg_add boost cmake curl g++ ruby yaml-cpp
quirks-3.183 signed on 2020-03-06T11:20:52Z
quirks-3.182->3.183: ok
cmake-3.15.3v0:jsoncpp-1.8.4p2: ok
cmake-3.15.3v0:libuv-1.30.1: ok
cmake-3.15.3v0:rhash-1.3.5p0: ok
cmake-3.15.3v0:lz4-1.9.2: ok
cmake-3.15.3v0:zstd-1.4.3: ok
cmake-3.15.3v0:libb2-0.98.1v0: ok
cmake-3.15.3v0:libarchive-3.4.0: ok
cmake-3.15.3v0: ok
g++-8.3.0p4:mpfr-3.1.5.2p1: ok
g++-8.3.0p4:libmpc-0.9p2: ok
g++-8.3.0p4:gcc-libs-8.3.0p4: ok
g++-8.3.0p4:gcc-8.3.0p4: ok
g++-8.3.0p4: ok
Ambiguous: choose package for ruby
a 0: <None>
{{ 1: ruby-2.4.9}}
{{ 2: ruby-2.5.7}}
{{ 3: ruby-2.6.5}}
Your choice: 3
Read shared items: okroot@tfe-00001-rc-fwe1 ~ $ git clone https://github.com/puppetlabs/facter.git
Cloning into 'facter'...
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (27/27), done.
remote: Total 45071 (delta 8), reused 6 (delta 1), pack-reused 45043
Receiving objects: 100% (45071/45071), 13.35 MiB | 3.58 MiB/s, done.
Resolving deltas: 100% (29177/29177), done.
root@tfe-00001-rc-fwe1 ~ $ cd facter/
root@tfe-00001-rc-fwe1 ~/facter $ ls
.editorconfig .gitmodules CMakeLists.txt Extensibility.md README.md appveyor.yml exe lib scripts
.git .mailmap CODEOWNERS Gemfile Rakefile cmake ext locales tasks
.gitignore .travis.yml CONTRIBUTING.md LICENSE acceptance contrib factergo man
root@tfe-00001-rc-fwe1 ~/facter $ mkdir release
root@tfe-00001-rc-fwe1 ~/facter $ cd release
root@tfe-00001-rc-fwe1 ~/facter/release $ cmake ..
-- The C compiler identification is Clang 8.0.1
-- The CXX compiler identification is Clang 8.0.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc – broken
CMake Error at /usr/local/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
{{ The C compiler}}"/usr/bin/cc"is not able to compile a simple test program.It fails with the following output:Change Dir: /root/facter/release/CMakeFiles/CMakeTmpRun Build Command(s):/usr/bin/make cmTC_4003a/fast && /usr/bin/make -f CMakeFiles/cmTC_4003a.dir/build.make CMakeFiles/cmTC_4003a.dir/build
{{ Building C object CMakeFiles/cmTC_4003a.dir/testCCompiler.c.o}}
{{ /usr/bin/cc -o CMakeFiles/cmTC_4003a.dir/testCCompiler.c.o -c /root/facter/release/CMakeFiles/CMakeTmp/testCCompiler.c}}
{{ Linking C executable cmTC_4003a}}
{{ /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4003a.dir/link.txt --verbose=1}}
{{ /usr/bin/cc CMakeFiles/cmTC_4003a.dir/testCCompiler.c.o -o cmTC_4003a -Wl,-rpath-link,/usr/local/lib}}
{{ ld: error: cannot open crt0.o: No such file or directory}}
{{ cc: error: linker command failed with exit code 1 (use -v to see invocation)}}
{{ *** Error 1 in . (CMakeFiles/cmTC_4003a.dir/build.make:87 'cmTC_4003a')}}
{{ *** Error 1 in /root/facter/release/CMakeFiles/CMakeTmp (Makefile:121 'cmTC_4003a/fast')}}  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
{{ CMakeLists.txt:2 (project)}}
-- Configuring incomplete, errors occurred!
See also "/root/facter/release/CMakeFiles/CMakeOutput.log".
See also "/root/facter/release/CMakeFiles/CMakeError.log".

 

Bogdan Irimie (Jira)

unread,
Nov 5, 2020, 3:51:04 AM11/5/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Nov 5, 2020, 3:51:05 AM11/5/20
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sprint: ready for triage

Mihai Buzgau (Jira)

unread,
Dec 4, 2020, 11:03:04 AM12/4/20
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Labels: help_wanted

Mihai Buzgau (Jira)

unread,
Dec 4, 2020, 11:03:04 AM12/4/20
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: ready for triage

Kenyon Ralph (Jira)

unread,
Dec 5, 2020, 3:34:03 PM12/5/20
to puppe...@googlegroups.com
Kenyon Ralph commented on Bug FACT-2081
 
Re: Facter virtual and is_virtual are worng

Same problem with Puppet Collection 7.

kenyon@puppet ~ % facter --version
4.0.46
 
kenyon@puppet ~ % uname --all
Linux puppet 5.6.14-x86_64-linode135 #1 SMP PREEMPT Fri May 22 14:57:20 UTC 2020 x86_64 GNU/Linux
 
kenyon@puppet ~ % lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
Address sizes:       40 bits physical, 48 bits virtual
CPU(s):              1
On-line CPU(s) list: 0
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           1
NUMA node(s):        1
Vendor ID:           AuthenticAMD
CPU family:          23
Model:               1
Model name:          AMD EPYC 7601 32-Core Processor
Stepping:            2
CPU MHz:             2199.998
BogoMIPS:            4401.32
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           64K
L1i cache:           64K
L2 cache:            512K
L3 cache:            16384K
NUMA node0 CPU(s):   0
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext
 fxsr_opt pdpe1gb rdtscp lm rep_good nopl cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popc$
t tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw perfctr
_core ssbd ibpb vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves virt_ss
bd arat
 
kenyon@puppet ~ % facter is_virtual
false
kenyon@puppet ~ % facter virtual
physical

Reply all
Reply to author
Forward
0 new messages