<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 "EnvID: 0" but there is no more "EnvID" 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'm using the following code to see if I am in an openvz instance:<br>-----<br>tail -n 1 /proc/vz/veinfo | grep -qs '^[[:space:]]*[1-9]'<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"><<a href="mailto:mstanichenko@parallels.com">mstanichenko@parallels.com</a>></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 '$1 == "envID:" {if ($2 != 0) {print("ve")} else {print("hn")}}'<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'm looking for a way to reliably tell (thru shell) wether I'm on a<br>
pure hardware_node, openvz_host or inside an instance. I'd like to not<br>
rely on any tools from packages, I'd rather use information from /proc<br>
or /sys.<br>
<br>
So far I came up with a very simple test, I'm pretty sure it's<br>
somewhere in the manual but I'm just to blind to find that.<br>
<br>
--snip--<br>
if [ -f /proc/user_beancounters ]; then<br>
grep -E '^[[:blank:]]+0:' /proc/user_beancounters 2>/dev/null;<br>
if [ $? -eq 0 ]; then<br>
echo "openvz_host";<br>
else<br>
echo "openvz_instance";<br>
fi;<br>
else<br>
echo "hardware_node";<br>
fi<br>
--snap--<br>
<br>
thanks martin<br>
<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>