Naming of Virtual Machines
(This feature is currently provided on the cvs version)
User perspective
Umview suite provides a new command vuname. vuname(1) is an extension of uname including three more fields:
- serverid: the pid of the umview process.
- viewid: the number of subview managed by the same server.
- viewname: the name of this view (when defined by viewname(1) or with umview option -V).
vuname behaves as uname when run outside an umview machine.
$ vuname -a Linux myhostname 2.6.22-viewos #4 SMP Mon Jul 23 11:14:06 CEST 2007 i686 GNU/Linux/View-OS 2123 0 $ viewname virtuous $ vuname -a Linux myhostname 2.6.22-viewos #4 SMP Mon Jul 23 11:14:06 CEST 2007 i686 GNU/Linux/View-OS 2123 0 virtuous
viewname(1) provides also an id for the view for the shell prompt. For example, this .bashrc file provides a prompt with an id for the umview machine (and just the hostname when a bash run outside umview).
$ cat ~/.bashrc .... if [ -x /usr/local/bin/viewname ]; then viewname=$(/usr/local/bin/viewname -pq) fi if [ "$viewname" == "" ]; then viewname=$(/bin/hostname) fi PS1='${debian_chroot:+($debian_chroot)}\u@$viewname:\w\$ ....
With this definition the prompt for a process running outside the virtual machine is:
username@myhostname:~$
Starting a virtual machine without the -V option:
username@myhostname[2123:0]:~$
And with the -V virtuous option:
username@virtuous:~$
Using these commands it is possible to have a feedback about which view a process runs into. They are like a compass to avoid to get lost in the view space.
Programmer Perspective
The libumlib library provides the following call:
int um_view_getinfo(struct viewinfo *info);
where struct viewinfo is an extension of struct utsname provided by uname(1).
struct viewinfo { struct utsname uname; pid_t serverid; viewid_t viewid; char viewname[_UTSNAME_LENGTH]; };
The pair of values serverid/viewid can be used as unique id of a view (running on the same host).