Issue #10225 has been updated by Adrien Thebo. Assignee deleted (Adrien Thebo)
---------------------------------------- Bug #10225: virtual fact does not detect linux vserver host/guest correctly https://projects.puppetlabs.com/issues/10225#change-62616 Author: ghislain - Status: Investigating Priority: Normal Assignee: Category: library Target version: 1.6.x Keywords: vserver Branch: Affected Facter version: 1.6.2 the virtual fact does not work on vserver 2.3.1 because /proc/virtual is hidden but still detected by facter: The only REAL way to tell is to test /proc/self/status and look for the vxid, if zero => host, if 1 => special spectator context facter will nerver see this one, if more => guest i wrote this one for me: <pre> if File.exists?("/proc/self/status") File.open('/proc/self/status').each_line{ |s| procstatus = s.split(': '); if procstatus[0] == 'VxID' if procstatus[1].strip! == '0' # this is the host Facter.add("vps") do setcode{ "vserverhost" } end else # this is the guest Facter.add("vps") do setcode{ "vserverguest" } end end else # pas un vserver end } end </pre> This does not relly on file xx or yy to be there it just test if the current process has a virtual ID. <pre> GUEST:/%(root)> facter virtual vserver_host GUEST:/%(root)> grep -i VXid /proc/self/status VxID: 40410 (root)> vserver-info Versions: Kernel: 3.0.7-vs2.3.1aq VS-API: 0x00020308 VCI: 0x0000000013001f11 util-vserver: 0.30.216-pre2994; Oct 21 2011, 17:32:30 </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://projects.puppetlabs.com/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 puppet-bugs@googlegroups.com. To unsubscribe from this group, send email to puppet-bugs+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.