It is nice talking to oneself, we make a smart and interesting
couple ;) (I do hope some experts would add to this thread)

Apparently, the "quick fix" in smf_netstrategy which just fully
removes the special handling for local zones is a flawed approach.
There are other scripts which seemingly expect local zones to have
$_INIT_NET_STRATEGY==none so this is a case for more careful

In particular, with the workaround in place, it seems that the
`zonename` or `uname -n` are no longer consulted to construct
the /etc/nodename file (or provide the value on the fly if the
file is absent/empty) to ultimately set the hostname, so the
zone came up as "unknown" on at least one test... For details
see /lib/svc/method/identity-node :)

Adding some code to the "dhcp" case seems to help (only the
first line was originally present):
# For non-global zones, fall back to the `uname -n` value provided by the
# kernel if /etc/nodename does not exist, as is expected on an initial boot.


        "dhcp") hostname=`/sbin/dhcpinfo Hostname`
                if [ -z "$hostname" ]; then
                        if smf_is_globalzone; then
hostname=`/sbin/hostconfig -h -p bootparams`
                fi ;;

Use of "uname -n" as proposed by the script's comments seems
pointless, but maybe that's because I'm testing after the name
"unknown" has got assigned during zone startup:

root@unknown:~# hostname
root@unknown:~# zonename
root@unknown:~# uname -n

An arguable bonus is to add these lines someplace there:
                [ ! -z "$hostname" -a ! -s /etc/nodename ] && \
                        echo "$hostname" > /etc/nodename &&
                        /usr/bin/chmod 644 /etc/nodename
If we discovered a "$hostname" and the "/etc/nodename" was
empty or nonexistent, seed that file with the name we found.
Q: Should this be done at all, and in the identity-node SMF
method script in particular?

On a side note, I found that `zonename -t` should return the
ip-type (shared or exclusive) which can help me make a more
"educated guess" crafting the workaround...

Good night,
//Jim Klimov

OpenIndiana-discuss mailing list

Reply via email to