2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2024-11-23 18:10:14 +00:00
8 Predict_long_nicname_for_RH7
Weihua Hu edited this page 2015-11-24 16:59:38 +08:00

The minidesign of providing a command to generate the predict nicname for RHEL7

Background

Traditionally, network interfaces in Linux are enumerated as eth[0123…], but these names do not necessarily correspond to actual labels on the chassis. customer need a methods to get consistent and predictable network device name before provision or network configuration.

xCAT plans to provide a tool or solution to help customer to get a consistent and predictable network device name before provision or network configuration.

Limitation

  • Up to now, we just know RHELs 7 support this technology, we are not sure it could be used for SLES and Ubunut, we do it for rhels7 first and keep investigation for the rest platforms.

  • Due to using genesis, so when using getadapters command, it will result in target node reboot.

Planning Outputs

  1. User interface:

1). getadapters --> a new xcat command coded by perl

    usage :  getadapters <noderange> [-f]
    -h   Display usage message.
    -f   Force to rerun the whole network adapter's information scanning process, 
         not get information from DB already existed.

    Output :

    node1:1:hitname=enp6s0f0|mac=3440b5b95c9e|pci=/pci0000:00/0000:00:1c.0/0000:06:00.0|candidatename=eno1,enp6s0f0,enx3440b5b95c9e

    node1:2:hitname=enp6s0f1|mac=3440b5b98b58|pci=/pci0000:00/0000:00:1c.0/0000:06:00.1|candidatename=enp6s0f1,enx3440b5b98b58

    node1:3:hitname=enp0s26u1u5u5|mac=3640b5b95ca3|pci=/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5.5/1-1.5.5:1.0|candidatename=enp0s26u1u5u5,enx3640b5b95ca3

    node1:4:pci=20:00.0|modle=Mellanox Technologies MT27500 Family

    node2:1:mac=112233445566|pci=/pci0000:00/0000:00:1c.0/0000:06:00.0|candidatename=eno1,enp6s0f0,enx112233445566

    ........

**[Note]** 

a). getadapters will create one entry for each adapter of each node

b). Every entry starts at node name, following by a index. if a node have 4 network adapters, the index will be 1-4

c). each entry will contain such information

hitname: the consistent name which can be used by confignic directly in operating system which follow the same naming scheme with rhels7

mac: the mac address info

pci: the pci location info

candidatename: all predictable names calculated by redhat depending on each scheme. customer can use any name in this predictable name list to config their network, but one thing need to be mentioned, xCAT won't change the nic name in final running operating system. for example, like the first line of above sample output, one nic of node1 has 3 predictable names, they are eno1,enp6s0f0,enx3440b5b95c9e. you can use enp6s0f0 as attribute of 'confignic' to set ip addr. xCAT will assign the ip to the correct physical adapter, but won't set name enp6s0f0 as this adapter's final name. that means after setting ip address, this adapter maybe still be named eno1 by redhat. maybe one day xcat support customizing nic name, but now. so xCAT recommends to use the hitname.

vender: the vender of network device

model: the modle of network device

  1. Invisible files for user but need to implement:

1). getadapter.sh --> a new shell script located in genesis. used to scan network adapter's information

2). findadapter --> a new command issued by getadapter.sh to xcatd. this is a new command and can be handled by xcatd as common command. but this command is invisible for user.

3). getadapter.pm --> a new xcat plugin file. used to handle getadapters and findadapter commands.

4). adapters.info --> text files located under /var/lib/xcat/. used to save network adapters information.

Code Logic and Process

getadapter.sh can be triggered by discovery process ahead. if it did, adapters<nodename>.info existed before below steps

getadapters.pl

  1. collect and format user input then send to xcatd
  2. wait xcatd's response
  3. parse response and format output to STDOUT

getadapter.sh

  1. collect all network adapters information by udevadm
  2. format a findadapter command message (XML format) which include all network adapters information
  3. send findadapter to xcatd

getadapter.pm

  1. handle getadapters command from CLI
 1). check if there is ``-f`` option, if yes to step 4, if no to step 2.

 2). check if there already was a ``/var/lib/xcat/adapters<nodename>.info``, if yes to step 3, if no to step 5.

 3). read out the information from ``/var/lib/xcat/adapters<nodename>.info``, format a successful response include the network information. then skip to 8.

 4). mv ``/var/lib/xcat/adapters<nodename>.info`` to ``/var/lib/xcat/adapters<nodename>.bak`` if ``/var/lib/xcat/adapters<nodename>.info``existed.

 5). issue ``nodeset noderange runcmd="getadapter"`` to xcatd

 6). check if all ``/var/lib/xcat/adapters<nodename>.info`` shows up in loop? if true, break to step 7. if false, sleep a while and check again. if 20 minutes later, there are ``/var/lib/xcat/adapters<nodename>.info`` still doesn't show up. mv these missed ``/var/lib/xcat/adapters<nodename>.bak`` back to ``/var/lib/xcat/adapters<nodename>.info``, then format a error response include network info already collected then skip to 8.

 7). read ``/var/lib/xcat/adapters<nodename>.info``, format a successful response include the latest network info.

 8). send response to xcatd.
  1. handle findadapter command from getadapter.sh
 1). parse request 

 2). extract all network adapters information then save these to ``/var/lib/xcat/adapters<nodename>.info``

Rhels 7 provides methods to calculate consistent network device name. udevadm can read out all candidate name of a specific adapter. these names include very useful information, such like adapter's mac, physical address(bus+slot...). xCAT can leverage these information to give a map to customer, let customer know a specific adapter's all predictable name, mac and physical address info ::

[root@c910f04x35 ~]# ls /sys/class/net/
eno1  enp0s26u1u5u5  enp6s0f1  ib0  ib1  lo

[root@c910f04x35 ~]# udevadm info /sys/class/net/eno1 | grep ID_NET_NAME
E: ID_NET_NAME_MAC=enx3440b5b95c9e
E: ID_NET_NAME_ONBOARD=eno1
E: ID_NET_NAME_PATH=enp6s0f0

[root@c910f04x35 ~]# udevadm info /sys/class/net/enp0s26u1u5u5 | grep ID_NET_NAME
E: ID_NET_NAME_MAC=enx3640b5b95ca3
E: ID_NET_NAME_PATH=enp0s26u1u5u5