xcat2 / xcat-core

Code repo for xCAT core packages
Eclipse Public License 1.0
368 stars 172 forks source link

Defining a host with bonding - makehosts doesn't create the hosts aliases #6828

Open MauvaisJoueur opened 4 years ago

MauvaisJoueur commented 4 years ago

Hi,

Reference

I do have a similar problem to https://github.com/xcat2/xcat-core/issues/3676

Issue

My problem is makehosts doesn't work as expected: it doesn't add hosts aliases specified in hosts.hostnames field. I need to setup aliases because deployment interface is a bond interface. This is described/explained in the mac table documentation:

If there are multiple nics connected to Management Network(usually for bond), in order to make sure the OS deployment finished successfully, the macs of those nics must be able to resolve to same IP address. First, users have to create alias of the node for each mac in the Management Network through either: 1. adding the alias into /etc/hosts for the node directly or: 2. setting the alias to the “hostnames” attribute and then run “makehost” against the node. Then, configure the “mac” attribute of the node like “mac1!node|mac2!node-alias”. For the first mac address (mac1 in the example) set in “mac” attribute, do not need to set a “node name” string for it since the nodename of the node will be used for it by default.

Single hostname

Here is the hosts table:

#node,ip,hostnames,otherinterfaces,comments,disable
"compute","|10.10.10.($1+0)|","/\z/-toto/",,,

It works in the sense that hostnames field is correctly set:

lsdef -t node -l node01
Object name: node01
    arch=x86_64
    bmc=node1-ipmi
    cons=ipmi
    currchain=boot
    currstate=install centos8.1-x86_64-compute
    groups=all,compute
    hostnames=node01-toto
    [...]

but makehosts doesn't generate the alias node01-toto :(

Notice that nics.nicaliases is empty.

Several hostnames

Here, even the node definition is broken, whether I use a space or a comma to separate hostnames, as described in the hosts documentation:

Hostname aliases added to /etc/hosts for this node. Comma or blank separated list.

lsdef -t node -l node01
Object name: node01
    arch=x86_64
    bmc=node1-ipmi
    cons=ipmi
    currchain=boot
    currstate=install centos8.1-x86_64-compute
    groups=all,compute
    hostnames=/\z/-toto/ /\z/-tata/

Or hostnames=/\z/-toto/ /\z/-tata/

Workaround

Only solution I've found is to run a sed command that rewrites the /etc/hosts file.

xCAT version

The fix to the referenced issue was to upgrade xCAT, but in my case this already is the latest version that runs.

lsxcatd -v
Version 2.16 (git commit 7fc773bd8e82ff9270bd7832558422dd17e23e66, built Tue Jun 16 16:07:25 EDT 2020)

Best regards

cxhong commented 4 years ago

node01-toto will be in the /etc/hosts after ran makehosts command

# lsdef node01
Object name: node01
    groups=compute_group
    hostnames=node01-toto
    ip=10.0.0.1
    postbootscripts=otherpkgs
    postscripts=syslog,remoteshell,syncfiles
    switchport=1
[root@boston02 ~]# makehosts node01
[root@boston02 ~]# grep node01 /etc/hosts
10.0.0.1 node01 node01.pok.stglabs.ibm.com node01-toto

The nic table is empty because the node definition doesn't have any nic attributes you can try to add those to node attributes

nicaliases.bond0=node01-toto-bond
    nicips.bond0=10.0.0.1
    nicnetworks.bond0=10_0_0_0-255_0_0_0
    nictypes.bond0=bond
[root@boston02 ~]# makehosts node01
[root@boston02 ~]# grep node01 /etc/hosts
10.0.0.1 node01 node01.pok.stglabs.ibm.com node01-toto-bond
MauvaisJoueur commented 4 years ago

Hi,

Thank you for helping me out.

Sorry I'm not sure to understand.

node01-toto will be in the /etc/hosts after ran makehosts command

Yes it is in my case, as long as I add a single hostname in hosts.hostname

The nic table is empty because the node definition doesn't have any nic attributes you can try to add those to node attributes

nicaliases.bond0=node01-toto-bond
    nicips.bond0=10.0.0.1
    nicnetworks.bond0=10_0_0_0-255_0_0_0
    nictypes.bond0=bond

Documentation says that the nics.nicaliases field should be left empty. Also, I wanna add aliases for the bond members, once again according to the documentation, not to the bond itself. This to be able to deploy the node using any member of the bond interface.

Best regards