]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: rados-api: try harder to make these pool names unique
authorSage Weil <sage.weil@dreamhost.com>
Thu, 6 Oct 2011 20:56:58 +0000 (13:56 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Thu, 6 Oct 2011 20:56:58 +0000 (13:56 -0700)
Still getting -17 sometimes on sepia... :/

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/test/rados-api/test.cc

index 266e387b1f6290a84a0518a25d071bf3d87d1651..d741ffac5ef903a195a4a540a39f075ae4a364b1 100644 (file)
@@ -12,11 +12,14 @@ using namespace librados;
 
 std::string get_temp_pool_name()
 {
-  char out[17];
+  char hostname[80];
+  char out[80];
+  memset(hostname, 0, sizeof(hostname));
   memset(out, 0, sizeof(out));
-  for (size_t i = 0; i < sizeof(out) - 1; ++i) {
-    out[i] = 'A' + (rand() % 26);
-  }
+  gethostname(hostname, sizeof(hostname)-1);
+  static int num = 1;
+  sprintf(out, "%s-%d-%d", hostname, getpid(), num);
+  num++;
   std::string prefix("test-rados-api-");
   prefix += out;
   return prefix;