Map Host Names
In several points in the systems, it is useful to get the host name for a checkout, for a job, for a daemon, etc. Since every machine may be known by different names, it is important to provide the expert user with the ability to map host names to some canonical form of the host name.
# Default definition of mapHostName in vovutils.tcl
proc mapHostName { host { defaultName "" } { context "" } } {
set shortHost [ string tolower [ lindex [split $host .] 0 ] ]
return $shortHost
}
mapHostNameInit <context>
Where context
is an optional parameter to specify any string that
sets the context of the host mapping calls. If no context is provided, it defaults
to an empty string.
Further, a context
can also be specified as an argument to
mapHostName procedure.
# Example of hostmap.tcl
proc mapHostName { host { defaultName "" } { context "" } } {
global vovutils
switch -glob -- $host {
"lnxBG*" { return [string tolower $host] }
"lnx*.company.com" { return [lindex [split $host .] 0] }
"localhost" {
if { $vovutils(hostmap,context) eq "LM" } {
return $defaultName
} elseif { $context eq "NC-USA" } {
return "mynchostname"
}
}
default { return $host }
}
}
- vovlalm: Used to sample Monitor data from Allocator. This script provides the nickname of the Monitor instance as the context on mapHostNameInit, and also uses the Monitor instance's nickname as the context in the call to mapHostName.
- vovlavtkncget (called by vovlanc):
Used to sample Altair Accelerator data from Allocator. This script provides the nickname of the Accelerator site as the
context
on mapHostNameInit, and also uses the Accelerator instance's nickname as the context in the call to mapHostName.
Monitor includes the procedure LMnormalizedName, which is used to eliminate non-ASCII characters from user names, host names, and feature names.