]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmap: test instances
authorSage Weil <sage.weil@dreamhost.com>
Wed, 1 Feb 2012 18:40:08 +0000 (10:40 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 1 Feb 2012 18:40:08 +0000 (10:40 -0800)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/OSDMap.cc
src/osd/OSDMap.h

index 16c1a73868b8aa131edd9e0233f2d88d97d7b019..bfe7ce0860a4e59b8fd48d17060b32b56c347cde 100644 (file)
@@ -18,6 +18,8 @@
 #include "common/Formatter.h"
 #include "include/ceph_features.h"
 
+#include "common/code_environment.h"
+
 // ----------------------------------
 // osd_info_t
 
@@ -727,6 +729,20 @@ void OSDMap::dump(Formatter *f) const
   f->close_section();
 }
 
+void OSDMap::generate_test_instances(list<OSDMap>& o)
+{
+  OSDMap m;
+  o.push_back(m);
+
+  CephContext *cct = new CephContext(CODE_ENVIRONMENT_UTILITY);
+
+  uuid_d fsid;
+  m.build_simple(cct, 1, fsid, 16, 7, 8, 9);
+  o.push_back(m);
+
+  delete cct;
+}
+
 string OSDMap::get_flag_string() const
 {
   string s;
index 7ef88806e2c784b67aa5c447ba3ef62bc1210e31..cf26fac0661147aa8517dfd77b1b6c3f65403a3d 100644 (file)
@@ -671,7 +671,7 @@ public:
   string get_flag_string() const;
   void dump_json(ostream& out) const;
   void dump(Formatter *f) const;
-
+  static void generate_test_instances(list<OSDMap>& o);
 };
 WRITE_CLASS_ENCODER(OSDMap)