Whamcloud - gitweb
LU-11860 lnet: support config of LNDs with numeric intf name 28/34028/3
authorGregoire Pichon <gregoire.pichon@bull.net>
Mon, 14 Jan 2019 19:52:58 +0000 (20:52 +0100)
committerOleg Drokin <green@whamcloud.com>
Fri, 15 Mar 2019 23:46:15 +0000 (23:46 +0000)
This patch adds support for the net configuration of LNDs that
have numeric interface name (PTL4LND, GNILND). The GNILND case has
already been treated with a specific fix (see patch a29eb587).

Signed-off-by: Gregoire Pichon <gregoire.pichon@bull.net>
Change-Id: I10556f9c78ec332bca3344990e509434f904ffc0
Reviewed-on: https://review.whamcloud.com/34028
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Chris Horn <hornc@cray.com>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/utils/lnetconfig/liblnetconfig.c

index a0db4ae..29a5283 100644 (file)
@@ -1397,6 +1397,8 @@ static int lustre_lnet_intf2nids(struct lnet_dlc_network_descr *nw,
        char val[LNET_MAX_STR_LEN];
        __u32 ip;
        int gni_num;
+       char *endp;
+       unsigned int num;
 
 
        if (nw == NULL || nids == NULL) {
@@ -1443,15 +1445,32 @@ static int lustre_lnet_intf2nids(struct lnet_dlc_network_descr *nw,
 
        /* look at the other interfaces */
        list_for_each_entry(intf, &nw->nw_intflist, intf_on_network) {
-               rc = lustre_lnet_queryip(intf, &ip);
-               if (rc != LUSTRE_CFG_RC_NO_ERR) {
-                       snprintf(err_str, str_len,
-                                "\"couldn't query intf %s\"", intf->intf_name);
-                       err_str[str_len - 1] = '\0';
-                       goto failed;
+               if (LNET_NETTYP(nw->nw_id) == PTL4LND) {
+                       /* handle LNDs with numeric interface name */
+                       num = strtoul(intf->intf_name, &endp, 0);
+                       if (endp == intf->intf_name || *endp != '\0') {
+                               rc = LUSTRE_CFG_RC_BAD_PARAM;
+                               snprintf(err_str, str_len,
+                                        "\"couldn't query intf %s\"",
+                                        intf->intf_name);
+                               err_str[str_len - 1] = '\0';
+                               goto failed;
+                       }
+                       (*nids)[i] = LNET_MKNID(nw->nw_id, num);
+                       i++;
+               } else {
+                       /* handle LNDs with ip interface name */
+                       rc = lustre_lnet_queryip(intf, &ip);
+                       if (rc != LUSTRE_CFG_RC_NO_ERR) {
+                               snprintf(err_str, str_len,
+                                        "\"couldn't query intf %s\"",
+                                        intf->intf_name);
+                               err_str[str_len - 1] = '\0';
+                               goto failed;
+                       }
+                       (*nids)[i] = LNET_MKNID(nw->nw_id, ip);
+                       i++;
                }
-               (*nids)[i] = LNET_MKNID(nw->nw_id, ip);
-               i++;
        }
 
 out: