Bug #10225
virtual fact does not detect linux vserver host/guest correctly
| Status: | Investigating | Start date: | 10/21/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | library | |||
| Target version: | 1.6.x | |||
| Keywords: | vserver | Affected Facter version: | 1.6.2 | |
| Branch: | ||||
| Votes: | 0 |
Description
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:
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
This does not relly on file xx or yy to be there it just test if the current process has a virtual ID.
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
History
Updated by James Turnbull 7 months ago
- Description updated (diff)
- Status changed from Unreviewed to Needs Decision
- Assignee set to Adrien Thebo
Updated by Adrien Thebo 7 months ago
- Status changed from Needs Decision to Investigating
I’m assuming you’re referring to this? http://linux-vserver.org/
Updated by ghislain - 7 months ago
Le 28/10/2011 21:24, tickets@puppetlabs.com a écrit :
Issue #10225 has been updated by Adrien Thebo.
- Status changed from Needs Decision to Investigating
I’m assuming you’re referring to this? http://linux-vserver.org/
yes i do :)
Updated by Michael Stahnke 7 months ago
- Target version changed from 1.6.2 to 1.6.x
can’t be targeted at 1.6.2, since 1.6.2 is out.
Updated by Adrien Thebo 6 months ago
- Subject changed from virtual fact does not detect host/guest correctly to virtual fact does not detect linux vserver host/guest correctly
Updated by Adrien Thebo 10 days ago
- Assignee deleted (
Adrien Thebo)