Commit b82f21e7 authored by David Johnson's avatar David Johnson

Bugfix: parse the manifest for all vname/ip pairs instead of topomap.

The old topomap way presumably only worked because I likely always
tested multi-site with only one site 2 compute node, and that node
always appears in topomap at both clusters :).  Of course we fall
back to tmcc topomap if there's any kind of failure parsing the
manifest.
parent fbb68179
#!/usr/bin/env python2
import sys
import lxml.etree
iface_link_map = {}
link_members = {}
node_ifaces = {}
link_netmasks = {}
allifaces = {}
f = open(sys.argv[1],'r')
contents = f.read()
f.close()
root = lxml.etree.fromstring(contents)
# Find all the links:
for elm in root.getchildren():
if not elm.tag.endswith("}link"):
continue
name = elm.get("client_id")
ifacerefs = []
for elm2 in elm.getchildren():
if not elm2.tag.endswith("}interface_ref"):
continue
ifacename = elm2.get("client_id")
ifacerefs.append(ifacename)
iface_link_map[ifacename] = name
link_members[name] = ifacerefs
# Find all the node interfaces
for elm in root.getchildren():
if not elm.tag.endswith("}node"):
continue
name = elm.get("client_id")
ifaces = {}
for elm2 in elm.getchildren():
if not elm2.tag.endswith("}interface"):
continue
ifacename = elm2.get("client_id")
for elm3 in elm2.getchildren():
if not elm3.tag.endswith("}ip"):
continue
if not elm3.get("type") == 'ipv4':
continue
addrtuple = (elm3.get("address"),elm3.get("netmask"))
ifaces[ifacename] = addrtuple
allifaces[ifacename] = addrtuple
break
node_ifaces[name] = ifaces
# Dump the nodes a la topomap
print "# nodes: vname,links"
for n in node_ifaces.keys():
for (i,(addr,mask)) in node_ifaces[n].iteritems():
print "%s,%s:%s" % (n,iface_link_map[i],addr)
# Dump the links a la topomap -- but with fixed cost of 1
print "# lans: vname,mask,cost"
for m in link_members.keys():
ifref = link_members[m][0]
(ip,mask) = allifaces[ifref]
print "%s,%s,1" % (m,mask)
sys.exit(0)
......@@ -388,7 +388,16 @@ if [ ! -f $TOPOMAP -o $UPDATING -ne 0 ]; then
if [ -f $TOPOMAP ]; then
cp -p $TOPOMAP $TOPOMAP.old
fi
$TMCC topomap | gunzip > $TOPOMAP
# First try via manifest; fall back to tmcc if necessary (although
# that will break multisite exps with >1 second cluster node(s)).
python2 $DIRNAME/manifest-to-topomap.py $OURDIR/manifests.0.xml > $TOPOMAP
if [ ! $? -eq 0 ]; then
echo "ERROR: could not extract topomap from manifest; aborting to tmcc"
rm -f $TOPOMAP
$TMCC topomap | gunzip > $TOPOMAP
fi
# Filter out blockstore nodes
cat $TOPOMAP | grep -v '^bsnode,' > $TOPOMAP.no.bsnode
mv $TOPOMAP.no.bsnode $TOPOMAP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment