Whamcloud - gitweb
smash the HEAD with the contents of b_cmd. HEAD_PRE_CMD_SMASH and
[fs/lustre-release.git] / lustre / utils / lmc
index b9a3e71..560c539 100755 (executable)
@@ -51,7 +51,7 @@ if not development_mode():
 import Lustre
 
 DEFAULT_PORT = 988 
-DEFAULT_STRIPE_SZ = 1048576
+DEFAULT_STRIPE_SZ = 65536
 DEFAULT_STRIPE_CNT = 1
 DEFAULT_STRIPE_PATTERN = 0
 UUID_MAX_LENGTH = 31
@@ -74,7 +74,7 @@ Object creation command summary:
   --node node_name
   --nid nid
   --cluster_id 
-  --nettype tcp|elan|gm
+  --nettype tcp|elan|gm|scimac
   --hostaddr addr
   --port port
   --tcpbuf size
@@ -84,17 +84,14 @@ Object creation command summary:
 --add mds
   --node node_name
   --mds mds_name
-  --failover
   --dev path
-  --backdev path
-  --fstype ldiskfs|ext3
-  --backfstype ldiskfs|ext3|tmpfs
+  --fstype extN|ext3
   --size size
   --nspath
   --journal_size size
   --inode_size size
-  --mkfsoptions options
-  --mountfsoptions options
+  --lmv lmv_name
+  --master
 
 --add lov
   --lov lov_name
@@ -102,37 +99,31 @@ Object creation command summary:
   --stripe_sz num
   --stripe_cnt num
   --stripe_pattern num
+  --lmv lmv_name
 
 --add ost
   --node node_name
   --ost ost_name 
-  --failover
   --lov lov_name 
   --dev path
-  --backdev path
   --size size
-  --fstype ldiskfs|ext3
-  --backfstype ldiskfs|ext3|tmpfs
+  --fstype extN|ext3
   --journal_size size
   --inode_size size
-  --osdtype obdecho|obdfilter
+  --obdtype obdecho|obdfilter
   --ostuuid uuid
-  --mkfsoptions options
-  --mountfsoptions options
-  --nspath
  
 --add mtpt  - Mountpoint
   --node node_name
   --path /mnt/point
   --mds mds_name
+  --lmv lmv_name
   --ost ost_name OR --lov lov_name
 
 --add route
   --node nodename
-  --router
   --gw nid
-  --gateway_cluster_id nid
-  --target_cluster_id nid
+  --tgt nid
   --lo nid
   --hi nid
 
@@ -143,10 +134,9 @@ Object creation command summary:
   --node node_name
   --mgmt mgmt_service_name
 
