]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
remove user error induced asserts
authorSage Weil <sage@newdream.net>
Tue, 10 Mar 2009 16:49:06 +0000 (09:49 -0700)
committerSage Weil <sage@newdream.net>
Tue, 10 Mar 2009 16:49:06 +0000 (09:49 -0700)
src/mkmonmap.cc [deleted file]
src/monmaptool.cc
src/osdmaptool.cc

diff --git a/src/mkmonmap.cc b/src/mkmonmap.cc
deleted file mode 100644 (file)
index 9ac9b56..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <sys/stat.h>
-#include <iostream>
-#include <string>
-using namespace std;
-
-#include "config.h"
-
-#include "mon/MonMap.h"
-
-
-
-
-
-int main(int argc, const char **argv)
-{
-  vector<const char*> args;
-  argv_to_vec(argc, argv, args);
-  
-  MonMap monmap;
-
-  const char *outfn = ".ceph_monmap";
-
-  for (unsigned i=0; i<args.size(); i++) {
-    if (strcmp(args[i], "--out") == 0) 
-      outfn = args[++i];
-    else {
-      // parse ip:port
-      entity_inst_t inst;
-      if (!parse_ip_port(args[i], inst.addr)) {
-       cerr << "mkmonmap: invalid ip:port '" << args[i] << "'" << std::endl;
-       return -1;
-      }
-      inst.name = entity_name_t::MON(monmap.size());
-      cout << "mkmonmap: adding " << inst << std::endl;
-      monmap.add_mon(inst);
-    }
-  }
-
-  if (monmap.size() == 0) {
-    cerr << "usage: mkmonmap ip:port [...]" << std::endl;
-    return -1;
-  }
-
-  // write it out
-  cout << "mkmonmap: writing monmap epoch " << monmap.epoch << " to " << outfn << " (" << monmap.size() << " monitors)" << std::endl;
-  int r = monmap.write(outfn);
-  assert(r >= 0);
-  
-  return 0;
-}
index e210f60fe1d530f34b688cffd1e87f80e8ec95d5..1c0d0e2fa4c3a82f8f01fc5ec3e98624c8a9c2fe 100644 (file)
@@ -146,7 +146,10 @@ int main(int argc, const char **argv)
         << " (" << monmap.size() << " monitors)" 
         << std::endl;
     int r = monmap.write(fn);
-    assert(r >= 0);
+    if (r < 0) {
+      cerr << "monmaptool: error writing to '" << fn << "': " << strerror(-r) << std::endl;
+      return 1;
+    }
   }
   
 
index 83861010726be60d988b1aba39d691afbfcdc6aa..f51199cb9111b035136170dd8965b91ee7eb3712 100644 (file)
@@ -189,7 +189,10 @@ int main(int argc, const char **argv)
         << " to " << fn
         << std::endl;
     int r = bl.write_file(fn);
-    assert(r >= 0);
+    if (r < 0) {
+      cerr << "osdmaptool: error writing to '" << fn << "': " << strerror(-r) << std::endl;
+      return 1;
+    }
   }