Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/facter/resolvers/windows/virtualization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def determine_hypervisor_by_manufacturer(comp)
'hyperv'
elsif /^Xen/.match?(manufacturer)
'xen'
elsif /^Amazon EC2/.match?(manufacturer)
elsif /^(Amazon EC2|QEMU)/.match?(manufacturer)
'kvm'
else
'physical'
Expand Down
20 changes: 20 additions & 0 deletions spec/facter/resolvers/windows/virtualization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,26 @@
end
end

describe '#resolve Proxmox/QEMU VM' do
before do
allow(win32ole).to receive(:Model).and_return(model)
allow(win32ole).to receive(:Manufacturer).and_return(manufacturer)
allow(win32ole).to receive(:OEMStringArray).and_return('')
end

let(:query_result) { [win32ole] }
let(:model) { 'Standard PC (i440FX + PIIX, 1996)' }
let(:manufacturer) { 'QEMU' }

it 'detects virtual machine model' do
expect(Facter::Resolvers::Windows::Virtualization.resolve(:virtual)).to eql('kvm')
end

it 'detects that is virtual' do
expect(Facter::Resolvers::Windows::Virtualization.resolve(:is_virtual)).to be(true)
end
end

describe '#resolve Physical Machine' do
before do
allow(win32ole).to receive(:Model).and_return(model)
Expand Down