---add cobd
-  --node node_name
-  --real_obd obd_name
-  --cache_obd obd_name
+--add lmv
+  --lmv lmv_name
+
 """
 
 PARAM = Lustre.Options.PARAM
@@ -172,7 +162,7 @@ lmc_options = [
     ('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.", PARAM),
+    ('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),
@@ -190,20 +180,17 @@ lmc_options = [
     ('hi', "For a range route, this is a hi value nid.", PARAM,""),
 
     # servers: mds and ost
-    ('mds', "Specify MDS name.", PARAM),
+    ('mds', "Specify MDS name.", PARAM,""),
     ('ost', "Specify the OST name.", PARAM,""),
     ('osdtype', "This could obdfilter or obdecho.", PARAM, "obdfilter"),
     ('failover', "Enable failover support on OSTs or MDS?"),
     ('group', "", PARAM),
     ('dev', "Path of the device on local system.", PARAM,""),
-    ('backdev', "Path of the device for backing storage on local system.", PARAM,""),
     ('size', "Specify the size of the device if needed.", PARAM,"0"),
-    ('journal_size', "Specify new journal size for underlying file system.", PARAM,"0"),
-    ('inode_size', "Specify new inode size for underlying file system.", PARAM,"0"),
+    ('journal_size', "Specify new journal size for underlying ext3 file system.", PARAM,"0"),
+    ('inode_size', "Specify new inode size for underlying ext3 file system.", PARAM,"0"),
     ('fstype', "Optional argument to specify the filesystem type.", PARAM, "ext3"),
-    ('backfstype', "Optional argument to specify the backing filesystem type.", PARAM, "ext3"),
     ('mkfsoptions', "Optional argument to mkfs.", PARAM, ""),
-    ('mountfsoptions', "Optional argument to mount fs.", PARAM, ""),
     ('ostuuid', "", PARAM,""),
     ('nspath', "Local mount point of server namespace.", PARAM,""),
     ('format', ""),
@@ -220,10 +207,14 @@ lmc_options = [
     ('stripe_pattern', "Specify the stripe pattern. RAID 0 is the only one currently supported.", PARAM, 0),
 
     # cobd
-    ('real_obd', "Specify the real device for the cache obd system.", PARAM),
-    ('cache_obd', "Specify the cache device for the cache obd system.", PARAM),
+    ('real_obd', "", PARAM),
+    ('cache_obd', "", PARAM),
 
     ('mgmt', "Specify management/monitoring service name.", PARAM, ""),
+
+    # lmv
+    ('lmv', "Specify LMV name.", PARAM,""),
+    ('master', "Specify master MDS in LMV"),
     ]
 
 def error(*args):
@@ -387,19 +378,14 @@ class GenConfig:
         ldlm = self.newService("ldlm", name, uuid)
         return ldlm
 
-    def osd(self, name, uuid, fstype, osdtype, devname, format, ost_uuid,
-            node_uuid, dev_size=0, journal_size=0, inode_size=0, nspath="", 
-            mkfsoptions="", mountfsoptions="", backfstype="", backdevname=""):
+    def osd(self, name, uuid, fs, osdtype, devname, format, ost_uuid,
+            node_uuid, dev_size=0, journal_size=0, inode_size=0, nspath="", mkfsoptions=""):
         osd = self.newService("osd", name, uuid)
         osd.setAttribute('osdtype', osdtype)
         osd.appendChild(self.ref("target", ost_uuid))
         osd.appendChild(self.ref("node", node_uuid))
-        if fstype:
-            self.addElement(osd, "fstype", fstype)
-        if backfstype:
-            self.addElement(osd, "backfstype", backfstype)
-        if backdevname:
-            self.addElement(osd, "backdevpath", backdevname)
+        if fs:
+            self.addElement(osd, "fstype", fs)
         if devname:
             dev = self.addElement(osd, "devpath", devname)
             self.addElement(osd, "autoformat", format)
@@ -411,8 +397,6 @@ class GenConfig:
                 self.addElement(osd, "inodesize", "%s" % (inode_size))
             if mkfsoptions:
                 self.addElement(osd, "mkfsoptions", mkfsoptions)
-            if mountfsoptions:
-                self.addElement(osd, "mountfsoptions", mountfsoptions)
         if nspath:
             self.addElement(osd, "nspath", nspath)
         return osd
@@ -447,24 +431,25 @@ class GenConfig:
         lovconfig.appendChild(self.ref("lov", lov_uuid))
         return lovconfig
 
-    def mds(self, name, uuid, mdd_uuid, group=""):
+    def lmv(self, name, uuid):
+        lmv = self.newService("lmv", name, uuid)
+        return lmv
+
+    def mds(self, name, uuid, mdd_uuid, group="", lmv=""):
         mds = self.newService("mds", name, uuid)
         mds.appendChild(self.ref("active",mdd_uuid))
         if group:
             self.addElement(mds, "group", group)
+       if lmv:
+            lmv.appendChild(self.ref("active", uuid))
         return mds
 
-    def mdsdev(self, name, uuid, fstype, devname, format, node_uuid,
+    def mdsdev(self, name, uuid, fs, devname, format, node_uuid,
                mds_uuid, dev_size=0, journal_size=0, inode_size=256,
-               nspath="", mkfsoptions="", mountfsoptions="", backfstype="", 
-               backdevname=""):
+               nspath="", mkfsoptions="", lmv_uuid=""):
         mdd = self.newService("mdsdev", name, uuid)
-        self.addElement(mdd, "fstype", fstype)
-        if backfstype:
-                self.addElement(mdd, "backfstype", backfstype)
+        self.addElement(mdd, "fstype", fs)
         dev = self.addElement(mdd, "devpath", devname)
-        if backdevname:
-            self.addElement(mdd, "backdevpath", backdevname)
         self.addElement(mdd, "autoformat", format)
         if dev_size:
                 self.addElement(mdd, "devsize", "%s" % (dev_size))
@@ -476,11 +461,12 @@ class GenConfig:
             self.addElement(mdd, "nspath", nspath)
         if mkfsoptions:
             self.addElement(mdd, "mkfsoptions", mkfsoptions)
-        if mountfsoptions:
-            self.addElement(mdd, "mountfsoptions", mountfsoptions)
-
         mdd.appendChild(self.ref("node", node_uuid))
         mdd.appendChild(self.ref("target", mds_uuid))
+       if lmv_uuid:
+            mdd.appendChild(self.ref("lmv", lmv_uuid))
+           self.addElement(mdd, "lmv", lmv_uuid)
+
         return mdd
 
     def mgmt(self, mgmt_name, mgmt_uuid, node_uuid):
@@ -673,7 +659,7 @@ def add_net(gen, lustre, options):
         port = get_option_int(options, 'port')
         tcpbuf = get_option_int(options, 'tcpbuf')
         irq_aff = get_option_int(options, 'irq_affinity')
-    elif net_type in ('elan', 'gm'):
+    elif net_type in ('elan', 'gm', 'scimac'):
         port = 0
         tcpbuf = 0
         irq_aff = 0
@@ -728,13 +714,24 @@ def add_route(gen, lustre, options):
 def add_mds(gen, lustre, options):
     node_name = get_option(options, 'node')
     mds_name = get_option(options, 'mds')
+    lmv_name = get_option(options, 'lmv')
     mdd_name = new_name("MDD_" + mds_name +"_" + node_name)
     mdd_uuid = new_uuid(mdd_name)
 
+    lmv_uuid = ""
+    if lmv_name:
+        lmv = findByName(lustre, lmv_name, "lmv")
+        if not lmv:
+            error('add_mds:', '"'+lmv_name+'"', "lmv element not found.")
+        lmv_uuid = name2uuid(lustre, lmv_name, fatal=0)
+
     mds_uuid = name2uuid(lustre, mds_name, 'mds', fatal=0)
     if not mds_uuid:
         mds_uuid = new_uuid(mds_name)
-        mds = gen.mds(mds_name, mds_uuid, mdd_uuid, options.group)
+       if not lmv_name:
+            mds = gen.mds(mds_name, mds_uuid, mdd_uuid, options.group)
+       else:
+            mds = gen.mds(mds_name, mds_uuid, mdd_uuid, options.group, lmv)
         lustre.appendChild(mds)
     else:
         mds = lookup(lustre, mds_uuid)
@@ -742,15 +739,12 @@ def add_mds(gen, lustre, options):
         mds.setAttribute('failover', "1")
 
     devname = get_option(options, 'dev')
-    backdevname = get_option(options, 'backdev')
     size = get_option(options, 'size')
     fstype = get_option(options, 'fstype')
-    backfstype = get_option(options, 'backfstype')
     journal_size = get_option(options, 'journal_size')
     inode_size = get_option(options, 'inode_size')
     nspath = get_option(options, 'nspath')
     mkfsoptions = get_option(options, 'mkfsoptions')
-    mountfsoptions = get_option(options, 'mountfsoptions')
 
     node_uuid = name2uuid(lustre, node_name, 'node')
 
@@ -760,10 +754,16 @@ def add_mds(gen, lustre, options):
     if not net_uuid:
         error("NODE: ", node_name, "not found")
 
+    if lmv_name:
+        lmv.appendChild(gen.ref("mds", mds_uuid))
+        mds.appendChild(gen.ref("lmv", lmv_uuid))
+        if options.master:
+            mds.setAttribute('master', "1")
+
     mdd = gen.mdsdev(mdd_name, mdd_uuid, fstype, devname,
                      get_format_flag(options), node_uuid, mds_uuid,
-                     size, journal_size, inode_size, nspath, mkfsoptions, 
-                     mountfsoptions, backfstype, backdevname)
+                     size, journal_size, inode_size, nspath, mkfsoptions,
+                    lmv_uuid)
     lustre.appendChild(mdd)
                    
 
@@ -793,24 +793,19 @@ def add_ost(gen, lustre, options):
 
     if osdtype == 'obdecho':
         fstype = ''
-        backfstype = ''
         devname = ''
-        backdevname = ''
         size = 0
+        fstype = ''
         journal_size = ''
         inode_size = ''
         mkfsoptions = ''
-        mountfsoptions = ''
     else:
         devname = get_option(options, 'dev') # can be unset for bluearcs
-        backdevname = get_option(options, 'backdev')
         size = get_option(options, 'size')
         fstype = get_option(options, 'fstype')
-        backfstype = get_option(options, 'backfstype')
         journal_size = get_option(options, 'journal_size')
         inode_size = get_option(options, 'inode_size')
         mkfsoptions = get_option(options, 'mkfsoptions')
-        mountfsoptions = get_option(options, 'mountfsoptions')
         
     nspath = get_option(options, 'nspath')
 
@@ -846,8 +841,7 @@ def add_ost(gen, lustre, options):
 
     osd = gen.osd(osdname, osd_uuid, fstype, osdtype, devname,
                   get_format_flag(options), ost_uuid, node_uuid, size,
-                  journal_size, inode_size, nspath, mkfsoptions, 
-                  mountfsoptions, backfstype, backdevname)
+                  journal_size, inode_size, nspath, mkfsoptions)
 
     node = findByName(lustre, node_name, "node")
 
@@ -906,6 +900,11 @@ def add_lov(gen, lustre, options):
         warning("name:", lov_orig, "already used. using:", name)
 
     mds_name = get_option(options, 'mds')
+    if not mds_name:
+       lmv_name = get_option(options, 'lmv')
+       if not lmv_name:
+           error("LOV: MDS or LMV must be specified.");
+
     stripe_sz = get_option_int(options, 'stripe_sz')
     stripe_cnt = get_option_int(options, 'stripe_cnt')
     pattern = get_option_int(options, 'stripe_pattern')
@@ -915,15 +914,23 @@ def add_lov(gen, lustre, options):
     if ret:
         error("LOV: ", name, " already exists.")
 
-    mds_uuid = name2uuid(lustre, mds_name, 'mds')
+    if not mds_name:
+        mds_uuid = name2uuid(lustre, lmv_name, 'lmv')
+    else:
+        mds_uuid = name2uuid(lustre, mds_name, 'mds')
+
     lov = gen.lov(name, uuid, mds_uuid, stripe_sz, stripe_cnt, pattern)
     lustre.appendChild(lov)
     
     # add an lovconfig entry to the active mdsdev profile
     lovconfig_name = new_name('LVCFG_' + name)
     lovconfig_uuid = new_uuid(lovconfig_name)
-    mds = findByName(lustre, mds_name, "mds")
-    mds.appendChild(gen.ref("lovconfig", lovconfig_uuid))
+    if mds_name:
+        mds = findByName(lustre, mds_name, "mds")
+        mds.appendChild(gen.ref("lovconfig", lovconfig_uuid))
+    if lmv_name:
+        lmv = findByName(lustre, lmv_name, "lmv")
+        lmv.appendChild(gen.ref("lovconfig", lovconfig_uuid))
     lovconfig = gen.lovconfig(lovconfig_name, lovconfig_uuid, uuid)
     lustre.appendChild(lovconfig)
 
@@ -951,6 +958,22 @@ def add_default_lov(gen, lustre, mds_name, lov_name):
     lovconfig = gen.lovconfig(lovconfig_name, lovconfig_uuid, uuid)
     lustre.appendChild(lovconfig)
 
+def add_lmv(gen, lustre, options):
+    """ create a lmv """
+
+    lmv_orig = get_option(options, 'lmv')
+    name = new_name(lmv_orig)
+    if name != lmv_orig:
+        warning("name:", lmv_orig, "already used. using:", name)
+
+    uuid = new_uuid(name)
+    ret = findByName(lustre, name, "lmv")
+    if ret:
+        error("LMV: ", name, " already exists.")
+
+    lmv = gen.lmv(name, uuid)
+    lustre.appendChild(lmv)
+
 def new_filesystem(gen, lustre, mds_uuid, obd_uuid, mgmt_uuid):
     fs_name = new_name("FS_fsname")
     fs_uuid = new_uuid(fs_name)
@@ -961,7 +984,9 @@ def new_filesystem(gen, lustre, mds_uuid, obd_uuid, mgmt_uuid):
     return fs_uuid
 
 def get_fs_uuid(gen, lustre, mds_name, obd_name, mgmt_name):
-    mds_uuid = name2uuid(lustre, mds_name, tag='mds')
+    mds_uuid = name2uuid(lustre, mds_name, tag='mds', fatal=0)
+    if not mds_uuid:
+        mds_uuid = name2uuid(lustre, mds_name, tag='lmv', fatal=1)
     obd_uuid = name2uuid(lustre, obd_name, tag='lov', fatal=0)
     if mgmt_name:
         mgmt_uuid = name2uuid(lustre, mgmt_name, tag='mgmt', fatal=1)
@@ -982,6 +1007,10 @@ def add_mtpt(gen, lustre, options):
     lov_name = get_option(options, 'lov')
     ost_name = get_option(options, 'ost')
     mds_name = get_option(options, 'mds')
+    if mds_name == '':
+        mds_name = get_option(options, 'lmv')
+        if mds_name == '':
+            error("--add mtpt requires either --mds or --lmv.")
     if lov_name == '':
         if ost_name == '':
             error("--add mtpt requires --lov lov_name or --ost ost_name")
@@ -1143,6 +1172,8 @@ def add(devtype, gen, lustre, options):
         add_cobd(gen, lustre, options)
     elif devtype == 'mgmt':
         add_mgmt(gen, lustre, options)
+    elif devtype == 'lmv':
+        add_lmv(gen, lustre, options)
     else:
         error("unknown device type:", devtype)