Whamcloud - gitweb
Merge of b_md to HEAD:
[fs/lustre-release.git] / lustre / utils / lmc
index b4de811..3d7c7bf 100755 (executable)
@@ -64,7 +64,7 @@ Commands:
    specifies the node to modify.
 
 --net hostname nettype [port, recv_buf, send_buf]
-   Nettype is either tcp, elan, or gm.
+   Nettype is either tcp, toe, elan, or gm.
    Requires --node
 
 --route net gw lo [hi]
@@ -116,7 +116,7 @@ def error(*args):
 def warning(*args):
     msg = string.join(map(str,args))
     print "Warning: ", msg
-
+    
 #
 # manage names and uuids
 # need to initialize this by walking tree to ensure
@@ -249,7 +249,7 @@ class GenConfig:
 
     def osc(self, name, uuid, obd_uuid, net_uuid):
         osc = self.newService("osc", name, uuid)
-        osc.appendChild(self.ref("network", net_uuid))
+        osc.appendChild(self.ref("ost", net_uuid))
         osc.appendChild(self.ref("obd", obd_uuid))
         return osc
 
@@ -287,19 +287,18 @@ class GenConfig:
             mds.appendChild(self.ref("failover", failover_uuid))
         return mds
 
-    def mdc(self, name, uuid, mds_uuid, net_uuid):
-        mdc = self.newService("mdc",name,uuid)
-        mdc.appendChild(self.ref("mds",mds_uuid))
-        mdc.appendChild(self.ref("network",net_uuid))
-        return mdc
-    def mountpoint(self, name, uuid, mdc_uuid, osc_uuid, path):
+    def mountpoint(self, name, uuid, mds_uuid, osc_uuid, path):
         mtpt = self.newService("mountpoint", name, uuid)
-        mtpt.appendChild(self.ref("mdc", mdc_uuid))
+        mtpt.appendChild(self.ref("mds", mds_uuid))
         mtpt.appendChild(self.ref("osc", osc_uuid))
         self.addElement(mtpt, "path", path)
         return mtpt
 
+    def echo_client(self, name, uuid, osc_uuid):
+        ec = self.newService("echo_client", name, uuid)
+        ec.appendChild(self.ref("osc", osc_uuid))
+        return ec
+
 ############################################################
 # Utilities to query a DOM tree
 # Using this functions we can treat use config information
@@ -429,7 +428,7 @@ def add_net(gen, lustre, options, args):
     port = 0
     tcpbuf = 0
 
-    if net_type == 'tcp':
+    if net_type in ('tcp', 'toe'):
         if len(args) > 2:
             port = int(args[2])
         else:
@@ -482,6 +481,8 @@ def add_route(gen, lustre, options, args):
 
 
 def add_mds(gen, lustre, options, args):
+    fstype = 'extN'
+
     if len(args) < 1:
         usage()
 
@@ -490,6 +491,9 @@ def add_mds(gen, lustre, options, args):
     else:
         error("--mds requires a --node argument")
 
+    if options.has_key('fstype'):
+        fstype = options['fstype']
+
     mds_name = new_name(options['mds'])
     if mds_name != options['mds']:
         warning("name:", options['mds'], "already used. using:", mds_name)
@@ -509,8 +513,7 @@ def add_mds(gen, lustre, options, args):
     if not net_uuid:
         error("NODE: ", node_name, "not found")
 
