Please review pull request #156: 9482/virtual.rb opened by (ssvarma)

Description:

code added to detect fact virtual and is_virtual correctly for Solaris VM inside KVM/QEMU.

  • Opened: Wed Jan 25 17:03:04 UTC 2012
  • Based on: puppetlabs:master (f16fcfa0945ef8bf2c405a1995aa0d861626ec48)
  • Requested merge: ssvarma:9482/virtual.rb (ef04248ac132cb1884c836a0cd8990f10d202f8c)

Diff follows:

diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index e617359..0e04c77 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -114,6 +114,7 @@
           output.each_line do |pd|
             result = "parallels" if pd =~ /Parallels/
             result = "vmware" if pd =~ /VMware/
+            result = "kvm" if pd =~ /KVM/
             result = "virtualbox" if pd =~ /VirtualBox/
             result = "xenhvm" if pd =~ /HVM domU/
             result = "hyperv" if pd =~ /Product Name: Virtual Machine/
@@ -127,6 +128,7 @@
             output.each_line do |pd|
               result = "parallels" if pd =~ /Parallels/
               result = "vmware" if pd =~ /VMware/
+              result = "kvm" if pd =~ /KVM/
               result = "virtualbox" if pd =~ /VirtualBox/
               result = "xenhvm" if pd =~ /HVM domU/
             end
diff --git a/spec/unit/virtual_spec.rb b/spec/unit/virtual_spec.rb
index 8090358..deef249 100644
--- a/spec/unit/virtual_spec.rb
+++ b/spec/unit/virtual_spec.rb
@@ -67,7 +67,7 @@
       Facter::Util::Macosx.stubs(:profiler_data).returns({ "spdisplays_vendor" => "VMWare" })
       Facter.fact(:virtual).value.should == "vmware"
     end
-  end
+   end
 
   describe "on Linux" do
 
@@ -167,6 +167,17 @@
       Facter.fact(:virtual).value.should == "vmware"
     end
 
+    it "should be kvm with KVM vendor name from prtdiag" do
+      Facter.fact(:kernel).stubs(:value).returns("SunOS")
+      Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
+      Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
+      Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns(nil)
+      Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: KVM Virtual Pla\
+tform")
+      Facter.fact(:virtual).value.should == "kvm"
+    end
+
+
     it "should be parallels with Parallels vendor name from prtdiag" do
       Facter.fact(:kernel).stubs(:value).returns("SunOS")
       Facter.fact(:hardwaremodel).stubs(:value).returns(nil)

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to