From df2bc70935de5211ab4f54c38fc5335c0d467dd0 Mon Sep 17 00:00:00 2001
From: rread <rread>
Date: Fri, 30 Aug 2002 17:19:48 +0000
Subject: [PATCH] * allow any host to have static routes

---
 lustre/utils/lconf | 15 +++++++++------
 lustre/utils/lmc   | 19 ++++++++++---------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/lustre/utils/lconf b/lustre/utils/lconf
index 702a37dc6c..200ba19083 100755
--- a/lustre/utils/lconf
+++ b/lustre/utils/lconf
@@ -677,9 +677,11 @@ class Network(Module):
         ret = self.dom_node.getElementsByTagName('route_tbl')
         for a in ret:
             for r in a.getElementsByTagName('route'):
+                net_type = get_attr(r, 'net_type')
+                gw = get_attr(r, 'gw')
                 lo = get_attr(r, 'lo')
                 hi = get_attr(r,'hi', '')
-                lctl.add_route(self.net_type, self.nid, lo, hi)
+                lctl.add_route(net_type, gw, lo, hi)
                 if self.net_type == 'tcp' and hi == '':
                     srv = nid2server(self.dom_node.parentNode.parentNode, lo)
                     if not srv:
@@ -1087,11 +1089,12 @@ def get_routes(type, gw, dom_net):
         [(type, gw, lo, hi),]"""
     res = []
     tbl = dom_net.getElementsByTagName('route_tbl')
-    routes = tbl[0].getElementsByTagName('route')
-    for r in routes:
-        lo = get_attr(r, 'lo')
-        hi = get_attr(r, 'hi', '')
-        res.append((type, gw, lo, hi))
+    for t in tbl:
+        routes = t.getElementsByTagName('route')
+        for r in routes:
+            lo = get_attr(r, 'lo')
+            hi = get_attr(r, 'hi', '')
+            res.append((type, gw, lo, hi))
     return res
     
 
diff --git a/lustre/utils/lmc b/lustre/utils/lmc
index 631dbbe295..64931b7b94 100755
--- a/lustre/utils/lmc
+++ b/lustre/utils/lmc
@@ -210,9 +210,11 @@ class GenConfig:
             
         return network
 
-    def route(self, lo, hi):
+    def route(self, net_type, gw, lo, hi):
         """ create one entry for the route table """
         ref = self.doc.createElement('route')
+        ref.setAttribute("type", net_type)
+        ref.setAttribute("gw", gw)
         ref.setAttribute("lo", lo)
         if hi:
             ref.setAttribute("hi", hi)
@@ -460,14 +462,13 @@ def add_route(gen, lustre, options, args):
         error (node_name, " not found.")
     
     netlist = node.getElementsByTagName('network')
-    for net in netlist:
-        if get_attr(net, 'type') == net_type:
-            rlist = net.getElementsByTagName('route_tbl')
-            if len(rlist) > 0:
-                rtbl = rlist[0]
-            else:
-                rtbl = gen.addElement(net, 'route_tbl')
-            rtbl.appendChild(gen.route(lo, hi))
+    net = netlist[0]
+    rlist = net.getElementsByTagName('route_tbl')
+    if len(rlist) > 0:
+        rtbl = rlist[0]
+    else:
+        rtbl = gen.addElement(net, 'route_tbl')
+    rtbl.appendChild(gen.route(net_type, gw, lo, hi))
 
 
 def add_mds(gen, lustre, options, args):
-- 
GitLab