"""
-import sys, os, getopt, string, exceptions
+import sys, os, getopt, string, exceptions, random
import xml.dom.minidom
from xml.dom.ext import PrettyPrint
--upcall path
--lustre_upcall path
--portals_upcall path
+ --ptldebug debug_level
+ --subsystem subsystem_name
--add net
--node node_name
--nid nid
--cluster_id
- --nettype tcp|elan|toe|gm|scimac
+ --nettype tcp|elan|gm|scimac
--hostaddr addr
--port port
--tcpbuf size
--irq_affinity 0|1
- --nid_exchange 0|1
--router
--add mds
--fstype extN|ext3
--size size
--nspath
+ --journal_size size
--add lov
--lov lov_name
--stripe_cnt num
--stripe_pattern num
--add ost
+--add ost
--node node_name
--ost ost_name
--lov lov_name
--dev path
--size size
--fstype extN|ext3
+ --journal_size size
+ --obdtype obdecho|obdfilter
--ostuuid uuid
- --nspath
-
+
--add mtpt - Mountpoint
--node node_name
--path /mnt/point
--mds mds_name
--ost ost_name OR --lov lov_name
+--add route
+ --node nodename
+ --gw nid
+ --tgt nid
+ --lo nid
+ --hi nid
+
+--add echo_client
+ --node nodename
+
--add mgmt - Management/monitoring service
--node node_name
--mgmt mgmt_service_name
('upcall', "Set both lustre and portals upcall scripts.", PARAM),
('lustre_upcall', "Set location of lustre upcall script.", PARAM),
('portals_upcall', "Set location of portals upcall script.", PARAM),
+ ('ptldebug', "Set the portals debug level", PARAM),
+ ('subsystem', "Specify which Lustre subsystems have debug output recorded in the log", PARAM),
# network
('nettype', "Specify the network type. This can be tcp/elan/gm/scimac.", PARAM),
('nid', "Give the network ID, e.g ElanID/IP Address as used by portals.", PARAM),
('tcpbuf', "Optional argument to specify the TCP buffer size.", PARAM, "0"),
('port', "Optional argument to specify the TCP port number.", PARAM, DEFAULT_PORT),
- ('nid_exchange', "Optional argument to indicate if nid exchange should be done.", PARAM, 0),
('irq_affinity', "Optional argument.", PARAM, 0),
('hostaddr', "", PARAM,""),
('cluster_id', "Specify the cluster ID", PARAM, "0"),
('route', "Add a new route for the cluster.", PARAM),
('router', "Optional flag to mark a node as router."),
('gw', "Specify the nid of the gateway for a route.", PARAM),
- ('gw_cluster_id', "", PARAM, "0"),
+ ('gateway_cluster_id', "", PARAM, "0"),
('target_cluster_id', "", PARAM, "0"),
('lo', "For a range route, this is the low value nid.", PARAM),
('hi', "For a range route, this is a hi value nid.", PARAM,""),
('size', "Specify the size of the device if needed.", PARAM,"0"),
('journal_size', "Specify new journal size for underlying ext3 file system.", PARAM,"0"),
('fstype', "Optional argument to specify the filesystem type.", PARAM, "ext3"),
+ ('mkfsoptions', "Optional argument to mkfs.", PARAM, ""),
('ostuuid', "", PARAM,""),
('nspath', "Local mount point of server namespace.", PARAM,""),
('format', ""),
return ret
def new_uuid(name):
- return "%s_UUID" % (name)
+ ret_uuid = '%05x_%.19s_%05x%05x' % (int(random.random() * 1048576),
+ name,
+ int(random.random() * 1048576),
+ int(random.random() * 1048576))
+ return ret_uuid[:36]
ldlm_name = 'ldlm'
ldlm_uuid = 'ldlm_UUID'
return new
def network(self, name, uuid, nid, cluster_id, net, hostaddr="",
- port=0, tcpbuf=0, irq_aff=0, nid_xchg=0):
+ port=0, tcpbuf=0, irq_aff=0):
"""create <network> node"""
network = self.newService("network", name, uuid)
network.setAttribute("nettype", net);
self.addElement(network, "recvmem", "%d" %(tcpbuf))
if irq_aff:
self.addElement(network, "irqaffinity", "%d" %(irq_aff))
- if nid_xchg:
- self.addElement(network, "nidexchange", "%d" %(nid_xchg))
return network
return mds
def mdsdev(self, name, uuid, fs, devname, format, node_uuid,
- mds_uuid, dev_size=0, journal_size=0, nspath=""):
+ mds_uuid, dev_size=0, journal_size=0, nspath="", mkfsoptions=""):
mdd = self.newService("mdsdev", name, uuid)
self.addElement(mdd, "fstype", fs)
dev = self.addElement(mdd, "devpath", devname)
self.addElement(mdd, "journalsize", "%s" % (journal_size))
if nspath:
self.addElement(mdd, "nspath", nspath)
+ if mkfsoptions:
+ self.addElement(mdd, "mkfsoptions", mkfsoptions)
mdd.appendChild(self.ref("node", node_uuid))
mdd.appendChild(self.ref("target", mds_uuid))
return mdd
gen.addElement(node, 'portalsUpcall', options.portals_upcall)
else:
gen.addElement(node, 'portalsUpcall', default_upcall)
+ if options.ptldebug:
+ gen.addElement(node, "ptldebug", get_option(options, 'ptldebug'))
+ if options.subsystem:
+ gen.addElement(node, "subsystem", get_option(options, 'subsystem'))
return node
def do_add_node(gen, lustre, options, node_name):
hostaddr = get_option(options, 'hostaddr')
net_type = get_option(options, 'nettype')
- if net_type in ('tcp', 'toe'):
+ if net_type in ('tcp',):
port = get_option_int(options, 'port')
tcpbuf = get_option_int(options, 'tcpbuf')
irq_aff = get_option_int(options, 'irq_affinity')
- nid_xchg = get_option_int(options, 'nid_exchange')
elif net_type in ('elan', 'gm', 'scimac'):
port = 0
tcpbuf = 0
irq_aff = 0
- nid_xchg = 0
else:
print "Unknown net_type: ", net_type
sys.exit(2)
net_name = new_name('NET_'+ node_name +'_'+ net_type)
net_uuid = new_uuid(net_name)
node.appendChild(gen.network(net_name, net_uuid, nid, cluster_id, net_type,
- hostaddr, port, tcpbuf, irq_aff, nid_xchg))
+ hostaddr, port, tcpbuf, irq_aff))
node_add_profile(gen, node, "network", net_uuid)
node_name = get_option(options, 'node')
gw_net_type = get_option(options, 'nettype')
gw = get_option(options, 'gw')
- gw_cluster_id = get_option(options, 'gw_cluster_id')
+ gw_cluster_id = get_option(options, 'gateway_cluster_id')
tgt_cluster_id = get_option(options, 'target_cluster_id')
lo = get_option(options, 'lo')
hi = get_option(options, 'hi')
fstype = get_option(options, 'fstype')
journal_size = get_option(options, 'journal_size')
nspath = get_option(options, 'nspath')
+ mkfsoptions = get_option(options, 'mkfsoptions')
node_uuid = name2uuid(lustre, node_name, 'node')
mdd = gen.mdsdev(mdd_name, mdd_uuid, fstype, devname,
get_format_flag(options), node_uuid, mds_uuid,
- size, journal_size, nspath)
+ size, journal_size, nspath, mkfsoptions)
lustre.appendChild(mdd)
gen = GenConfig(doc)
+ # the PRNG is normally seeded with time(), which is not so good for starting # time-synchronized clusters
+ input = open('/dev/urandom', 'r')
+ if not input:
+ print 'Unable to open /dev/urandom!'
+ sys.exit(1)
+ seed = input.read(32)
+ input.close()
+ random.seed(seed)
+
if options.batch:
fp = open(options.batch)
batchCommands = fp.readlines()