Bug #4156

Facter doesn't detect Openvz as a virtual

Added by Kai S almost 2 years ago. Updated almost 2 years ago.

Status:Closed Start date:07/07/2010
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:library
Target version:1.5.8
Keywords:virtual Affected Facter version:
Branch:ticket/master/4156-openvz
Votes: 0

Description

Since the release of openvz “Kiprensky” the openvz containers (VE) do not see a file in /proc/vz, and thus facter doesn’t see it:

ve$ ls \-alg /proc/vz
total 0
dr-xr-xr-x  3 root 0 2010-07-07 12:39 .
dr-xr-xr-x 26 root 0 2010-07-07 12:39 ..
dr-x------  8 root 0 2010-07-07 12:39 vzaquota

ve$ ls \-alg /proc/user_beancounters 
\-r-------- 1 root 0 2010-07-07 16:00 /proc/user_beancounters

ve$ facter | grep virtual
is_virtual => false
virtual => physical

OpenVZ’s commit that breaks facter is: commit 41c8d8e69e069a2893e39e4eec59079bfe57ef6e

[http://git.openvz.org/?p=linux-2.6.27-openvz;a=commit;h=41c8d8e69e069a2893e39e4eec59079bfe57ef6e] – de = proc_create(“veinfo”, S_IFREG | S_IRUSR, glob_proc_vz_dir, – &proc_veinfo_operations); … + de = proc_create(“veinfo”, S_IFREG | S_IRUSR, proc_vz_dir, + &proc_veinfo_operations);

The directory /proc/vz does exist though, which might be a better test to see if it is a VE or not.

kiprensky-facter.patch - an easy fix (357 Bytes) Kai S, 07/07/2010 02:24 pm

History

Updated by James Turnbull almost 2 years ago

  • Category set to library
  • Status changed from Unreviewed to Accepted
  • Target version set to 1.5.8

Updated by Michael Gisbers almost 2 years ago

Supposed patch by Kai S works on any openvz kernel from 2.6.18 upto 2.6.32 (others I cannot check).

Updated by Matthew Cluver almost 2 years ago

All the developers would have to do is put a file back in that directory to mess this up again though.

Wouldn’t this be safer?

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

Updated by Kai S almost 2 years ago

No, afaik only when they’d remove the /proc/vz directory from the global /proc would break it again.

To reiterate; My patch just tests on the existence of /proc/vz. The availability of the file /proc/vz/version will tell us its a HostNode (or hardwarenode). If it doesn’t, its a VE (Virtual Environment).

I’ve tried to talk to the developers of OpenVZ to get the docs for a definitive API in this bug: http://bugzilla.openvz.org/show_bug.cgi?id=157

File is present - host node
File is absent or present, but doesn't container 0th container - container
Is it OK?

I can’t fully understand engrish, but my patch was certainly inspired by it :)

Kai

Updated by Rein Henrichs almost 2 years ago

  • Status changed from Accepted to Needs Decision

Updated by Rein Henrichs almost 2 years ago

  • Status changed from Needs Decision to In Topic Branch Pending Review
  • Branch set to ticket/master/4156-facter-doesn-t-detect-openvz-as-a-virtual

The patch does not change the spec, causing it to break. I’ve published a branch on my github that applies the patch and fixes the failing spec by making it conform to the new behavior. Would someone be so kind as to test this out so we can update the ticket?

Updated by Rein Henrichs almost 2 years ago

  • Branch changed from ticket/master/4156-facter-doesn-t-detect-openvz-as-a-virtual to ticket/master/4156-openvz

Changing branch name

Updated by Matthew Cluver almost 2 years ago

Yeah that’s my biggest frustration as well, the API is only available with their paid product Virtuozzo, therefore leaving us completely hanging.

I missed the fact that you’re just checking for the existence of /proc/vz (as a directory) originally, though my host nodes and containers both contain that folder, so I’m not sure how that alone differentiates the two.

Regards,

Matt

Updated by Rein Henrichs almost 2 years ago

Can anyone test my branch to see if it works for them please?

Updated by Paul Nasrat almost 2 years ago

I see no branch

http://github.com/reinh/facter/branches

From git://github.com/reinh/facter
 * [new branch]      1.5.x      -> reinh/1.5.x
 * [new branch]      master     -> reinh/master
 * [new branch]      ticket/master/2330-uptime -> reinh/ticket/master/2330-uptime
 * [new branch]      ticket/master/4062-meego -> reinh/ticket/master/4062-meego
 * [new branch]      ticket/master/4453-rakefile -> reinh/ticket/master/4453-rakefile

Updated by Rein Henrichs almost 2 years ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release

Availble in the reductivelabs testing branch

Updated by Rein Henrichs almost 2 years ago

Ugh. Look again, the branch is now diamonds available.

Updated by Rein Henrichs almost 2 years ago

  • Status changed from Merged - Pending Release to Closed

Matthew Cluver reports this as working. Merged into next for later inclusion in master.

Updated by Rein Henrichs almost 2 years ago

  • Status changed from Closed to Ready For Checkin

Updated by Rein Henrichs almost 2 years ago

  • Status changed from Ready For Checkin to Closed
  • % Done changed from 0 to 100

Closing: merged into master and available in 1.5.8rc1.

Also available in: Atom PDF