ohai 0.6.6.rc.0 → 0.6.6.rc.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,11 +22,12 @@ virtualization Mash.new
22
22
 
23
23
  # if it is possible to detect paravirt vs hardware virt, it should be put in
24
24
  # virtualization[:mechanism]
25
- if File.exists?("/proc/xen/capabilities")
26
- virtualization[:system] = "xen"
27
- if File.read("/proc/xen/capabilities") =~ /control_d/i
25
+ if File.exists?("/proc/xen")
26
+ if File.exists?("/dev/xen/evtchn")
27
+ virtualization[:system] = "xen"
28
28
  virtualization[:role] = "host"
29
29
  else
30
+ virtualization[:system] = "xen"
30
31
  virtualization[:role] = "guest"
31
32
  end
32
33
  end
data/lib/ohai/version.rb CHANGED
@@ -18,6 +18,6 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = '0.6.6.rc.0'
21
+ VERSION = '0.6.6.rc.1'
22
22
  end
23
23
 
@@ -26,26 +26,27 @@ 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/capabilities").and_return(false)
29
+ File.stub(:exists?).with("/proc/xen").and_return(false)
30
+ File.stub(:exists?).with("/dev/xen/evtchn").and_return(false)
30
31
  File.stub!(:exists?).with("/proc/modules").and_return(false)
31
32
  File.stub!(:exists?).with("/proc/cpuinfo").and_return(false)
32
33
  File.stub!(:exists?).with("/usr/sbin/dmidecode").and_return(false)
33
34
  File.stub!(:exists?).with("/proc/self/status").and_return(false)
34
- File.stub!(:exists?).with("/proc/user_beancounters").and_return(false)
35
+ File.stub!(:exists?).with("/proc/user_beancounters").and_return(false)
35
36
  end
36
37
 
37
38
  describe "when we are checking for xen" do
38
- it "should set xen host if /proc/xen/capabilities contains control_d" do
39
- File.should_receive(:exists?).with("/proc/xen/capabilities").and_return(true)
40
- File.stub!(:read).with("/proc/xen/capabilities").and_return("control_d")
39
+ it "should set xen host if /proc/xen " do
40
+ File.should_receive(:exists?).with("/proc/xen").and_return(true)
41
+ File.should_receive(:exists?).with("/dev/xen/evtchn").and_return(true)
41
42
  @ohai._require_plugin("linux::virtualization")
42
43
  @ohai[:virtualization][:system].should == "xen"
43
44
  @ohai[:virtualization][:role].should == "host"
44
45
  end
45
46
 
46
- it "should set xen guest if /proc/xen/capabilities exists" do
47
- File.should_receive(:exists?).with("/proc/xen/capabilities").and_return(true)
48
- File.stub!(:read).with("/proc/xen/capabilities").and_return("")
47
+ it "should set xen guest if no /dev/xen/evtchn" do
48
+ File.should_receive(:exists?).with("/proc/xen").and_return(true)
49
+ File.should_receive(:exists?).with("/dev/xen/evtchn").and_return(false)
49
50
  @ohai._require_plugin("linux::virtualization")
50
51
  @ohai[:virtualization][:system].should == "xen"
51
52
  @ohai[:virtualization][:role].should == "guest"
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: 15424069
4
+ hash: 15424071
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
9
  - 6
10
10
  - rc
11
- - 0
12
- version: 0.6.6.rc.0
11
+ - 1
12
+ version: 0.6.6.rc.1
13
13
  platform: ruby
14
14
  authors:
15
15
  - Adam Jacob
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-09-21 00:00:00 Z
20
+ date: 2011-09-26 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: yajl-ruby