Skip to content

Commit

Permalink
Merge pull request #1305 from chef/remove_old_virtualbox
Browse files Browse the repository at this point in the history
Remove circa ~2005 virtualization hypervisor detection
  • Loading branch information
tas50 authored Nov 26, 2018
2 parents 5fe8b36 + ee2b204 commit 048e003
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 62 deletions.
10 changes: 1 addition & 9 deletions lib/ohai/mixin/dmi_decode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ def guest_from_dmi(dmi_data)
dmi_data.each_line do |line|
case line
when /Manufacturer: Microsoft/
if dmi_data =~ /Product.*: Virtual Machine/
if dmi_data =~ /Version: (7.0|Hyper-V)/
return "hyperv"
elsif dmi_data =~ /Version: (VS2005R2|6.0)/
return "virtualpc"
elsif dmi_data =~ /Version: 5.0/
return "virtualserver"
end
end
return "hyperv" if dmi_data =~ /Version: (7.0|Hyper-V)/
when /Manufacturer: VMware/
return "vmware"
when /Manufacturer: Xen/
Expand Down
34 changes: 0 additions & 34 deletions spec/unit/plugins/linux/virtualization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,23 +192,6 @@
expect(File).to receive(:exist?).with("/usr/sbin/dmidecode").and_return(true)
end

it "sets virtualpc guest if dmidecode detects Microsoft Virtual Machine" do
ms_vpc_dmidecode = <<~MSVPC
System Information
Manufacturer: Microsoft Corporation
Product Name: Virtual Machine
Version: VS2005R2
Serial Number: 1688-7189-5337-7903-2297-1012-52
UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
Wake-up Type: Power Switch
MSVPC
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, ms_vpc_dmidecode, ""))
plugin.run
expect(plugin[:virtualization][:system]).to eq("virtualpc")
expect(plugin[:virtualization][:role]).to eq("guest")
expect(plugin[:virtualization][:systems][:virtualpc]).to eq("guest")
end

it "sets hyperv guest if dmidecode detects Hyper-V or version 7.0" do
ms_hv_dmidecode = <<~MSHV
System Information
Expand All @@ -226,23 +209,6 @@
expect(plugin[:virtualization][:systems][:hyperv]).to eq("guest")
end

it "sets virtualserver guest if dmidecode detects version 5.0" do
ms_vs_dmidecode = <<~MSVS
System Information
Manufacturer: Microsoft Corporation
Product Name: Virtual Machine
Version: 5.0
Serial Number: 1688-7189-5337-7903-2297-1012-52
UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
Wake-up Type: Power Switch
MSVS
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, ms_vs_dmidecode, ""))
plugin.run
expect(plugin[:virtualization][:system]).to eq("virtualserver")
expect(plugin[:virtualization][:role]).to eq("guest")
expect(plugin[:virtualization][:systems][:virtualserver]).to eq("guest")
end

it "sets vmware guest if dmidecode detects VMware" do
vmware_dmidecode = <<~VMWARE
System Information
Expand Down
19 changes: 0 additions & 19 deletions spec/unit/plugins/solaris2/virtualization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,6 @@
@plugin.run
end

it "should set virtualpc guest if smbios detects Microsoft Virtual Machine" do
ms_vpc_smbios = <<~MSVPC
ID SIZE TYPE
1 72 SMB_TYPE_SYSTEM (system information)
Manufacturer: Microsoft Corporation
Product: Virtual Machine
Version: VS2005R2
Serial Number: 1688-7189-5337-7903-2297-1012-52
UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
Wake-Up Event: 0x6 (power switch)
MSVPC
allow(@plugin).to receive(:shell_out).with("/usr/sbin/smbios").and_return(mock_shell_out(0, ms_vpc_smbios, ""))
@plugin.run
expect(@plugin[:virtualization][:system]).to eq("virtualpc")
expect(@plugin[:virtualization][:role]).to eq("guest")
end

it "should set vmware guest if smbios detects VMware Virtual Platform" do
vmware_smbios = <<~VMWARE
ID SIZE TYPE
Expand Down

0 comments on commit 048e003

Please sign in to comment.