Whamcloud - gitweb
LU-3244 utils: tunefs.lustre should preserve virgin label
[fs/lustre-release.git] / lustre / utils / mkfs_lustre.c
index 498ca76..87ba9b6 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -591,6 +591,16 @@ int main(int argc, char *const argv[])
         }
        mop.mo_ldd.ldd_flags &= ~(LDD_F_WRITECONF | LDD_F_VIRGIN);
 
+       /* svname of the form lustre:OST1234 means never registered */
+       ret = strlen(mop.mo_ldd.ldd_svname);
+       if (mop.mo_ldd.ldd_svname[ret - 8] == ':') {
+               mop.mo_ldd.ldd_svname[ret - 8] = '-';
+               mop.mo_ldd.ldd_flags |= LDD_F_VIRGIN;
+       } else if (mop.mo_ldd.ldd_svname[ret - 8] == '=') {
+               mop.mo_ldd.ldd_svname[ret - 8] = '-';
+               mop.mo_ldd.ldd_flags |= LDD_F_WRITECONF;
+       }
+
         if (strstr(mop.mo_ldd.ldd_params, PARAM_MGSNODE))
             mop.mo_mgs_failnodes++;