<div dir="ltr">Hello,<br><br>Parsing the /proc/self/status does not work with 2.6.24-ovz005 kernel. In fact the openvz_host still shows the &quot;EnvID: 0&quot; but there is no more &quot;EnvID&quot; into the vz instances. I reported it as a bug here: <a href="http://bugzilla.openvz.org/show_bug.cgi?id=936">http://bugzilla.openvz.org/show_bug.cgi?id=936</a> but with no more informations since.<br>
<br>I&#39;m using the following code to see if I am in an openvz instance:<br>-----<br>tail -n 1 /proc/vz/veinfo | grep -qs &#39;^[[:space:]]*[1-9]&#39;<br>-----<br><br>I use it because openvz instances can not acces hardware where openvz hosts and pure hardware nodes can.<br>
<br>Jerome<br><br><br><div class="gmail_quote">On Mon, Jul 28, 2008 at 5:50 PM, Stanichenko Marat <span dir="ltr">&lt;<a href="mailto:mstanichenko@parallels.com">mstanichenko@parallels.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
this is also not very complicated<br>
<br>
--------------<br>
cat /proc/self/status | awk &#39;$1 == &quot;envID:&quot; {if ($2 != 0) {print(&quot;ve&quot;)} else {print(&quot;hn&quot;)}}&#39;<br>
--------------<br>
<br>
Stanichenko Marat<br>
<br>
Martin пишет:<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
I&#39;m looking for a way to reliably tell (thru shell) wether I&#39;m on a<br>
pure hardware_node, openvz_host or inside an instance. I&#39;d like to not<br>
rely on any tools from packages, I&#39;d rather use information from /proc<br>
or /sys.<br>
<br>
So far I came up with a very simple test, I&#39;m pretty sure it&#39;s<br>
somewhere in the manual but I&#39;m just to blind to find that.<br>
<br>
--snip--<br>
if [ -f /proc/user_beancounters ]; then<br>
 &nbsp;grep -E &#39;^[[:blank:]]+0:&#39; /proc/user_beancounters 2&gt;/dev/null;<br>
 &nbsp;if [ $? -eq 0 ]; then<br>
 &nbsp; &nbsp;echo &quot;openvz_host&quot;;<br>
 &nbsp;else<br>
 &nbsp; &nbsp;echo &quot;openvz_instance&quot;;<br>
 &nbsp;fi;<br>
else<br>
 &nbsp;echo &quot;hardware_node&quot;;<br>
fi<br>
--snap--<br>
<br>
thanks martin<br>
 &nbsp;<br>
</blockquote></div><div><div></div><div class="Wj3C7c">
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openvz.org" target="_blank">Users@openvz.org</a><br>
<a href="https://openvz.org/mailman/listinfo/users" target="_blank">https://openvz.org/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div>