config.xml Lustre configuration in xml format.
--get <url> URL to fetch a config file
--node <nodename> Load config for <nodename>
--d | --cleanup Cleans up config. (Shutdown)
+-d | --cleanup Cleans up config. (Shutdown)
-v | --verbose Print system commands as they are run
-h | --help Print this help
--gdb Prints message after creating gdb module script
config file is doing what it should be doing. (Implies -v)
--nomod Skip load/unload module step.
--nosetup Skip device setup/cleanup step.
---reformat Reformat all devices (without question)
+--reformat Reformat all devices (without question)
"""
TODO = """
---ldap server LDAP server with lustre config database
+--ldap server LDAP server with lustre config database
--makeldiff Translate xml source to LDIFF
This are perhaps not needed:
--lustre="src dir" Base directory of lustre sources. Used to search
return dev
-def get_local_address(net_type):
+def if2addr(iface):
+ """lookup IP address for an interface"""
+ rc, out = run("/sbin/ifconfig", iface)
+ if rc or not out:
+ return None
+ addr = string.split(out[1])[1]
+ ip = string.split(addr, ':')[1]
+ return ip
+
+def get_local_address(net_type, wildcard):
"""Return the local address for the network type."""
local = ""
if net_type == 'tcp':
- # host `hostname`
- host = socket.gethostname()
- local = socket.gethostbyname(host)
+ if ':' in wildcard:
+ iface, star = string.split(wildcard, ':')
+ local = if2addr(iface)
+ if not local:
+ panic ("unable to determine ip for:", wildcard)
+ else:
+ host = socket.gethostname()
+ local = socket.gethostbyname(host)
elif net_type == 'elan':
# awk '/NodeId/ { print $2 }' '/proc/elan/device0/position'
try:
def lookup_server(self, srv_uuid):
""" Lookup a server's network information """
net = get_ost_net(self.dom_node.parentNode, srv_uuid)
+ if not net:
+ panic ("Unable to find a server for:", srv_uuid)
self._server = Network(net)
def get_server(self):
self.port = get_text_int(dom_node, 'port', 0)
self.send_mem = get_text_int(dom_node, 'send_mem', DEFAULT_TCPBUF)
self.recv_mem = get_text_int(dom_node, 'recv_mem', DEFAULT_TCPBUF)
- if self.nid == '*':
- self.nid = get_local_address(self.net_type)
+ if '*' in self.nid:
+ self.nid = get_local_address(self.net_type, self.nid)
if not self.nid:
- panic("unable to set nid for", self.net_type)
+ panic("unable to set nid for", self.net_type, self.nid)
+ debug("nid:", self.nid)
self.add_module('portals/linux/oslib/', 'portals')
- if node_needs_router():
- self.add_module('portals/linux/router', 'kptlrouter')
+ if node_needs_router():
+ self.add_module('portals/linux/router', 'kptlrouter')
if self.net_type == 'tcp':
self.add_module('portals/linux/socknal', 'ksocknal')
if self.net_type == 'elan':
def prepare(self):
self.info(self.net_type, self.nid, self.port)
if self.net_type == 'tcp':
- ret = run_daemon(TCP_ACCEPTOR, '-s', self.send_mem, '-r', self.recv_mem, self.port)
+ ret, out = run(TCP_ACCEPTOR, '-s', self.send_mem, '-r', self.recv_mem, self.port)
if ret:
- raise CommandError(TCP_ACCEPTOR, 'failed', ret)
+ raise CommandError(TCP_ACCEPTOR, out, ret)
ret = self.dom_node.getElementsByTagName('route_tbl')
for a in ret:
for r in a.getElementsByTagName('route'):
if not srv:
panic("no server for nid", lo)
else:
- try:
+ try:
lctl.disconnect(srv.net_type, srv.nid, srv.port, srv.uuid)
- except CommandError, e:
- print "disconnect failed: ", self.name
- e.dump()
- try:
+ except CommandError, e:
+ print "disconnect failed: ", self.name
+ e.dump()
+ try:
lctl.del_route(self.net_type, self.nid, lo, hi)
- except CommandError, e:
+ except CommandError, e:
print "del_route failed: ", self.name
e.dump()
self.stripe_off = get_attr_int(dev_node, 'stripeoffset', 0)
self.pattern = get_attr_int(dev_node, 'pattern', 0)
self.devlist = get_all_refs(dev_node, 'osc')
- self.stripe_cnt = len(self.devlist)
+ self.stripe_cnt = get_attr_int(dev_node, 'stripecount', len(self.devlist))
self.add_module('lustre/mdc', 'mdc')
self.add_module('lustre/lov', 'lov')
else:
panic('osc not found:', osc_uuid)
mdc_uuid = prepare_mdc(self.dom_node.parentNode, self.mds_uuid)
- self.info(self.mds_uuid, self.stripe_cnt, self.stripe_sz, self.stripe_off, self.pattern,
- self.devlist, self.mds_name)
+ self.info(self.mds_uuid, self.stripe_cnt, self.stripe_sz,
+ self.stripe_off, self.pattern, self.devlist, self.mds_name)
lctl.newdev(attach="lov %s %s" % (self.name, self.uuid),
setup ="%s" % (mdc_uuid))
list = lustre.getElementsByTagName('node')
for node in list:
if get_attr(node, 'router'):
- router_flag = 1
+ router_flag = 1
for (local_type, local_nid) in local_node:
gw = None
netlist = node.getElementsByTagName('network')
init_node(dom_node)
init_route_config(lustreNode)
else:
- global router_flag
- router_flag = 1
+ global router_flag
+ router_flag = 1
# Two step process: (1) load modules, (2) setup lustre
# if not cleaning, load modules first.