]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
config: parse fsid uuid in config, not ceph_mon
authorSage Weil <sage.weil@dreamhost.com>
Thu, 5 Apr 2012 05:29:08 +0000 (22:29 -0700)
committerSage Weil <sage@newdream.net>
Thu, 5 Apr 2012 20:35:11 +0000 (13:35 -0700)
Use the new OPT_UUID type.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/ceph_mon.cc
src/common/config_opts.h
src/include/uuid.h
src/mon/MonClient.cc
src/monmaptool.cc

index 0909d6b9f9e1f8aa9d2da2e88f5c7fdefbad722d..01604ef9e290c48b30bea0b0f41779c37932a920 100644 (file)
@@ -174,13 +174,9 @@ int main(int argc, const char **argv)
       }
     }
 
-    if (!g_conf->fsid.empty()) {
-      if (!monmap.fsid.parse(g_conf->fsid.c_str())) {
-        cerr << "unable to parse fsid '" << g_conf->fsid << "'" << std::endl;
-        exit(1);
-      } else {
-        cout << argv[0] << ": set fsid to " << g_conf->fsid << std::endl;
-      }
+    if (!g_conf->fsid.is_zero()) {
+      monmap.fsid = g_conf->fsid;
+      cout << argv[0] << ": set fsid to " << g_conf->fsid << std::endl;
     }
     
     if (monmap.fsid.is_zero()) {
index 034e7dd48cbdd14fcf84782faf37d32984bc81e3..216feb6b89ae198ba209cb475639065619c41a55 100644 (file)
@@ -14,7 +14,7 @@
 
 /* note: no header guard */
 OPTION(host, OPT_STR, "localhost")
-OPTION(fsid, OPT_STR, "")              // used for mkfs
+OPTION(fsid, OPT_UUID, uuid_d())
 OPTION(public_addr, OPT_ADDR, entity_addr_t())
 OPTION(cluster_addr, OPT_ADDR, entity_addr_t())
 OPTION(public_network, OPT_STR, "")
index 60049b173af99238b74cfbc7fd2e6c0a10ee3f70..17a516043ebe0d0e5af1cb73300c495bd582f617 100644 (file)
@@ -19,7 +19,7 @@ struct uuid_d {
     memset(&uuid, 0, sizeof(uuid));
   }
 
-  bool is_zero() {
+  bool is_zero() const {
     return uuid_is_null(uuid);
   }
 
index 33ee088961b58031541c6ebd9967282e19bb15f6..f73b1e7e01f1e28d6160899154b9bf52a23a63a5 100644 (file)
@@ -97,10 +97,8 @@ int MonClient::build_initial_monmap(CephContext *cct, MonMap &monmap)
   }
 
   // fsid from conf?
-  if (cct->_conf->fsid.length()) {
-    if (!monmap.fsid.parse(cct->_conf->fsid.c_str())) {
-      cerr << " failed to parse fsid '" << cct->_conf->fsid << "'" << std::endl;
-    }
+  if (!cct->_conf->fsid.is_zero()) {
+    monmap.fsid = cct->_conf->fsid;
   }
 
   // -m foo?
index 70b30009d7696fe8ad94fca47f4bebf8f581dd18..1df5096807b1487672dbb7914dfb6345b70d0b11 100644 (file)
@@ -124,17 +124,14 @@ int main(int argc, const char **argv)
     monmap.created = ceph_clock_now(g_ceph_context);
     monmap.last_changed = monmap.created;
     srand(getpid() + time(0));
-    if (g_conf->fsid.empty()) {
+    if (g_conf->fsid.is_zero()) {
       monmap.generate_fsid();
       cout << me << ": generated fsid " << monmap.fsid << std::endl;
     }
     modified = true;
   }
-  if (g_conf->fsid.length()) {
-    if (!monmap.fsid.parse(g_conf->fsid.c_str())) {
-      cerr << me << ": failed to parse fsid '" << g_conf->fsid << "'" << std::endl;
-      exit(1);
-    }
+  if (!g_conf->fsid.is_zero()) {
+    monmap.fsid = g_conf->fsid;
     cout << me << ": set fsid to " << monmap.fsid << std::endl;
     modified = true;
   }