ohai 0.6.8.rc.0 → 0.6.8.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,21 +24,24 @@ virtualization Mash.new
|
|
|
24
24
|
# virtualization[:mechanism]
|
|
25
25
|
|
|
26
26
|
## Xen
|
|
27
|
-
#
|
|
28
|
-
if File.exists?("/proc/xen
|
|
29
|
-
virtualization[:system] = "xen"
|
|
30
|
-
if File.read("/proc/xen/capabilities") =~ /control_d/i
|
|
31
|
-
virtualization[:role] = "host"
|
|
32
|
-
else
|
|
33
|
-
virtualization[:role] = "guest"
|
|
34
|
-
end
|
|
35
|
-
# Guests do not always have this file, but may
|
|
36
|
-
elsif File.exists?("/proc/sys/xen/independent_wallclock")
|
|
27
|
+
# Empty dir for EL6 guests
|
|
28
|
+
if File.exists?("/proc/xen")
|
|
37
29
|
virtualization[:system] = "xen"
|
|
30
|
+
# Assume guest
|
|
38
31
|
virtualization[:role] = "guest"
|
|
32
|
+
|
|
33
|
+
# This file should exist on most Xen systems, normally empty for guests
|
|
34
|
+
if File.exists?("/proc/xen/capabilities")
|
|
35
|
+
if File.read("/proc/xen/capabilities") =~ /control_d/i
|
|
36
|
+
virtualization[:role] = "host"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
39
|
end
|
|
40
|
-
|
|
41
|
-
#
|
|
40
|
+
|
|
41
|
+
# Xen Notes:
|
|
42
|
+
# - cpuid of guests, if we could get it, would also be a clue
|
|
43
|
+
# - may be able to determine if under paravirt from /dev/xen/evtchn (See OHAI-253)
|
|
44
|
+
# - EL6 guests carry a 'hypervisor' cpu flag
|
|
42
45
|
|
|
43
46
|
# Detect from kernel module
|
|
44
47
|
if File.exists?("/proc/modules")
|
data/lib/ohai/version.rb
CHANGED
|
@@ -26,8 +26,8 @@ describe Ohai::System, "Linux virtualization platform" do
|
|
|
26
26
|
@ohai.extend(SimpleFromFile)
|
|
27
27
|
|
|
28
28
|
# default to all requested Files not existing
|
|
29
|
+
File.stub!(:exists?).with("/proc/xen").and_return(false)
|
|
29
30
|
File.stub!(:exists?).with("/proc/xen/capabilities").and_return(false)
|
|
30
|
-
File.stub!(:exists?).with("/proc/sys/xen/independent_wallclock").and_return(false)
|
|
31
31
|
File.stub!(:exists?).with("/proc/modules").and_return(false)
|
|
32
32
|
File.stub!(:exists?).with("/proc/cpuinfo").and_return(false)
|
|
33
33
|
File.stub!(:exists?).with("/usr/sbin/dmidecode").and_return(false)
|
|
@@ -36,7 +36,16 @@ describe Ohai::System, "Linux virtualization platform" do
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
describe "when we are checking for xen" do
|
|
39
|
+
it "should set xen guest if /proc/xen exists but /proc/xen/capabilities does not" do
|
|
40
|
+
File.should_receive(:exists?).with("/proc/xen").and_return(true)
|
|
41
|
+
File.should_receive(:exists?).with("/proc/xen/capabilities").and_return(false)
|
|
42
|
+
@ohai._require_plugin("linux::virtualization")
|
|
43
|
+
@ohai[:virtualization][:system].should == "xen"
|
|
44
|
+
@ohai[:virtualization][:role].should == "guest"
|
|
45
|
+
end
|
|
46
|
+
|
|
39
47
|
it "should set xen host if /proc/xen/capabilities contains control_d " do
|
|
48
|
+
File.should_receive(:exists?).with("/proc/xen").and_return(true)
|
|
40
49
|
File.should_receive(:exists?).with("/proc/xen/capabilities").and_return(true)
|
|
41
50
|
File.stub!(:read).with("/proc/xen/capabilities").and_return("control_d")
|
|
42
51
|
@ohai._require_plugin("linux::virtualization")
|
|
@@ -45,6 +54,7 @@ describe Ohai::System, "Linux virtualization platform" do
|
|
|
45
54
|
end
|
|
46
55
|
|
|
47
56
|
it "should set xen guest if /proc/xen/capabilities exists but is empty" do
|
|
57
|
+
File.should_receive(:exists?).with("/proc/xen").and_return(true)
|
|
48
58
|
File.should_receive(:exists?).with("/proc/xen/capabilities").and_return(true)
|
|
49
59
|
File.stub!(:read).with("/proc/xen/capabilities").and_return("")
|
|
50
60
|
@ohai._require_plugin("linux::virtualization")
|
|
@@ -52,13 +62,6 @@ describe Ohai::System, "Linux virtualization platform" do
|
|
|
52
62
|
@ohai[:virtualization][:role].should == "guest"
|
|
53
63
|
end
|
|
54
64
|
|
|
55
|
-
it "should set xen guest if /proc/sys/xen/independent_wallclock exists" do
|
|
56
|
-
File.should_receive(:exists?).with("/proc/sys/xen/independent_wallclock").and_return(true)
|
|
57
|
-
@ohai._require_plugin("linux::virtualization")
|
|
58
|
-
@ohai[:virtualization][:system].should == "xen"
|
|
59
|
-
@ohai[:virtualization][:role].should == "guest"
|
|
60
|
-
end
|
|
61
|
-
|
|
62
65
|
it "should not set virtualization if xen isn't there" do
|
|
63
66
|
File.should_receive(:exists?).at_least(:once).and_return(false)
|
|
64
67
|
@ohai._require_plugin("linux::virtualization")
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ohai
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 15424055
|
|
5
5
|
prerelease: 6
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 6
|
|
9
9
|
- 8
|
|
10
10
|
- rc
|
|
11
|
-
-
|
|
12
|
-
version: 0.6.8.rc.
|
|
11
|
+
- 1
|
|
12
|
+
version: 0.6.8.rc.1
|
|
13
13
|
platform: ruby
|
|
14
14
|
authors:
|
|
15
15
|
- Adam Jacob
|