Whamcloud - gitweb
- fix return code in mds_getattr_internal
authorrread <rread>
Mon, 19 Aug 2002 22:36:44 +0000 (22:36 +0000)
committerrread <rread>
Mon, 19 Aug 2002 22:36:44 +0000 (22:36 +0000)
- add support for --format flag to lmc

lustre/mds/handler.c
lustre/utils/lmc

index 07d04b8..546a0a2 100644 (file)
@@ -468,6 +468,8 @@ static int mds_getattr_internal(struct mds_obd *mds, struct dentry *dentry,
                 rc = mds_fs_get_md(mds, inode, md);
 
                 if (rc < 0) {
+                        if (rc == -ENODATA)
+                                RETURN(0);
                         CERROR("mds_fs_get_md failed: %d\n", rc);
                         RETURN(rc);
                 }
index 0b308ad..6fa35cf 100755 (executable)
@@ -135,6 +135,12 @@ def init_names(doc):
                 uuids[getUUID(n)] = 1
             init_names(n)
 
+def get_format_flag(options):
+    if options.has_key('format'):
+        if options['format']:
+            return 'yes'
+    return 'no'
+
 class GenConfig:
     doc = None
     dom = None
@@ -289,8 +295,11 @@ def mds2node(lustre, mds_name):
 
 def name2uuid(lustre, name, tag="",  fatal=1):
     ret = findByName(lustre, name, tag)
-    if not ret and fatal:
-        error('name2uuid:', name, "not found.")
+    if not ret:
+        if fatal:
+            error('name2uuid:', name, "not found.")
+        else:
+            return ""
     return getUUID(ret)
     
 # XXX: assumes only one network element per node. will fix this
@@ -352,7 +361,7 @@ def add_ost(gen, lustre, options, args):
     if not net_uuid:
         error("NODE: ", node_name, "not found")
     
-    obd = gen.obd(obdname, obd_uuid,  "extN", devname, "no", size)
+    obd = gen.obd(obdname, obd_uuid,  "extN", devname, get_format_flag(options), size)
     ost = gen.ost(ostname, ost_uuid, obd_uuid, net_uuid)
     osc = gen.osc(oscname, osc_uuid, obd_uuid, ost_uuid)
     
@@ -466,8 +475,10 @@ def add_mtpt(gen, lustre, options, args):
     if ret:
         error("MOUNTPOINT: ", name, " already exists.")
 
-    lov_uuid = name2uuid(lustre, lov_name)
     mdc_uuid = name2uuid(lustre, mdc_name)
+    lov_uuid = name2uuid(lustre, lov_name, tag='lov', fatal=0)
+    if not lov_uuid:
+        lov_uuid = name2uuid(lustre, lov_name, tag='osc', fatal=1)
 
     uuid = get_uuid(name)
     mtpt = gen.mountpoint(name, uuid, mdc_uuid, lov_uuid, path)
@@ -525,7 +536,8 @@ def add_mds(gen, lustre, options, args):
         error("NODE: ", node_name, "not found")
 
 
-    mds = gen.mds(mds_name, mds_uuid, "extN", devname, "no", net_uuid, node_uuid, dev_size=size)
+    mds = gen.mds(mds_name, mds_uuid, "extN", devname, get_format_flag(options),
+                  net_uuid, node_uuid, dev_size=size)
     mdc = gen.mdc(mdc_name, mdc_uuid, mds_uuid)
     lustre.appendChild(mds)
     lustre.appendChild(mdc)