Bug #2242

Simplify OpenVZ detection, based on /proc/self/status

Added by Christian Hofstaedtler over 1 year ago. Updated 28 days ago.

Status:Needs design decision Start:05/12/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:1.6.0
Keywords: Branch:
Votes: 0

Description

virtual.rb currently does lot’s of things to detect different virtualization environments. As some of them represent their state in /proc/self/status, it would be cool if this could be unified. Paul also wanted to create tests for virtual.rb, based on /proc/self/status.

OpenVZ states in /proc/self/status:

envID == 0 –> openvzhn envID present but > 0 –> openvzve

f74155e7e.txt - /proc/self/status from an openvzhn (814 Bytes) Christian Hofstaedtler, 05/12/2009 07:43 am

History

Updated by James Turnbull over 1 year ago

  • Status changed from Unreviewed to Accepted

Updated by Paul Nasrat about 1 year ago

TODO after #2292 merged

Updated by Benedikt Böhm about 1 year ago

isn’t the current detection, based on the fact that /proc/vz/version exists, a lot simpler than doing regex and ==/> comparison?

Updated by Christian Hofstaedtler about 1 year ago

Benedikt Böhm wrote:

isn’t the current detection, based on the fact that /proc/vz/version exists, a lot simpler than doing regex and ==/> comparison?

Maybe. But /proc/self/status is read anyway already in the virtual fact, so reading more files is pointless.

Updated by Matthew Cluver 28 days ago

Christian Hofstaedtler wrote:

Benedikt Böhm wrote:

isn’t the current detection, based on the fact that /proc/vz/version exists, a lot simpler than doing regex and ==/> comparison?

Maybe. But /proc/self/status is read anyway already in the virtual fact, so reading more files is pointless.

The problem is that it’s not reliable that way, all that has to happen is a file being put into that directory to break the logic.

This is solid and all in one nice little statement:

(%x[cat /proc/self/status | awk ‘$1 == “envID:” {print $2}’]) ? result = “openvzhn” : result =“openvzve”

Updated by Rein Henrichs 28 days ago

  • Status changed from Accepted to Needs design decision

Thanks for giving the ticket some attention, Matthew. Not using OpenVZ makes it difficult for me to assess the proposed solution. Anyone?

Also available in: Atom PDF