Issue #2747 has been updated by James Turnbull.

Target version set to Facter - 1.6.0


----------------------------------------
Bug #2747: the virtual fact and xen
http://projects.reductivelabs.com/issues/2747

Author: seph seph
Status: Accepted
Priority: Normal
Assigned to: 
Category: library
Target version: 1.6.0
Keywords: 
Branch: 


Testing with 1.5.7, though trunk looks about the same.

The xen detection is fairly broken. As is commented in the source file, both 
domU and dom0 have the /proc/sys/xen/independent_wallclock which means 
everything detects as a domu. Futher, /sys/bus/xen is only on my dom0 machines 
and the order of the if statements is wrong.

A related, but possible different bug is that reading /proc/xen/capabilities 
requires root permission. I don't think facter should require root, but maybe 
people disagree.

I see many ways to fix this:
 * You could require root, and check the contents of /proc/xen/capabilities.
 * You could check for some /proc files that seem to only be present in dom0
 * You could check for daemons that only run on dom0
 * You could use compiled code to probe the cpu

I opted to check for various files in /proc. I tested this on ubuntu with xen 
3.3 and xen 3.0, which is all I have easy access to. Patch attached, and new 
code below:
<pre>
        if Facter::Util::Virtual.xen?
            if FileTest.exists?("/proc/xen/xsd_kva")
                result = "xen0"
            #elsif FileTest.exists?("/proc/xen/xsd_port)
            #    result = "xen0"
            elsif FileTest.exists?("/proc/xen/capabilities")
                result = "xenu"
            #elsif FileTest.exists?("/proc/sys/xen/independent_wallclock")
            #    result = "xenu"
            end
        end
</pre>



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account
--
You received this message because you are subscribed to the Google Groups "Puppet Bugs" 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-bugs?hl=en.

Reply via email to