]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
TestSnaps.cc: allow client id to be overridden
authorSamuel Just <samuel.just@dreamhost.com>
Fri, 8 Apr 2011 23:13:14 +0000 (16:13 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Fri, 8 Apr 2011 23:15:19 +0000 (16:15 -0700)
CEPH_CLIENT_ID environment variable if set now overrides the rados
client id for testsnaps

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/test/osd/RadosModel.h
src/test/osd/TestSnaps.cc

index 5a837586380d6877d6b7e09522d7d5fe64508b26..ca0c25b9b120686f297b7bafba6b88e039f9cd46 100644 (file)
@@ -186,7 +186,8 @@ struct RadosTestContext
   int max_in_flight;
        
   RadosTestContext(const string &pool_name, 
-                  int max_in_flight) :
+                  int max_in_flight,
+                  const char *id = 0) :
     state_lock("Context Lock"),
     pool_obj_cont(),
     current_snap(0),
@@ -194,7 +195,7 @@ struct RadosTestContext
     errors(0),
     max_in_flight(max_in_flight)
   {
-    rados.init(NULL);
+    rados.init(id);
     rados.conf_read_file("ceph.conf");
     rados.connect();
     rados.ioctx_create(pool_name.c_str(), io_ctx);
index fde9a62643b4ad6474875a34d041f41bab4b21a4..dfb3138de48118ec90c67f4612c6a4cf847300c6 100644 (file)
@@ -102,9 +102,12 @@ int main(int argc, char **argv)
         << std::endl;
     return 0;
   }
+
+  char *id = getenv("CEPH_CLIENT_ID");
+  if (id) cerr << "Client id is: " << id << dendl;
                
   string pool_name = "casdata";
-  RadosTestContext context(pool_name, max_in_flight);
+  RadosTestContext context(pool_name, max_in_flight, id);
 
   TestOpStat stats;
   SnapTestGenerator gen = SnapTestGenerator(ops, objects, &stats);