-
-    mds = gen.mds(mds_name, mds_uuid, "extN", devname, get_format_flag(options),
+    mds = gen.mds(mds_name, mds_uuid, fstype, devname, get_format_flag(options),
                   net_uuid, node_uuid, dev_size=size)
     lustre.appendChild(mds)
                    
@@ -532,7 +535,8 @@ def add_ost(gen, lustre, options, args):
 
     if options.has_key('obdtype'):
         obdtype = options['obdtype']
-
+    if options.has_key('fstype'):
+        fstype = options['fstype']
     if obdtype == 'obdecho':
         fstype = ''
     else:
@@ -561,7 +565,7 @@ def add_ost(gen, lustre, options, args):
     
     obd = gen.obd(obdname, obd_uuid, fstype, obdtype, devname, get_format_flag(options), size)
     ost = gen.ost(ostname, ost_uuid, obd_uuid, net_uuid)
-    osc = gen.osc(oscname, osc_uuid, obd_uuid, net_uuid)
+    osc = gen.osc(oscname, osc_uuid, obd_uuid, ost_uuid)
     
     if lovname:
         lov = findByName(lustre, lovname, "lov")
@@ -593,6 +597,30 @@ def add_osc(gen, lustre, options, args):
     node_add_profile(gen, node, 'osc', osc_uuid)
 
 
+#ditto
+def add_echo_client(gen, lustre, options, args):
+    """ add an echo client to the profile for this node. """
+    if len(args) < 1:
+        usage()
+    lov_name = args[0]
+    if options.has_key('node'):
+        node_name = options['node']
+    else:
+        error("--echo_client requires a --node argument")
+    node = findByName(lustre, node_name, "node")
+
+    echoname = new_name('ECHO_'+ node_name)
+    echo_uuid = new_uuid(echoname)
+    node_add_profile(gen, node, 'echo_client', echo_uuid)
+
+    lov_uuid = name2uuid(lustre, lov_name, tag='lov', fatal=0)
+    if not lov_uuid:
+        lov_uuid = name2uuid(lustre, lov_name, tag='osc', fatal=1)
+
+    echo = gen.echo_client(echoname, echo_uuid, lov_uuid)
+    lustre.appendChild(echo)
+
+
 def add_lov(gen, lustre, options, args):
     """ create a lov """
     if len(args) < 4:
@@ -652,24 +680,7 @@ def add_mtpt(gen, lustre, options, args):
         lov_uuid = name2uuid(lustre, lov_name, tag='osc', fatal=1)
 
     uuid = new_uuid(name)
-    mdc_name = new_name('MDC_'+mds_name)
-    mdc_uuid = new_uuid(mdc_name)
-    lovnode = lookup(lustre,lov_uuid)
-
-
-    mdsnode = lookup(lustre,mds_uuid) 
-    ref = mdsnode.getElementsByTagName('network_ref')
-    net_uuid = ref[0].getAttribute('uuidref')
-
-    mdc = gen.mdc(mdc_name,mdc_uuid,mds_uuid,net_uuid)
-    lustre.appendChild(mdc)
-
-     
-    lovnode.appendChild(gen.ref("mdc",mdc_uuid))
-
-    mtpt = gen.mountpoint(name, uuid, mdc_uuid, lov_uuid, path)
-
+    mtpt = gen.mountpoint(name, uuid, mds_uuid, lov_uuid, path)
     node = findByName(lustre, node_name, "node")
     if not node:
             error('node:',  node_name, "not found.")
@@ -682,9 +693,10 @@ def add_mtpt(gen, lustre, options, args):
 #
 def parse_cmdline(argv):
     short_opts = "ho:i:m:"
-    long_opts = ["ost", "osc", "mtpt", "lov=", "node=", "mds=", "net", "tcpbuf=",
+    long_opts = ["ost", "osc", "mtpt", "lov=", "node=", "mds=", "net",
+                 "echo_client", "tcpbuf=",
                  "route", "router", "merge=", "format", "reformat", "output=",
-                 "obdtype=", "obduuid=", "in=", "help", "batch="]
+                 "obdtype=", "fstype=", "obduuid=", "in=", "help", "batch="]
     opts = []
     args = []
     options = {}
@@ -700,6 +712,8 @@ def parse_cmdline(argv):
             options['ost'] = 1
         if o == "--osc":
             options['osc'] = 1
+        if o == "--echo_client":
+            options['echo_client'] = 1
         if o == "--mds":
             options['mds'] = a
         if o == "--net":
@@ -718,6 +732,8 @@ def parse_cmdline(argv):
         # Options for commands
         if o == "--obdtype":
             options['obdtype'] = a
+        if o == "--fstype":
+            options['fstype'] = a
         if o == "--obduuid":
             options['obduuid'] = a
         if o == "--tcpbuf":
@@ -769,6 +785,8 @@ def do_command(gen, lustre, options, args):
         add_ost(gen, lustre, options, args)
     elif options.has_key('osc'):
         add_osc(gen, lustre, options, args)
+    elif options.has_key('echo_client'):
+        add_echo_client(gen, lustre, options, args)
     elif options.has_key('mtpt'):
         add_mtpt(gen, lustre, options, args)
     elif options.has_key('mds'):