[Users] Re: finding out the HN name from inside the VC

Aleksandar Ivanisevic aleksandar at ivanisevic.de
Mon Mar 1 09:23:11 EST 2010


Philipp Wehrheim <flipstar at gmx.net> writes:

> Hey,
>
> Aleksandar Ivanisevic schrieb:
>> 
>> Is there a more elegant way of finding the host name or anything about
>> the host node from inside the container than scripting something in
>> /etc/vz/conf/vps.mount ?
>
> if you are only searching for the hostname you could use
>
>  cat /proc/sys/kernel/virt_osrelease | sed "s,openvz,$(uname -n),g" >/proc/sys/kernel/virt_osrelease
>
> and
>
>  cat /proc/sys/kernel/virt_osrelease

I'm using RHEL/Centos kernel so my osrelease looks like 

$ cat /proc/sys/kernel/virt_osrelease
2.6.18-164.11.1.el5.028stab068.3

so your sed doesn't really work, but the general idea is also neat,
although I'm not really sure what side efects can messing with uname
-r have. I guess glibc and others only check the main version so I can
write anythin in there as long as it starts with 2.6.18-, right?



More information about the Users mailing list